Mojo.RequestHandlers

The MojoRequestHandler is the basic RequestHandler class that you use in your application instead of the standard Tornado RequestHandler:

class pageHandler(MojoRequestHandler, MojoAuthMixin, SessionMixin_Sync):
#You don't need to use the Mixins, but they make life a lot easier.

    def get(self):
        #Do some cool stuff

        self.render('login.html', error=None)
class Mojo.RequestHandlers.MojoHandler.MojoRequestHandler(application, request, **kwargs)

The MojoRequestHandler is the starting point of any request in Mojo, subclass this for every URL you want to serve in Mojo.

The MojoRequestHandler has some handy properties:

  • application: This is a reference to the server object, and give access to project settings
  • application.mojo_settings: All variables declared in your settings.py file
  • db: the database Session object (for direct access to the DB you can get to the driver through db._db.<function>)

If you are using the MojoAuthMixin or SessionMixin, the request handlers expand with many more management functions to make life easier for the developer.

Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.