[CalendarServer-changes] [12748] CalendarServer/trunk/calendarserver/webadmin/landing.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 25 12:08:59 PST 2014


Revision: 12748
          http://trac.calendarserver.org//changeset/12748
Author:   wsanchez at apple.com
Date:     2014-02-25 12:08:59 -0800 (Tue, 25 Feb 2014)
Log Message:
-----------
Reload on each request so that changing code is easier.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/webadmin/landing.py

Modified: CalendarServer/trunk/calendarserver/webadmin/landing.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/landing.py	2014-02-25 02:26:17 UTC (rev 12747)
+++ CalendarServer/trunk/calendarserver/webadmin/landing.py	2014-02-25 20:08:59 UTC (rev 12748)
@@ -27,12 +27,14 @@
 
 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
 
 
+
 class WebAdminLandingPageElement(PageElement):
     """
     Web administration langing page element.
@@ -59,15 +61,15 @@
     def __init__(self, path, root, directory, store, principalCollections=()):
         TemplateResource.__init__(self, WebAdminLandingPageElement)
 
-        self._path = path
-        self._root = root
         self.directory = directory
         self.store = store
-        self._principalCollections = principalCollections
+        # self._path = path
+        # 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",
@@ -75,3 +77,19 @@
                 path, root, directory, store, principalCollections
             )
         )
+
+
+    def getChild(self, name):
+        if name == u"logs":
+            reload(logs)
+            resource = logs.LogsResource()
+
+        elif name == u"principals":
+            reload(principals)
+            return principals.PrincipalsResource(self.directory)
+
+        elif name == u"work":
+            reload(work)
+            return work.WorkMonitorResource(self.store)
+
+        return super(WebAdminLandingResource, self).getChild(name)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140225/e403fc51/attachment-0001.html>


More information about the calendarserver-changes mailing list