Use Django dispatcher instead of CherryPy dispatcher

This commit is big because anything small breaks the code.

- Django dispatcher is based on regular expressions and does not need a tree structure
- Reduces a lot of unnecessary dependencies among modules
- Use Django sessions middlewear instead of CherryPy sessions
- Introduce dependency based modules instead of numeric load order
- Remove PagePlugin and simply use Django views
- Eliminate page rendering wrappers in favor of Django context processors
- Use custom auth for now until replaced by Django auth middlewear
- Use Django templated 404 and 500 error pages
This commit is contained in:
Sunil Mohan Adapa committed 2014-06-12 23:33:25 +05:30
1 parent 657bb11bbc
commit 58d13e3ed8
42 files changed
+1281 -1289

No files matched your search

+2 -1
View File
@@ -20,6 +20,7 @@ Plinth module for system section page
"""
from . import system
from system import init
__all__ = ['system']
__all__ = ['system', 'init']
+9 -15
View File
@@ -1,21 +1,15 @@
import cherrypy
from gettext import gettext as _
from plugin_mount import PagePlugin
from django.template.response import TemplateResponse
import cfg
import util
class Sys(PagePlugin):
order = 10
def init():
"""Initialize the system module"""
cfg.main_menu.add_item(_('System'), 'icon-cog', '/sys', 100)
def __init__(self):
super(Sys, self).__init__()
self.register_page("sys")
self.menu = cfg.main_menu.add_item(_("System"), "icon-cog", "/sys", 100)
self.menu.add_item(_("Users and Groups"), "icon-user", "/sys/users", 15)
@cherrypy.expose
def index(self):
return util.render_template(template='system',
title=_("System Configuration"))
def index(request):
"""Serve the index page"""
return TemplateResponse(request, 'system.html',
{'title': _('System Configuration')})