[CalendarServer-changes] [12996] CalendarServer/branches/users/sagen/move2who-4
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 25 21:20:22 PDT 2014
Revision: 12996
http://trac.calendarserver.org//changeset/12996
Author: sagen at apple.com
Date: 2014-03-25 21:20:21 -0700 (Tue, 25 Mar 2014)
Log Message:
-----------
Until DPS gets its own store, DPS is now in the master.
Modified Paths:
--------------
CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py
CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py
CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py
CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py
CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py
CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py
CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py
CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py
Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tap/caldav.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -124,6 +124,8 @@
pgServiceFromConfig, getDBPool, MemoryLimitService,
storeFromConfig
)
+from twisted.application.strports import service as strPortsService
+from txdav.dps.server import DirectoryProxyAMPFactory
try:
from calendarserver.version import version
@@ -536,7 +538,7 @@
)
self.monitor.addProcessObject(process, PARENT_ENVIRONMENT)
- if (config.DirectoryProxy.SocketPath != ""):
+ if config.DirectoryProxy.Enabled:
log.info("Adding directory proxy service")
dpsArgv = [
@@ -1871,11 +1873,29 @@
store.callWithNewTransactions(decorateTransaction)
+ # Set up AMP for DPS Server in the master instead of sidecar
+ if not config.DirectoryProxy.Enabled:
+ strPortsService(
+ "unix:{path}:mode=660".format(
+ path=config.DirectoryProxy.SocketPath
+ ),
+ DirectoryProxyAMPFactory(store.directoryService())
+ ).setServiceParent(multi)
+
return multi
+ if config.DirectoryProxy.Enabled:
+ # If the master is to act as a DPS client, and talk to the
+ # DPS sidecar:
+ directory = DirectoryProxyClientService(
+ config.DirectoryRealmName
+ )
+ else:
+ # If the master is to act as the DPS server:
+ directory = None
+
ssvc = self.storageService(
- spawnerSvcCreator, None, uid, gid,
- directory=DirectoryProxyClientService(config.DirectoryRealmName)
+ spawnerSvcCreator, None, uid, gid, directory=directory
)
ssvc.setServiceParent(s)
return s
Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/upgrade.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -1110,8 +1110,6 @@
def stepWithResult(self, result):
if self.doPostImport:
- # directory = self.store.directoryService()
-
# Load proxy assignments from XML if specified
if (
self.config.ProxyLoadFromFile and
Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/util.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -520,10 +520,13 @@
# Single quotes are allowed, so we convert any double-quotes
# to single-quotes.
fullName = record.displayName.replace('"', "'")
-
cuas = record.calendarUserAddresses
+ try:
+ guid = record.guid
+ except AttributeError:
+ guid = None
- returnValue((fullName, record.uid, cuas))
+ returnValue((fullName, guid, cuas))
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/scheduler.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -320,6 +320,10 @@
# Verify that there is a single ATTENDEE property
attendees = self.calendar.getAttendees()
+ # FIXME, how can this be None?
+ if attendees is None:
+ print("Attendees is None", self.calendar)
+
# Must have only one
if len(attendees) != 1:
log.error("Wrong number of ATTENDEEs in calendar data: %s" % (str(self.calendar),))
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/util.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -122,10 +122,14 @@
# in a parameter value except as the start/end delimiters.
# Single quotes are allowed, so we convert any double-quotes
# to single-quotes.
+ try:
+ guid = record.guid
+ except AttributeError:
+ guid = None
returnValue(
(
record.displayName.replace('"', "'"),
- record.uid,
+ guid,
record.calendarUserAddresses,
)
)
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/dps/client.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -55,7 +55,6 @@
## MOVE2WHO TODOs:
-## realm from primary/user directory service
## SACLs
## Wiki
## LDAP
@@ -85,12 +84,6 @@
)
- # MOVE2WHO: we talked about passing these in instead:
- # def __init__(self, fieldNames, recordTypes):
- # self.fieldName = fieldNames
- # self.recordType = recordTypes
-
-
# MOVE2WHO needed?
def getGroups(self, guids=None):
return succeed(set())
@@ -151,11 +144,12 @@
@inlineCallbacks
def _getConnection(self):
- # TODO: make socket patch configurable
# TODO: reconnect if needed
- # path = config.DirectoryProxy.SocketPath
- path = "data/Logs/state/directory-proxy.sock"
+ # FIXME:
+ from twistedcaldav.config import config
+ path = config.DirectoryProxy.SocketPath
+ # path = "data/Logs/state/directory-proxy.sock"
if getattr(self, "_connection", None) is None:
log.debug("Creating connection")
connection = (yield ClientCreator(reactor, amp.AMP).connectUNIX(path))
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -108,7 +108,7 @@
def recordWithUID(self, uid):
# MOVE2WHO, REMOVE THIS:
if not isinstance(uid, unicode):
- log.warn("Need to change uid to unicode")
+ # log.warn("Need to change uid to unicode")
uid = uid.decode("utf-8")
record = yield self._directory.recordWithUID(uid)
@@ -142,7 +142,7 @@
# )
# MOVE2WHO, REMOVE THIS:
if not isinstance(shortName, unicode):
- log.warn("Need to change shortName to unicode")
+ # log.warn("Need to change shortName to unicode")
shortName = shortName.decode("utf-8")
record = yield self._directory.recordWithShortName(
@@ -163,7 +163,7 @@
def recordsWithEmailAddress(self, emailAddress):
# MOVE2WHO, REMOVE THIS:
if not isinstance(emailAddress, unicode):
- log.warn("Need to change emailAddress to unicode")
+ # log.warn("Need to change emailAddress to unicode")
emailAddress = emailAddress.decode("utf-8")
records = yield self._directory.recordsWithEmailAddress(emailAddress)
Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py 2014-03-25 23:19:18 UTC (rev 12995)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py 2014-03-26 04:20:21 UTC (rev 12996)
@@ -79,7 +79,8 @@
uid = parts[3]
record = yield self.recordWithUID(uid)
else:
- recordType = self.fieldName.lookupByName(parts[2])
+ # recordType = self.fieldName.lookupByName(parts[2])
+ recordType = self.oldNameToRecordType(parts[2])
record = yield self.recordWithShortName(recordType, parts[3])
returnValue(record if record and record.hasCalendars else None)
@@ -406,11 +407,19 @@
@inlineCallbacks
def autoAcceptFromOrganizer(self, organizer):
- if organizer is not None and self.autoAcceptGroup is not None:
+ try:
+ autoAcceptGroup = self.autoAcceptGroup
+ except AttributeError:
+ autoAcceptGroup = None
+
+ if (
+ organizer is not None and
+ autoAcceptGroup is not None
+ ):
service = self.service
organizerRecord = yield service.recordWithCalendarUserAddress(organizer)
if organizerRecord is not None:
- autoAcceptGroup = yield service.recordWithUID(self.autoAcceptGroup)
+ autoAcceptGroup = yield service.recordWithUID(autoAcceptGroup)
if organizerRecord.uid in (yield autoAcceptGroup.members()):
returnValue(True)
returnValue(False)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140325/196861db/attachment-0001.html>
More information about the calendarserver-changes
mailing list