[CalendarServer-changes] [6507] CalendarServer/branches/users/glyph/sharedpool
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 1 14:16:38 PDT 2010
Revision: 6507
http://trac.macosforge.org/projects/calendarserver/changeset/6507
Author: glyph at apple.com
Date: 2010-11-01 14:16:36 -0700 (Mon, 01 Nov 2010)
Log Message:
-----------
add arg to getRootResource
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sharedpool/calendarserver/sidecar/task.py
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/purge.py
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/test/test_principals.py
CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/sidecar/task.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/sidecar/task.py 2010-11-01 21:16:16 UTC (rev 6506)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/sidecar/task.py 2010-11-01 21:16:36 UTC (rev 6507)
@@ -27,7 +27,7 @@
from zope.interface import implements
-from twisted.application.service import Service, IServiceMaker
+from twisted.application.service import MultiService, Service, IServiceMaker
from twisted.internet.defer import DeferredList, inlineCallbacks, returnValue
from twisted.internet.reactor import callLater
from twisted.plugin import IPlugin
@@ -318,6 +318,7 @@
def makeService(self, options):
+ svc = MultiService()
#
# The task sidecar doesn't care about system SACLs
#
@@ -330,11 +331,12 @@
oldLogLevel = logLevelForNamespace(None)
setLogLevelForNamespace(None, "info")
- rootResource = getRootResource(config)
+ rootResource = getRootResource(config, svc)
- service = CalDAVTaskService(rootResource)
+ CalDAVTaskService(rootResource).setServiceParent(svc)
# Change log level back to what it was before
setLogLevelForNamespace(None, oldLogLevel)
- return service
+ return svc
+
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py 2010-11-01 21:16:16 UTC (rev 6506)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py 2010-11-01 21:16:36 UTC (rev 6507)
@@ -87,6 +87,7 @@
try:
from calendarserver.version import version
+ version
except ImportError:
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "support"))
from version import version as getVersion
@@ -497,7 +498,6 @@
additional = []
if config.Scheduling.iMIP.Enabled:
additional.append(("inbox", IMIPReplyInboxResource, [], "digest"))
- rootResource = getRootResource(config, additional)
#
# Configure the service
@@ -528,6 +528,8 @@
service = CalDAVService(logObserver)
+ rootResource = getRootResource(config, service, additional)
+
underlyingSite = Site(rootResource)
requestFactory = underlyingSite
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:16:16 UTC (rev 6506)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:16:36 UTC (rev 6507)
@@ -78,7 +78,7 @@
-def storeFromConfig(config, notifierFactory=None):
+def storeFromConfig(config, serviceParent, notifierFactory=None):
"""
Produce an L{IDataStore} from the given configuration and notifier factory.
"""
@@ -114,6 +114,7 @@
directories = []
directoryClass = namedClass(config.DirectoryService.type)
+ principalResourceClass = DirectoryPrincipalProvisioningResource
log.info("Configuring directory service of type: %s"
% (config.DirectoryService.type,))
@@ -189,11 +190,13 @@
directory.setRealm(realmName)
except ImportError:
pass
-
+ log.info("Setting up principal collection: %r"
+ % (principalResourceClass,))
+ principalResourceClass("/principals/", directory)
return directory
-def getRootResource(config, resources=None):
+def getRootResource(config, serviceParent, resources=None):
"""
Set up directory service and resource hierarchy based on config.
Return root resource.
@@ -210,7 +213,6 @@
# Default resource classes
#
rootResourceClass = RootResource
- principalResourceClass = DirectoryPrincipalProvisioningResource
calendarResourceClass = DirectoryCalendarHomeProvisioningResource
iScheduleResourceClass = IScheduleInboxResource
timezoneServiceResourceClass = TimezoneServiceResource
@@ -322,10 +324,8 @@
#
log.info("Setting up document root at: %s"
% (config.DocumentRoot,))
- log.info("Setting up principal collection: %r"
- % (principalResourceClass,))
- principalCollection = principalResourceClass("/principals/", directory)
+ principalCollection = directory.principalCollection
#
# Configure NotifierFactory
@@ -338,7 +338,7 @@
else:
notifierFactory = None
- newStore = storeFromConfig(config, notifierFactory)
+ newStore = storeFromConfig(config, serviceParent, notifierFactory)
if config.EnableCalDAV:
log.info("Setting up calendar collection: %r" % (calendarResourceClass,))
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/purge.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/purge.py 2010-11-01 21:16:16 UTC (rev 6506)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/purge.py 2010-11-01 21:16:36 UTC (rev 6507)
@@ -97,6 +97,7 @@
os.umask(config.umask)
try:
+ # TODO: getRootResource needs a parent service now.
rootResource = getRootResource(config)
directory = rootResource.getDirectory()
except DirectoryError, e:
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/test/test_principals.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/test/test_principals.py 2010-11-01 21:16:16 UTC (rev 6506)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tools/test/test_principals.py 2010-11-01 21:16:36 UTC (rev 6507)
@@ -24,7 +24,7 @@
from twistedcaldav.directory.directory import DirectoryError
from twistedcaldav.test.util import TestCase, CapturingProcessProtocol
-from calendarserver.tap.util import getRootResource
+from calendarserver.tap.util import directoryFromConfig
from calendarserver.tools.principals import parseCreationArgs, matchStrings, updateRecord, principalForPrincipalID, getProxies, setProxies
@@ -226,7 +226,7 @@
@inlineCallbacks
def test_updateRecord(self):
- directory = getRootResource(config).getDirectory()
+ directory = directoryFromConfig(config)
guid = "eee28807-a8c5-46c8-a558-a08281c558a7"
(yield updateRecord(True, directory, "locations",
@@ -264,7 +264,7 @@
"""
Read and Write proxies can be set en masse
"""
- directory = getRootResource(config).getDirectory()
+ directory = directoryFromConfig(config)
principal = principalForPrincipalID("users:user01", directory=directory)
readProxies, writeProxies = (yield getProxies(principal, directory=directory))
Modified: CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py 2010-11-01 21:16:16 UTC (rev 6506)
+++ CalendarServer/branches/users/glyph/sharedpool/twistedcaldav/mail.py 2010-11-01 21:16:36 UTC (rev 6507)
@@ -597,6 +597,7 @@
self.mailer = mailer
rootResource = getRootResource(config,
+ self,
(
("inbox", IMIPInvitationInboxResource, (mailer,), "digest"),
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101101/874e5e36/attachment-0001.html>
More information about the calendarserver-changes
mailing list