[CalendarServer-changes] [10808] CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 26 07:23:29 PST 2013


Revision: 10808
          http://trac.calendarserver.org//changeset/10808
Author:   cdaboo at apple.com
Date:     2013-02-26 07:23:29 -0800 (Tue, 26 Feb 2013)
Log Message:
-----------
Allow principal to be specified by UID/GUID.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/addressbooks.py
    CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/calendars.py

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/addressbooks.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/addressbooks.py	2013-02-26 03:57:58 UTC (rev 10807)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/addressbooks.py	2013-02-26 15:23:29 UTC (rev 10808)
@@ -37,7 +37,10 @@
             print "Wrong number of arguments: %d" % (len(args),)
             print self.usage(cmdname)
             raise WrongOptions
-        ppath = URL(url=args[0]) if args else None
+        pid = args[0] if args else None
+        if pid and pid.find("/") == -1:
+            pid = "/principals/__uids__/%s/" % pid
+        ppath = URL(url=pid) if pid else None
         principal = self.shell.account.getPrincipal(ppath)
         if principal is None:
             print "No principal found for %s" % (ppath if ppath else "current principal")
@@ -63,7 +66,7 @@
 
     def usage(self, name):
         return """Usage: %s [PRINCIPAL]
-PRINCIPAL is a principal-URL.
+PRINCIPAL is a principal-URL or principal UID..
 """ % (name,)
 
 

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/calendars.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/calendars.py	2013-02-26 03:57:58 UTC (rev 10807)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/calendars.py	2013-02-26 15:23:29 UTC (rev 10808)
@@ -37,7 +37,10 @@
             print "Wrong number of arguments: %d" % (len(args),)
             print self.usage(cmdname)
             raise WrongOptions
-        ppath = URL(url=args[0]) if args else None
+        pid = args[0] if args else None
+        if pid and pid.find("/") == -1:
+            pid = "/principals/__uids__/%s/" % pid
+        ppath = URL(url=pid) if pid else None
         principal = self.shell.account.getPrincipal(ppath)
         if principal is None:
             print "No principal found for %s" % (ppath if ppath else "current principal")
@@ -63,7 +66,7 @@
 
     def usage(self, name):
         return """Usage: %s [PRINCIPAL]
-PRINCIPAL is a principal-URL.
+PRINCIPAL is a principal-URL or principal UID.
 """ % (name,)
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130226/39be68c8/attachment.html>


More information about the calendarserver-changes mailing list