[CalendarServer-changes] [5723] CalDAVClientLibrary/trunk/src/browser/shell.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 10 13:55:13 PDT 2010


Revision: 5723
          http://trac.macosforge.org/projects/calendarserver/changeset/5723
Author:   cdaboo at apple.com
Date:     2010-06-10 13:55:11 -0700 (Thu, 10 Jun 2010)
Log Message:
-----------
Allow path to be specified in --server value.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/src/browser/shell.py

Modified: CalDAVClientLibrary/trunk/src/browser/shell.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/shell.py	2010-06-10 20:54:39 UTC (rev 5722)
+++ CalDAVClientLibrary/trunk/src/browser/shell.py	2010-06-10 20:55:11 UTC (rev 5723)
@@ -23,10 +23,11 @@
 import atexit
 import getopt
 import sys
+import urlparse
 
 class Shell(BaseShell):
     
-    def __init__(self, server, user, pswd, logging):
+    def __init__(self, server, path, user, pswd, logging):
         
         super(Shell, self).__init__("caldav_client")
         self.prefix = self.wd = "/"
@@ -39,7 +40,7 @@
         # Create the account
         ssl = server.startswith("https://")
         server = server[8:] if ssl else server[7:]
-        paths = "/principals/users/%s/" % (self.user,)
+        paths = path
         self.account = CalDAVAccount(server, ssl=ssl, user=self.user, pswd=self.pswd, root=paths, principal=paths, logging=logging)
         
         atexit.register(self.saveHistory)
@@ -102,13 +103,18 @@
     if not server or not (server.startswith("http://") or server.startswith("https://")):
         print usage()
         raise SystemExit()
+    splits = urlparse.urlsplit(server)
+    server = splits.scheme + "://" + splits.netloc
+    path = splits.path
+    if not path:
+        path = "/"
     
     if not user:
         user = raw_input("User: ")
     if not pswd:
         pswd = getpass("Password: ")
 
-    shell = Shell(server, user, pswd, logging)
+    shell = Shell(server, path, user, pswd, logging)
     shell.run()
 
 if __name__ == '__main__':
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100610/99ef202e/attachment.html>


More information about the calendarserver-changes mailing list