[CalendarServer-changes] [12749] CalendarServer/trunk/calendarserver/webadmin/landing.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 25 12:59:45 PST 2014
Revision: 12749
http://trac.calendarserver.org//changeset/12749
Author: wsanchez at apple.com
Date: 2014-02-25 12:59:45 -0800 (Tue, 25 Feb 2014)
Log Message:
-----------
Clean up reload logic
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/webadmin/landing.py
Modified: CalendarServer/trunk/calendarserver/webadmin/landing.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/landing.py 2014-02-25 20:08:59 UTC (rev 12748)
+++ CalendarServer/trunk/calendarserver/webadmin/landing.py 2014-02-25 20:59:45 UTC (rev 12749)
@@ -27,9 +27,9 @@
from .resource import PageElement, TemplateResource
from .resource import WebAdminResource
-# from .logs import LogsResource
-# from .principals import PrincipalsResource
-# from .work import WorkMonitorResource
+from .logs import LogsResource
+from .principals import PrincipalsResource
+from .work import WorkMonitorResource
from . import logs, principals, work
@@ -58,6 +58,7 @@
addSlash = True
+
def __init__(self, path, root, directory, store, principalCollections=()):
TemplateResource.__init__(self, WebAdminLandingPageElement)
@@ -67,9 +68,9 @@
# self._root = root
# self._principalCollections = principalCollections
- # self.putChild(u"logs", LogsResource())
- # self.putChild(u"principals", PrincipalsResource(directory))
- # self.putChild(u"work", WorkMonitorResource(store))
+ self.putChild(u"logs", LogsResource())
+ self.putChild(u"principals", PrincipalsResource(directory))
+ self.putChild(u"work", WorkMonitorResource(store))
self.putChild(
u"old",
@@ -80,9 +81,21 @@
def getChild(self, name):
+ bound = super(WebAdminLandingResource, self).getChild(name)
+
+ if bound is not None:
+ return bound
+
+ #
+ # Dynamically load and vend child resources not bound using putChild()
+ # in __init__(). This is useful for development, since it allows one
+ # to comment out the putChild() call above, and then code will be
+ # re-loaded for each request.
+ #
+
if name == u"logs":
reload(logs)
- resource = logs.LogsResource()
+ return logs.LogsResource()
elif name == u"principals":
reload(principals)
@@ -92,4 +105,4 @@
reload(work)
return work.WorkMonitorResource(self.store)
- return super(WebAdminLandingResource, self).getChild(name)
+ return None
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140225/f44ebc6e/attachment-0001.html>
More information about the calendarserver-changes
mailing list