UserView

Nearby › Ideas

Draft for user views documentation.


User views will allow to add custom processing to certain pages, e.g.:

from views import page
@action(r'^/FrontPage$')
def page_frontpage(request):
  # Do custom processing for FrontPage
  ...
  # Call standard handler
  return page(request)

With clever use of regular expressions one can trap partial page names. For example a custom view for category pages could be written as:

from views import page
@action(r'^/Category')
def page_category(request):
  # Do custom processing for Category* pages
  ...

This will allow to build special pages with specific templates.

User views are injected into URL_MAP, before all other standard a views. This way potentially every predefined view can be overridden.

Bikini will load custom views from the file user_views.py.

Last edited on Jan 03, 2013 by AnonymousCoward · Source · Diff