[CalendarServer-changes] [9145] CalendarServer/branches/users/gaya/ldapdirectorybacker
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 17 13:51:15 PDT 2012
Revision: 9145
http://trac.macosforge.org/projects/calendarserver/changeset/9145
Author: gaya at apple.com
Date: 2012-04-17 13:51:14 -0700 (Tue, 17 Apr 2012)
Log Message:
-----------
add uri to DirectoryBackedAddressBookResource and use it in ABDirectoryQueryResult hRef()
Modified Paths:
--------------
CalendarServer/branches/users/gaya/ldapdirectorybacker/calendarserver/tap/util.py
CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py
CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directorybackedaddressbook.py
Modified: CalendarServer/branches/users/gaya/ldapdirectorybacker/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/gaya/ldapdirectorybacker/calendarserver/tap/util.py 2012-04-17 20:44:49 UTC (rev 9144)
+++ CalendarServer/branches/users/gaya/ldapdirectorybacker/calendarserver/tap/util.py 2012-04-17 20:51:14 UTC (rev 9145)
@@ -34,6 +34,7 @@
from twext.python.log import Logger
from twext.web2.auth.basic import BasicCredentialFactory
from twext.web2.dav import auth
+from twext.web2.dav.util import joinURL
from twext.web2.http_headers import Headers
from twext.web2.static import File as FileResource
@@ -482,12 +483,12 @@
newStore,
)
- directoryPath = os.path.join(config.DocumentRoot, config.DirectoryAddressBook.name)
if config.DirectoryAddressBook.Enabled and config.EnableSearchAddressBook:
log.info("Setting up directory address book: %r" % (directoryBackedAddressBookResourceClass,))
directoryBackedAddressBookCollection = directoryBackedAddressBookResourceClass(
- principalCollections=(principalCollection,)
+ principalCollections=(principalCollection,),
+ uri=joinURL("/", config.DirectoryAddressBook.name, "/")
)
if _reactor._started:
directoryBackedAddressBookCollection.provisionDirectory()
@@ -495,6 +496,7 @@
addSystemEventTrigger("after", "startup", directoryBackedAddressBookCollection.provisionDirectory)
else:
# remove /directory from previous runs that may have created it
+ directoryPath = os.path.join(config.DocumentRoot, config.DirectoryAddressBook.name)
try:
FilePath(directoryPath).remove()
log.info("Deleted: %s" % directoryPath)
Modified: CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py 2012-04-17 20:44:49 UTC (rev 9144)
+++ CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directory/opendirectorybacker.py 2012-04-17 20:51:14 UTC (rev 9145)
@@ -1667,9 +1667,8 @@
def uriName(self):
return self.vCard().propertyValue("UID") + ".vcf"
- def hRef(self, parentURI="/directory/"):
- # FIXME: Get the parent URI from self._directoryBackedAddressBook
- return davxml.HRef.fromString(joinURL(parentURI, self.uriName()))
+ def hRef(self, parentURI=None):
+ return davxml.HRef.fromString(joinURL(parentURI if parentURI else self._directoryBackedAddressBook.uri, self.uriName()))
def readProperty(self, property, request):
Modified: CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directorybackedaddressbook.py
===================================================================
--- CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directorybackedaddressbook.py 2012-04-17 20:44:49 UTC (rev 9144)
+++ CalendarServer/branches/users/gaya/ldapdirectorybacker/twistedcaldav/directorybackedaddressbook.py 2012-04-17 20:51:14 UTC (rev 9145)
@@ -45,10 +45,11 @@
Directory-backed address book
"""
- def __init__(self, principalCollections):
+ def __init__(self, principalCollections, uri):
CalDAVResource.__init__(self, principalCollections=principalCollections)
-
+
+ self.uri = uri
self.directory = None # creates directory attribute
# create with permissions, similar to CardDAVOptions in tap.py
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120417/444a6a23/attachment.html>
More information about the calendarserver-changes
mailing list