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

+3 -3
View File
@@ -16,10 +16,10 @@
#
"""
Plinth module for apps section page
Plinth module for Apps section page
"""
from . import apps
from .apps import init
__all__ = ['apps']
__all__ = ['apps', 'init']
+8 -13
View File
@@ -1,19 +1,14 @@
import cherrypy
from django.template.response import TemplateResponse
from gettext import gettext as _
from plugin_mount import PagePlugin
import cfg
import util
class Apps(PagePlugin):
def __init__(self):
super(Apps, self).__init__()
def init():
"""Initailize the apps module"""
cfg.main_menu.add_item("Apps", "icon-download-alt", "/apps", 80)
self.register_page("apps")
self.menu = cfg.main_menu.add_item("Apps", "icon-download-alt", "/apps", 80)
self.menu.add_item("Chat", "icon-comment", "/../jwchat", 30)
@cherrypy.expose
def index(self):
return util.render_template(template='apps',
title=_('User Applications'))
def index(request):
"""Serve the apps index page"""
return TemplateResponse(request, 'apps.html', {'title': _('Applications')})