turboengine

Utilities for google app engine


Keywords
GAE utility
License
MIT
Install
pip install turboengine==1.0.2

Documentation

===========
Turboengine
===========

Google app engine utilities using some django's ideas.

Install
-------
:
    git clone git://github.com/carlitux/turboengine.git
    cd turboengine
    python setup.py Install
    
Usage
-----
Create an setting.py file and can add variables settings as you want, but
this is some commons variables::
    TEMPLATE_PATH = 'templates'

    # setting DEBUG
    DEBUG = True
    SITE_TITLE = 'turboengine for GAE'

    # mapping (parent url, appname) 
    INSTALLED_APPS = [(parent_url, appnane)] # app names shouldn't be standard python libraries and they should be importables into PYTHONPATH
    TEMPLATE_TAGS_PATHS = [] # not used but it will be used in feature for loading templatetags
    ERROR_PAGE_PATH = '/error/' # path where will be redirected the error
    LOGIN_PATH_REDIRECT = '/'   # path where redirect after login or logout
    PROFILE_PATH = '/account/profile/'

To import settings do this:
    from turboengine.conf import settings
    
If you want to implement an Website use this:
    from turboengine.http import RequestHandler
    from turboengine.decorators import login_required
    
    class MyHandler(RequestHandler):
        def get(self):
            # you can add headers or common usages of the request
            user = self.user # return authenticated user or None if is not logged in
            .... code
            self.render_template(template, paramaters)
            
        @login_required
        def post(self):
            .... code
            
And use one file like (app.py)::
    from google.appengine.ext import webapp
    from google.appengine.ext.webapp.util import run_wsgi_app
      
    from turboengine import urls
    from turboengine.conf import settings
      
    application = webapp.WSGIApplication(urls.generate_urls(settings.INSTALLED_APPS), debug=settings.DEBUG)
      
    def main():   
        run_wsgi_app(application)
      
    if __name__ == "__main__":
        main()
        
If you want to implement webservices first install ZSI and zope.interface then::
    from turboengine.webservices.application import SOAPAplication
    from turboengine.webservices.application import WSGIAplication
    
    from EchoServer_server import * # this class is generated by 'python wsdl2py SimpleEcho.wsdl' see http://carlitos-kyo.blogspot.com/2009/12/web-services-python-google-app-engine.html
    
    # Implementing services

    class wsEchoServer(EchoServer):
        # Make WSDL available for HTTP GET
        wsdl = "".join(open('SimpleEcho.wsdl').readlines())
        disco = "".join(open('SimpleEcho.disco').readlines())
          
        def soap_Echo(self, ps, **kw):
            request, response = EchoServer.soap_Echo(self, ps, **kw)
            return request, request 
    
    def main():
        application = WSGIApplication()
        application['EchoServer.asmx'] = SOAPAplication(wsEchoServer())
        #application['OtherServer.asmx'] = SOAPAplication(wsOtherServer()) # could have many webservices
        run_wsgi_app(application)
    
    if __name__ == '__main__':
        main()
        
Please to see how to use webservices on GAE visit this: 
   http://carlitos-kyo.blogspot.com/2009/12/web-services-python-google-app-engine.html
   
TODO
----

Implement restful and templatetags