[CalendarServer-changes] [9703] CalendarServer/branches/users/gaya/inviteclean/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 14 14:34:30 PDT 2012
Revision: 9703
http://trac.macosforge.org/projects/calendarserver/changeset/9703
Author: gaya at apple.com
Date: 2012-08-14 14:34:30 -0700 (Tue, 14 Aug 2012)
Log Message:
-----------
Remove unused default params in _NewStorePropertiesWrapper
Modified Paths:
--------------
CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/resource.py
CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py
Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/resource.py 2012-08-14 18:40:59 UTC (rev 9702)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/resource.py 2012-08-14 21:34:30 UTC (rev 9703)
@@ -496,19 +496,17 @@
isvirt = self.isVirtualShare()
if isvirt:
if self.isShadowableProperty(qname):
- ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
- p = self.deadProperties().contains(qname, uid=ownerPrincipal.principalUID())
+ p = self.deadProperties().contains(qname)
if p:
returnValue(p)
elif (not self.isGlobalProperty(qname)):
- result = (yield self._hasSharedProperty(qname, request))
+ result = self._hasSharedProperty(qname, request)
returnValue(result)
res = (yield self._hasGlobalProperty(property, request))
returnValue(res)
- @inlineCallbacks
def _hasSharedProperty(self, qname, request):
# Always have default alarms on shared calendars
@@ -518,11 +516,10 @@
caldavxml.DefaultAlarmVToDoDateTime.qname(),
caldavxml.DefaultAlarmVToDoDate.qname(),
) and self.isCalendarCollection():
- returnValue(True)
+ return True
- ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
- p = self.deadProperties().contains(qname, uid=ownerPrincipal.principalUID())
- returnValue(p)
+ p = self.deadProperties().contains(qname)
+ return p
def _hasGlobalProperty(self, property, request):
"""
@@ -572,27 +569,25 @@
if isvirt:
if self.isShadowableProperty(qname):
- ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
try:
- p = self.deadProperties().get(qname, uid=ownerPrincipal.principalUID())
+ p = self.deadProperties().get(qname)
returnValue(p)
except PropertyNotFoundError:
pass
elif (not self.isGlobalProperty(qname)):
- result = (yield self._readSharedProperty(qname, request))
+ result = self._readSharedProperty(qname, request)
returnValue(result)
res = (yield self._readGlobalProperty(qname, property, request))
returnValue(res)
- @inlineCallbacks
+
def _readSharedProperty(self, qname, request):
# Default behavior - read per-user dead property
- ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
- p = self.deadProperties().get(qname, uid=ownerPrincipal.principalUID())
- returnValue(p)
+ p = self.deadProperties().get(qname)
+ return p
@inlineCallbacks
def _readGlobalProperty(self, qname, property, request):
@@ -723,8 +718,7 @@
isvirt = self.isVirtualShare()
if isvirt and (self.isShadowableProperty(property.qname()) or (not self.isGlobalProperty(property.qname()))):
yield self._preProcessWriteProperty(property, request, isShare=True)
- ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
- p = self.deadProperties().set(property, uid=ownerPrincipal.principalUID())
+ p = self.deadProperties().set(property)
returnValue(p)
res = (yield self._writeGlobalProperty(property, request))
@@ -2856,13 +2850,17 @@
defaultAddressBookURL = joinURL(self.url(), "addressbook")
defaultAddressBook = (yield self.makeRegularChild("addressbook"))
if defaultAddressBook is None or not defaultAddressBook.exists():
- getter = iter((yield self._newStoreHome.addressbooks())) # These are only unshared children
+ addressbooks = yield self._newStoreHome.addressbooks()
+ ownedAddressBooks = [addressbook for addressbook in addressbooks if addressbook.owned()]
+ ownedAddressBooks.sort(key=lambda ab:ab.name())
+
+ # These are only unshared children
# FIXME: the back-end should re-provision a default addressbook here.
# Really, the dead property shouldn't be necessary, and this should
# be entirely computed by a back-end method like 'defaultAddressBook()'
try:
- anAddressBook = getter.next()
- except StopIteration:
+ anAddressBook = ownedAddressBooks[0]
+ except IndexError:
raise RuntimeError("No address books at all.")
defaultAddressBookURL = joinURL(self.url(), anAddressBook.name())
Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py 2012-08-14 18:40:59 UTC (rev 9702)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py 2012-08-14 21:34:30 UTC (rev 9703)
@@ -98,7 +98,7 @@
# FIXME 'uid' here should be verifying something.
- def get(self, qname, uid=None):
+ def get(self, qname):
try:
return self._newPropertyStore[self._convertKey(qname)]
except KeyError:
@@ -108,7 +108,7 @@
))
- def set(self, property, uid=None):
+ def set(self, property):
try:
self._newPropertyStore[self._convertKey(property.qname())] = property
except PropertyChangeNotAllowedError:
@@ -119,7 +119,7 @@
- def delete(self, qname, uid=None):
+ def delete(self, qname):
try:
del self._newPropertyStore[self._convertKey(qname)]
except KeyError:
@@ -128,11 +128,11 @@
pass
- def contains(self, qname, uid=None, cache=True):
+ def contains(self, qname):
return (self._convertKey(qname) in self._newPropertyStore)
- def list(self, uid=None, filterByUID=True, cache=True):
+ def list(self):
return [(pname.namespace, pname.name) for pname in
self._newPropertyStore.keys()]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120814/af635ce3/attachment.html>
More information about the calendarserver-changes
mailing list