[CalendarServer-changes] [9756] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 30 09:57:22 PDT 2012
Revision: 9756
http://trac.macosforge.org/projects/calendarserver/changeset/9756
Author: cdaboo at apple.com
Date: 2012-08-30 09:57:22 -0700 (Thu, 30 Aug 2012)
Log Message:
-----------
Remove redundant text-based data argument from the StoreXXXResource classes.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py
CalendarServer/trunk/twistedcaldav/method/put_common.py
CalendarServer/trunk/twistedcaldav/storebridge.py
Modified: CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py 2012-08-30 16:55:12 UTC (rev 9755)
+++ CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py 2012-08-30 16:57:22 UTC (rev 9756)
@@ -89,7 +89,7 @@
request,
source=None, source_uri=None, sourceparent=None, sourceadbk=False, deletesource=False,
destination=None, destination_uri=None, destinationparent=None, destinationadbk=True,
- vcard=None, vcarddata=None,
+ vcard=None,
indexdestination = True,
returnData=False,
):
@@ -103,7 +103,6 @@
@param destination: the L{CalDAVResource} for the destination resource to copy into.
@param destination_uri: the URI for the destination resource.
@param vcard: the C{str} or L{Component} vcard data if there is no source, None otherwise.
- @param vcarddata: the C{str} vcard data if there is no source, None otherwise. Optional.
@param sourceadbk: True if the source resource is in a vcard collection, False otherwise.
@param destinationadbk: True if the destination resource is in a vcard collection, False otherwise
@param sourceparent: the L{CalDAVResource} for the source resource's parent collection, or None if source is None.
@@ -143,7 +142,7 @@
self.destination_uri = destination_uri
self.destinationparent = destinationparent
self.vcard = vcard
- self.vcarddata = vcarddata
+ self.vcarddata = None
self.deletesource = deletesource
self.indexdestination = indexdestination
self.returnData = returnData
@@ -191,7 +190,6 @@
else:
try:
if type(self.vcard) in (types.StringType, types.UnicodeType,):
- self.vcarddata = self.vcard
self.vcard = Component.fromString(self.vcard)
except ValueError, e:
log.err(str(e))
@@ -416,11 +414,8 @@
@inlineCallbacks
def doStorePut(self):
- if self.vcarddata is None:
- self.vcarddata = str(self.vcard)
- stream = MemoryStream(self.vcarddata)
+ stream = MemoryStream(str(self.vcard))
response = (yield self.destination.storeStream(stream))
-
returnValue(response)
@inlineCallbacks
Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py 2012-08-30 16:55:12 UTC (rev 9755)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py 2012-08-30 16:57:22 UTC (rev 9756)
@@ -127,7 +127,7 @@
request,
source=None, source_uri=None, sourceparent=None, sourcecal=False, deletesource=False,
destination=None, destination_uri=None, destinationparent=None, destinationcal=True,
- calendar=None, calendardata=None,
+ calendar=None,
isiTIP=False,
allowImplicitSchedule=True,
internal_request=False,
@@ -144,7 +144,6 @@
@param destination: the L{CalDAVResource} for the destination resource to copy into.
@param destination_uri: the URI for the destination resource.
@param calendar: the C{str} or L{Component} calendar data if there is no source, None otherwise.
- @param calendardata: the C{str} calendar data if there is no source, None otherwise. Optional
@param sourcecal: True if the source resource is in a calendar collection, False otherwise.
@param destinationcal: True if the destination resource is in a calendar collection, False otherwise
@param sourceparent: the L{CalDAVResource} for the source resource's parent collection, or None if source is None.
@@ -189,7 +188,6 @@
self.destination_uri = destination_uri
self.destinationparent = destinationparent
self.calendar = calendar
- self.calendardata = calendardata
self.deletesource = deletesource
self.isiTIP = isiTIP
self.allowImplicitSchedule = allowImplicitSchedule
@@ -278,7 +276,6 @@
else:
try:
if type(self.calendar) in (types.StringType, types.UnicodeType,):
- self.calendardata = self.calendar
self.calendar = Component.fromString(self.calendar)
except ValueError, e:
log.err(str(e))
@@ -290,8 +287,7 @@
# Possible timezone stripping
if config.EnableTimezonesByReference:
- if self.calendar.stripKnownTimezones():
- self.calendardata = None
+ self.calendar.stripKnownTimezones()
# Skip validation on internal requests
if not self.internal_request:
@@ -645,7 +641,6 @@
if not self.source and self.destination.exists() and self.destination.accessMode:
old_access = self.destination.accessMode
self.calendar.addProperty(Property(name=Component.ACCESS_PROPERTY, value=old_access))
- self.calendardata = None
return succeed(None)
@@ -673,7 +668,6 @@
"X-CALENDARSERVER-PRIVATE-COMMENT",
"X-CALENDARSERVER-ATTENDEE-COMMENT",
))
- self.calendardata = None
@inlineCallbacks
@@ -724,8 +718,6 @@
anAttendee.setParameter("PARTSTAT", "COMPLETED")
component.addProperty(anAttendee)
- self.calendardata = None
-
elif new_completed ^ old_completed and not self.internal_request:
# COMPLETED changed - sync up attendee state
# We need this because many VTODO clients are not aware of scheduling,
@@ -740,7 +732,6 @@
originatorPrincipal = (yield self.destination.ownerPrincipal(self.request))
originatorAddresses = originatorPrincipal.calendarUserAddresses()
- changed = False
for component in self.calendar.subcomponents():
if component.name() != "VTODO":
continue
@@ -752,10 +743,6 @@
newpartstat = "COMPLETED" if component.hasProperty("COMPLETED") else "IN-PROCESS"
if newpartstat != oldpartstat:
anAttendee.setParameter("PARTSTAT", newpartstat)
- changed = True
-
- if changed:
- self.calendardata = None
@inlineCallbacks
@@ -815,9 +802,6 @@
if uri:
attachment.setValue(uri)
changed = True
-
- if changed:
- self.calendardata = None
returnValue(changed)
@@ -859,8 +843,6 @@
alarm = self.destinationparent.getDefaultAlarm(vevent, timed)
if alarm:
changed = self.calendar.addAlarms(alarm)
- if changed:
- self.calendardata = None
return changed
@inlineCallbacks
@@ -970,7 +952,6 @@
returnValue(new_calendar)
else:
self.calendar = new_calendar
- self.calendardata = None
data_changed = True
did_implicit_action = True
else:
@@ -1002,7 +983,6 @@
(caldav_namespace, "valid-calendar-data"),
"Cannot merge per-user data",
))
- self.calendardata = None
@inlineCallbacks
@@ -1010,7 +990,7 @@
# Stash the current calendar data as we may need to return it
if self.returnData:
- self.storeddata = str(self.calendar) if self.calendardata is None else self.calendardata
+ self.storeddata = str(self.calendar)
# Always do the per-user data merge right before we store
yield self.mergePerUserData()
@@ -1048,9 +1028,7 @@
if data is None:
# We'll be passing this component directly to storeComponent( )
componentToStore = self.calendar
- if self.calendardata is None:
- self.calendardata = str(self.calendar)
- data = self.calendardata
+ data = str(self.calendar)
else:
# We'll be passing data as a stream to storeStream( )
componentToStore = None
Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py 2012-08-30 16:55:12 UTC (rev 9755)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py 2012-08-30 16:57:22 UTC (rev 9756)
@@ -1135,7 +1135,7 @@
return caldavxml.CalendarData
@inlineCallbacks
- def storeResourceData(self, request, newchild, newchildURL, component, text=None, returnData=False):
+ def storeResourceData(self, request, newchild, newchildURL, component, returnData=False):
storer = StoreCalendarObjectResource(
request = request,
destination = newchild,
@@ -1143,7 +1143,6 @@
destinationcal = True,
destinationparent = self,
calendar = component,
- calendardata = text,
returnData = returnData,
)
yield storer.run()
@@ -2069,7 +2068,7 @@
return carddavxml.AddressData
@inlineCallbacks
- def storeResourceData(self, request, newchild, newchildURL, component, text=None, returnData=False):
+ def storeResourceData(self, request, newchild, newchildURL, component, returnData=False):
storer = StoreAddressObjectResource(
request = request,
sourceadbk = False,
@@ -2078,7 +2077,6 @@
destinationadbk = True,
destinationparent = self,
vcard = component,
- vcarddata = text,
returnData = returnData,
)
yield storer.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120830/3a69d5a1/attachment-0001.html>
More information about the calendarserver-changes
mailing list