[CalendarServer-changes] [11250] CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix
source_changes at macosforge.org
source_changes at macosforge.org
Tue May 28 10:06:28 PDT 2013
Revision: 11250
http://trac.calendarserver.org//changeset/11250
Author: cdaboo at apple.com
Date: 2013-05-28 10:06:28 -0700 (Tue, 28 May 2013)
Log Message:
-----------
Allow podding with older versions of the server that support the old iSchedule namespace.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/delivery.py
CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/scheduler.py
CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/stdconfig.py
CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/txdav/base/datastore/subpostgres.py
Modified: CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/delivery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/delivery.py 2013-05-25 00:22:16 UTC (rev 11249)
+++ CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/delivery.py 2013-05-28 17:06:28 UTC (rev 11250)
@@ -35,6 +35,7 @@
from twisted.python.failure import Failure
from twistedcaldav.accounting import accountingEnabledForCategory, emitAccounting
+from twistedcaldav import caldavxml
from twistedcaldav.client.pool import _configuredClientContextFactory
from twistedcaldav.config import config
from twistedcaldav.ical import normalizeCUAddress, Component
@@ -51,6 +52,8 @@
from twistedcaldav.scheduling.itip import iTIPRequestStatus
from twistedcaldav.util import utf8String, normalizationLookup
+from txdav.xml import element as davxml
+
from urlparse import urlsplit
"""
@@ -480,31 +483,40 @@
def _parseResponse(self, xml):
+ _ScheduleResponse = caldavxml.ScheduleResponse if config.Scheduling.iSchedule.OldNamespace else ScheduleResponse
+ _Response = caldavxml.Response if config.Scheduling.iSchedule.OldNamespace else Response
+ _Recipient = caldavxml.Recipient if config.Scheduling.iSchedule.OldNamespace else Recipient
+ _RequestStatus = caldavxml.RequestStatus if config.Scheduling.iSchedule.OldNamespace else RequestStatus
+ _CalendarData = caldavxml.CalendarData if config.Scheduling.iSchedule.OldNamespace else CalendarData
+ _Error = davxml.Error if config.Scheduling.iSchedule.OldNamespace else Error
+ _ResponseDescription = davxml.ResponseDescription if config.Scheduling.iSchedule.OldNamespace else ResponseDescription
+
# Check for correct root element
schedule_response = xml.root_element
- if not isinstance(schedule_response, ScheduleResponse) or not schedule_response.children:
+ if not isinstance(schedule_response, _ScheduleResponse) or not schedule_response.children:
raise HTTPError(responsecode.BAD_REQUEST)
# Parse each response - do this twice: once looking for errors that will
# result in all recipients shown as failures; the second loop adds all the
# valid responses to the actual result.
for response in schedule_response.children:
- if not isinstance(response, Response) or not response.children:
+ if not isinstance(response, _Response) or not response.children:
raise HTTPError(responsecode.BAD_REQUEST)
- recipient = response.childOfType(Recipient)
- request_status = response.childOfType(RequestStatus)
+ recipient = response.childOfType(_Recipient)
+ request_status = response.childOfType(_RequestStatus)
if not recipient or not request_status:
raise HTTPError(responsecode.BAD_REQUEST)
for response in schedule_response.children:
- recipient = str(response.childOfType(Recipient))
- request_status = str(response.childOfType(RequestStatus))
- calendar_data = response.childOfType(CalendarData)
+ recipient = response.childOfType(_Recipient)
+ recipient = str(recipient.childOfType(davxml.HRef)) if config.Scheduling.iSchedule.OldNamespace else str(recipient)
+ request_status = str(response.childOfType(_RequestStatus))
+ calendar_data = response.childOfType(_CalendarData)
if calendar_data:
- calendar_data = str(calendar_data)
- error = response.childOfType(Error)
+ calendar_data = calendar_data.calendarData() if config.Scheduling.iSchedule.OldNamespace else str(calendar_data)
+ error = response.childOfType(_Error)
if error:
error = error.children
- desc = response.childOfType(ResponseDescription)
+ desc = response.childOfType(_ResponseDescription)
if desc:
desc = str(desc)
self.responses.clone(
Modified: CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/scheduler.py 2013-05-25 00:22:16 UTC (rev 11249)
+++ CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/scheduling/ischedule/scheduler.py 2013-05-28 17:06:28 UTC (rev 11250)
@@ -135,6 +135,11 @@
"max-recipients": (ischedule_namespace, "max-recipients"),
}
+ def __init__(self, request, resource):
+ super(IScheduleScheduler, self).__init__(request, resource)
+ self.scheduleResponse = ScheduleResponseQueue if config.Scheduling.iSchedule.OldNamespace else IScheduleResponseQueue
+
+
@inlineCallbacks
def doSchedulingViaPOST(self, transaction, use_request_headers=False):
"""
Modified: CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/stdconfig.py 2013-05-25 00:22:16 UTC (rev 11249)
+++ CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/twistedcaldav/stdconfig.py 2013-05-28 17:06:28 UTC (rev 11250)
@@ -664,6 +664,7 @@
"PrivateExchanges" : "", # Directory where private exchange public keys are stored
"ProtocolDebug" : False, # Turn on protocol level debugging to return detailed information to the requestor
},
+ "OldNamespace" : False, # Use old-style XML namespace
},
"iMIP": {
@@ -1136,6 +1137,7 @@
configDict.ServerHostName = hostname
+
def _updateMultiProcess(configDict, reloading=False):
"""
Dynamically compute ProcessCount if it's set to 0. Always compute
@@ -1168,6 +1170,7 @@
configDict.Postgres.BuffersToConnectionsRatio)
+
def _preUpdateDirectoryService(configDict, items, reloading=False):
# Special handling for directory services configs
dsType = items.get("DirectoryService", {}).get("type", None)
Modified: CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/txdav/base/datastore/subpostgres.py 2013-05-25 00:22:16 UTC (rev 11249)
+++ CalendarServer/branches/users/cdaboo/CalendarServer-5.0-podfix/txdav/base/datastore/subpostgres.py 2013-05-28 17:06:28 UTC (rev 11250)
@@ -205,7 +205,9 @@
# Options from config
self.databaseName = databaseName
- self.logFile = logFile
+ # Make logFile absolute in case the working directory of postgres is
+ # elsewhere:
+ self.logFile = os.path.abspath(logFile)
if listenAddresses:
self.socketDir = None
self.host, self.port = listenAddresses[0].split(":") if ":" in listenAddresses[0] else (listenAddresses[0], None,)
@@ -241,6 +243,7 @@
self._initdb = initDB
self._reactor = reactor
+
@property
def reactor(self):
if self._reactor is None:
@@ -350,7 +353,6 @@
connection.commit()
connection.close()
-
if self.shutdownDeferred is None:
# Only continue startup if we've not begun shutdown
self.subServiceFactory(self.produceConnection).setServiceParent(self)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130528/81816dcf/attachment.html>
More information about the calendarserver-changes
mailing list