[CalendarServer-changes] [1099] CalendarServer/trunk/twistedcaldav/test/data

source_changes at macosforge.org source_changes at macosforge.org
Wed Jan 24 17:02:06 PST 2007


Revision: 1099
          http://trac.macosforge.org/projects/calendarserver/changeset/1099
Author:   cdaboo at apple.com
Date:     2007-01-24 17:02:06 -0800 (Wed, 24 Jan 2007)

Log Message:
-----------
Add command line option to set the number of user accounts to be configured.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/test/data/makelargecalendars.py
    CalendarServer/trunk/twistedcaldav/test/data/makelargefbset.py

Modified: CalendarServer/trunk/twistedcaldav/test/data/makelargecalendars.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/data/makelargecalendars.py	2007-01-24 22:48:08 UTC (rev 1098)
+++ CalendarServer/trunk/twistedcaldav/test/data/makelargecalendars.py	2007-01-25 01:02:06 UTC (rev 1099)
@@ -18,22 +18,35 @@
 # DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 
+import getopt
 import os
+import sys
 
-user_max = 99
-calendars = ("calendar.10", "calendar.100", "calendar.1000",)
+if __name__ == "__main__":
 
-for ctr in xrange(1, user_max + 1): 
-    path = "calendars/user/user%02d" % (ctr,)
+    user_max = 99
+    calendars = ("calendar.10", "calendar.100", "calendar.1000",)
 
-    try: os.makedirs(path)
-    except OSError: pass
+    options, args = getopt.getopt(sys.argv[1:], "n:")
 
-    try: os.makedirs(os.path.join(path, "calendar"))
-    except OSError: pass
-
-    for calendar in calendars:
-        if not os.path.isdir(os.path.join(path, calendar)):
-            print "Expanding %s to %s" % (calendar, path)
-            cmd = "tar -C %r -zx -f %r" % (path, calendar + ".tgz")
-            os.system(cmd)
+    for option, value in options:
+        if option == "-n":
+            user_max = int(value)
+        else:
+            print "Unrecognized option: %s" % (option,)
+            raise ValueError
+    
+    for ctr in xrange(1, user_max + 1): 
+        path = "calendars/users/user%02d" % (ctr,)
+    
+        try: os.makedirs(path)
+        except OSError: pass
+    
+        try: os.makedirs(os.path.join(path, "calendar"))
+        except OSError: pass
+    
+        for calendar in calendars:
+            if not os.path.isdir(os.path.join(path, calendar)):
+                print "Expanding %s to %s" % (calendar, path)
+                cmd = "tar -C %r -zx -f %r" % (path, calendar + ".tgz")
+                os.system(cmd)

Modified: CalendarServer/trunk/twistedcaldav/test/data/makelargefbset.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/data/makelargefbset.py	2007-01-24 22:48:08 UTC (rev 1098)
+++ CalendarServer/trunk/twistedcaldav/test/data/makelargefbset.py	2007-01-25 01:02:06 UTC (rev 1099)
@@ -18,26 +18,37 @@
 # DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 
+import getopt
 import os
+import sys
 import xattr
 
-user_max = 99
-calendars = ("calendar.1000",)
+if __name__ == "__main__":
 
-for ctr in xrange(1, user_max + 1): 
-    path = "calendars/user/user%02d" % (ctr,)
+    user_max = 99
 
-    try: os.makedirs(path)
-    except OSError: pass
+    options, args = getopt.getopt(sys.argv[1:], "n:")
 
-    try: os.makedirs(os.path.join(path, "calendar"))
-    except OSError: pass
+    for option, value in options:
+        if option == "-n":
+            user_max = int(value)
+        else:
+            print "Unrecognized option: %s" % (option,)
+            raise ValueError
 
-    for calendar in calendars:
+    for ctr in xrange(1, user_max + 1): 
+        path = "calendars/users/user%02d" % (ctr,)
+    
+        try: os.makedirs(path)
+        except OSError: pass
+    
+        try: os.makedirs(os.path.join(path, "calendar"))
+        except OSError: pass
+    
         inboxname = os.path.join(path, "inbox")
         attrs = xattr.xattr(inboxname)
         attrs["WebDAV:{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set"] = """<?xml version='1.0' encoding='UTF-8'?>
-<calendar-free-busy-set xmlns='urn:ietf:params:xml:ns:caldav'>
-  <href xmlns='DAV:'>/calendars/user/user%02d/calendar/</href>
-  <href xmlns='DAV:'>/calendars/user/user%02d/calendar.1000/</href>
-</calendar-free-busy-set>""" % (ctr, ctr,)
+    <calendar-free-busy-set xmlns='urn:ietf:params:xml:ns:caldav'>
+      <href xmlns='DAV:'>/calendars/users/user%02d/calendar/</href>
+      <href xmlns='DAV:'>/calendars/users/user%02d/calendar.1000/</href>
+    </calendar-free-busy-set>""" % (ctr, ctr,)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070124/88ab2cb6/attachment.html


More information about the calendarserver-changes mailing list