[CalendarServer-changes] [5099] CalendarServer/trunk/calendarserver/tools
source_changes at macosforge.org
source_changes at macosforge.org
Fri Feb 12 10:37:56 PST 2010
Revision: 5099
http://trac.macosforge.org/projects/calendarserver/changeset/5099
Author: sagen at apple.com
Date: 2010-02-12 10:37:52 -0800 (Fri, 12 Feb 2010)
Log Message:
-----------
Shutdown reactor upon exit
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/gateway.py
CalendarServer/trunk/calendarserver/tools/principals.py
Modified: CalendarServer/trunk/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/gateway.py 2010-02-12 17:47:49 UTC (rev 5098)
+++ CalendarServer/trunk/calendarserver/tools/gateway.py 2010-02-12 18:37:52 UTC (rev 5099)
@@ -179,6 +179,7 @@
except Exception, e:
respondWithError("Command failed: '%s'" % (str(e),))
+ raise
finally:
reactor.stop()
@@ -299,12 +300,23 @@
@inlineCallbacks
def command_listWriteProxies(self, command):
principal = principalForPrincipalID(command['Principal'], directory=self.dir)
+ if principal is None:
+ respondWithError("Principal not found: %s" % (command['Principal'],))
+ return
(yield respondWithProxies(self.dir, command, principal, "write"))
@inlineCallbacks
def command_addWriteProxy(self, command):
- principal = principalForPrincipalID(command['Principal'], directory=self.dir)
+ principal = principalForPrincipalID(command['Principal'],
+ directory=self.dir)
+ if principal is None:
+ respondWithError("Principal not found: %s" % (command['Principal'],))
+ return
+
proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
+ if proxy is None:
+ respondWithError("Proxy not found: %s" % (command['Proxy'],))
+ return
try:
(yield addProxy(principal, "write", proxy))
except ProxyError, e:
@@ -317,7 +329,13 @@
@inlineCallbacks
def command_removeWriteProxy(self, command):
principal = principalForPrincipalID(command['Principal'], directory=self.dir)
+ if principal is None:
+ respondWithError("Principal not found: %s" % (command['Principal'],))
+ return
proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
+ if proxy is None:
+ respondWithError("Proxy not found: %s" % (command['Proxy'],))
+ return
try:
(yield removeProxy(principal, proxy, proxyTypes=("write",)))
except ProxyError, e:
@@ -330,12 +348,21 @@
@inlineCallbacks
def command_listReadProxies(self, command):
principal = principalForPrincipalID(command['Principal'], directory=self.dir)
+ if principal is None:
+ respondWithError("Principal not found: %s" % (command['Principal'],))
+ return
(yield respondWithProxies(self.dir, command, principal, "read"))
@inlineCallbacks
def command_addReadProxy(self, command):
principal = principalForPrincipalID(command['Principal'], directory=self.dir)
+ if principal is None:
+ respondWithError("Principal not found: %s" % (command['Principal'],))
+ return
proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
+ if proxy is None:
+ respondWithError("Proxy not found: %s" % (command['Proxy'],))
+ return
try:
(yield addProxy(principal, "read", proxy))
except ProxyError, e:
@@ -348,7 +375,13 @@
@inlineCallbacks
def command_removeReadProxy(self, command):
principal = principalForPrincipalID(command['Principal'], directory=self.dir)
+ if principal is None:
+ respondWithError("Principal not found: %s" % (command['Principal'],))
+ return
proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
+ if proxy is None:
+ respondWithError("Proxy not found: %s" % (command['Proxy'],))
+ return
try:
(yield removeProxy(principal, proxy, proxyTypes=("read",)))
except ProxyError, e:
Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py 2010-02-12 17:47:49 UTC (rev 5098)
+++ CalendarServer/trunk/calendarserver/tools/principals.py 2010-02-12 18:37:52 UTC (rev 5099)
@@ -334,7 +334,7 @@
if checkOnly:
return None
- return directory.principalCollection.principalForUID(str(guid))
+ return directory.principalCollection.principalForUID(principalID)
except ValueError:
pass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100212/1c2c16b4/attachment.html>
More information about the calendarserver-changes
mailing list