[CalendarServer-changes] [716] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 5 20:54:04 PST 2006


Revision: 716
          http://trac.macosforge.org/projects/calendarserver/changeset/716
Author:   wsanchez at apple.com
Date:     2006-12-05 20:54:03 -0800 (Tue, 05 Dec 2006)

Log Message:
-----------
range() -> xrange() for added zippiness.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/caldavxml.py
    CalendarServer/trunk/twistedcaldav/dateops.py
    CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
    CalendarServer/trunk/twistedcaldav/instance.py
    CalendarServer/trunk/twistedcaldav/py/plistlib.py
    CalendarServer/trunk/twistedcaldav/repository.py

Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py	2006-12-06 04:10:15 UTC (rev 715)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py	2006-12-06 04:54:03 UTC (rev 716)
@@ -568,8 +568,7 @@
                 continue
             for property in component.properties("FREEBUSY"):
                 newvalue = []
-                for i in range(len(property.value())):
-                    period = property.value()[i]
+                for period in property.value():
                     clipped = clipPeriod(period, (self.freebusy_set.start, self.freebusy_set.end))
                     if clipped:
                         newvalue.append(clipped)

Modified: CalendarServer/trunk/twistedcaldav/dateops.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dateops.py	2006-12-06 04:10:15 UTC (rev 715)
+++ CalendarServer/trunk/twistedcaldav/dateops.py	2006-12-06 04:54:03 UTC (rev 716)
@@ -259,7 +259,7 @@
     index = None
     p = None
     pe = None
-    for i in range(len(list)):
+    for i in xrange(len(list)):
         if p is None:
             index = i
             p = list[i]

Modified: CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py	2006-12-06 04:10:15 UTC (rev 715)
+++ CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py	2006-12-06 04:54:03 UTC (rev 716)
@@ -96,8 +96,8 @@
                 principal = XMLAccountRecord(recordType)
                 principal.parseXML( child )
                 if repeat > 1:
-                    for ctr in range(repeat):
-                        newprincipal = principal.repeat(ctr + 1)
+                    for i in xrange(1, repeat+1):
+                        newprincipal = principal.repeat(i)
                         self.items[newprincipal.uid] = newprincipal
                         if recordType == "group":
                             self._updateMembership(newprincipal)

Modified: CalendarServer/trunk/twistedcaldav/instance.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/instance.py	2006-12-06 04:10:15 UTC (rev 715)
+++ CalendarServer/trunk/twistedcaldav/instance.py	2006-12-06 04:54:03 UTC (rev 716)
@@ -80,9 +80,8 @@
             
             # Handle repeats
             if repeat > 0:
-                for i in range(repeat): #@UnusedVariable
-                    start += duration
-                    triggers.add(start)
+                for i in xrange(1, repeat+1):
+                    triggers.add(start + (duration * i))
         
         return triggers
     

Modified: CalendarServer/trunk/twistedcaldav/py/plistlib.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/py/plistlib.py	2006-12-06 04:10:15 UTC (rev 715)
+++ CalendarServer/trunk/twistedcaldav/py/plistlib.py	2006-12-06 04:54:03 UTC (rev 716)
@@ -351,7 +351,7 @@
     # copied from base64.encodestring(), with added maxlinelength argument
     maxbinsize = (maxlinelength//4)*3
     pieces = []
-    for i in range(0, len(s), maxbinsize):
+    for i in xrange(0, len(s), maxbinsize):
         chunk = s[i : i + maxbinsize]
         pieces.append(binascii.b2a_base64(chunk))
     return "".join(pieces)

Modified: CalendarServer/trunk/twistedcaldav/repository.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/repository.py	2006-12-06 04:10:15 UTC (rev 715)
+++ CalendarServer/trunk/twistedcaldav/repository.py	2006-12-06 04:54:03 UTC (rev 716)
@@ -723,7 +723,7 @@
             if repeat == 1:
                 self.provisionOne(principal, resetACLs)
             else:
-                for ctr in range(1, repeat+1):
+                for ctr in xrange(1, repeat+1):
                     self.provisionOne(principal.repeat(ctr), resetACLs)
     
 class ProvisionPrincipal (object):

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061205/43f25418/attachment.html


More information about the calendarserver-changes mailing list