engine.controller — Controller of MVC

Warning

This package is not documented yet.

Controller Accepts input and converts it to commands for the model or view. <Wikipedia>

Here is a foo_bar controller example:

from dp_tornado.engine.controller import Controller

class FooBarController(Controller):
    def get(self):
        self.finish('done')

Directory/File and URL Mapping rules

  • /controller/__init__.py, StarterController > /
  • /controller/blog/__init__.py, BlogController > /blog
  • /controller/blog/admin/__init__.py, AdminController > /blog/admin
  • /controller/blog/post.py, PostController > /blog/post
  • /controller/blog/view.py, ViewController > /blog/view
  • /controller/foo_bar.py, FooBarController > /foo_bar

Class/Method and URL Mapping rules

  • /controller/foo.py, def get(self): GET /foo
  • /controller/foo.py, def get(self, a): GET /foo/{path}
  • /controller/foo.py, def get(self, a, b): GET /foo/{path}/{path}
  • /controller/foo.py, def get(self, a, b=None): GET /foo/{path}/{path} and GET /foo/{path}
  • /controller/foo.py, def post(self): POST /foo
  • /controller/foo.py, def put(self): PUT /foo
  • /controller/foo.py, def delete(self): DELETE /foo
  • /controller/foo.py, def head(self): HEAD /foo
  • /controller/foo.py, def patch(self): PATCH /foo
class dp_tornado.engine.controller.Controller(application, request, **kwargs)[source]

Bases: dp_tornado.engine.engine.Engine

Base class for HTTP request.

cookie(name, value=None, **kwargs)[source]
finish(chunk=None)[source]
finish_with_error(status_code, message='An error has occurred')[source]
get_argument(name, default=None, strip=True, cast=None, fmt=None, lrange=None, delimiter=None, value=None, **ext)[source]
get_session_value(name, expire_in=None, sessionid=None)[source]
get_session_value_ttl(name)[source]
get_sessionid()[source]
get_user_agent(parsed=True, user_agent=None)[source]
initialize(prefix, parent=None)[source]
m17n_lang(lang=None)[source]
prefixize(url)[source]
redirect(url, prefixize=False, permanent=False, status=None, safe=False)[source]
remote_ip
render(template_name, kwargs=None)[source]
render_string(template_name, kwargs=None)[source]
request
request_uri(*args, **kwargs)[source]
static route(path)[source]
session(name, value=None, expire_in=<dp_tornado.engine.controller.NoneValue object>)[source]
set_header(name, value)[source]
set_session_value(name, value, expire_in=<dp_tornado.engine.controller.NoneValue object>)[source]
set_sessionid(sessionid=None)[source]
write(chunk)[source]
class dp_tornado.engine.controller.NoneValue[source]

Bases: object