[CalendarServer-changes] [11625] CalendarServer/branches/users/cdaboo/json

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 21 08:40:06 PDT 2013


Revision: 11625
          http://trac.calendarserver.org//changeset/11625
Author:   cdaboo at apple.com
Date:     2013-08-21 08:40:05 -0700 (Wed, 21 Aug 2013)
Log Message:
-----------
Update to match PyCalendar re-org.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/anonymize.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/calverify.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/dbinspect.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/gateway.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/managetimezones.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/purge.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_calverify.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge.py
    CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge_old_events.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/ical.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/profiles.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/test_ical.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/invite.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/put.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/query.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/sync.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/sqlusage.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/stats.py
    CalendarServer/branches/users/cdaboo/json/contrib/performance/test_stats.py
    CalendarServer/branches/users/cdaboo/json/contrib/tools/fix_calendar
    CalendarServer/branches/users/cdaboo/json/contrib/tools/sortrecurrences.py
    CalendarServer/branches/users/cdaboo/json/support/build.sh
    CalendarServer/branches/users/cdaboo/json/support/version.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/__init__.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/accounting.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/authkerb.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/backup.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/caldavxml.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/carddavxml.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/customxml.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/database.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/datafilters/calendardata.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/dateops.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/addressbook.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/opendirectorybacker.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_aggregate.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_augment.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_cachedirectory.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_digest.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_directory.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_guidchange.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_ldapdirectory.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_livedirectory.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_modify.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_opendirectorybacker.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_proxyprincipaldb.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_resources.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_xmlfile.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/util.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/dropbox.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/extensions.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/freebusyurl.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/ical.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/icaldav.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/instance.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/linkresource.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/localization.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachelock.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachepool.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/method/report_common.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/mkcolxml.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/notifications.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/calendarqueryfilter.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_calendarquery.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_queryfilter.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/resource.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/sharing.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/sql.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/storebridge.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_calendarquery.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_dateops.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_icalendar.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_localization.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_timezones.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_upgrade.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezones.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezoneservice.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezonestdservice.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/upgrade.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/vcard.py
    CalendarServer/branches/users/cdaboo/json/twistedcaldav/xmlutil.py
    CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/subpostgres.py
    CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/test/test_subpostgres.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/index_file.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/caldav/test/test_scheduler.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/freebusy.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icaldiff.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icalsplitter.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/outbound.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/ischedule/resource.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/itip.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/processing.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_freebusy.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_implicit.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_itip.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_utils.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/sql.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/common.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_attachments.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_file.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_index_file.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_sql.py
    CalendarServer/branches/users/cdaboo/json/txdav/caldav/icalendarstore.py
    CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql.py
    CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql_legacy.py
    CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/test/util.py

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/anonymize.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/anonymize.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/anonymize.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -33,8 +33,8 @@
 
 from twext.python.plistlib import readPlistFromString
 
-from pycalendar.calendar import PyCalendar
-from pycalendar.attribute import PyCalendarAttribute
+from pycalendar.icalendar.calendar import Calendar
+from pycalendar.parameter import Parameter
 
 COPY_CAL_XATTRS = (
     'WebDAV:{DAV:}resourcetype',
@@ -67,6 +67,8 @@
     else:
         sys.exit(0)
 
+
+
 def main():
 
     try:
@@ -83,8 +85,6 @@
     # Get configuration
     #
     directoryNode = "/Search"
-    sourceDirectory = None
-    destDirectory = None
 
     for opt, arg in optargs:
         if opt in ("-h", "--help"):
@@ -107,6 +107,7 @@
     directoryMap.dumpDsImports(os.path.join(destDirectory, "dsimports"))
 
 
+
 def anonymizeRoot(directoryMap, sourceDirectory, destDirectory):
     # sourceDirectory and destDirectory are DocumentRoots
 
@@ -244,12 +245,10 @@
 
                     resources += 1
 
-
                 # Store new ctag on calendar
                 xml = "<?xml version='1.0' encoding='UTF-8'?>\r\n<getctag xmlns='http://calendarserver.org/ns/'>%s</getctag>\r\n" % (str(datetime.datetime.now()),)
                 xattr.setxattr(destCal, "WebDAV:{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag", zlib.compress(xml))
 
-
             # Calendar home quota
             xml = "<?xml version='1.0' encoding='UTF-8'?>\r\n<quota-used xmlns='http://twistedmatrix.com/xml_namespace/dav/private/'>%d</quota-used>\r\n" % (quotaUsed,)
             xattr.setxattr(destHome, "WebDAV:{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2Fprivate%2F}quota-used", zlib.compress(xml))
@@ -280,9 +279,10 @@
     print("")
 
 
+
 def anonymizeData(directoryMap, data):
     try:
-        pyobj = PyCalendar.parseText(data)
+        pyobj = Calendar.parseText(data)
     except Exception, e:
         print("Failed to parse (%s): %s" % (e, data))
         return None
@@ -309,13 +309,13 @@
                             comp.removeProperty(prop)
                             continue
                     prop.setValue("urn:uuid:%s" % (record['guid'],))
-                    if prop.hasAttribute('X-CALENDARSERVER-EMAIL'):
-                        prop.replaceAttribute(PyCalendarAttribute('X-CALENDARSERVER-EMAIL', record['email']))
+                    if prop.hasParameter('X-CALENDARSERVER-EMAIL'):
+                        prop.replaceParameter(Parameter('X-CALENDARSERVER-EMAIL', record['email']))
                     else:
-                        prop.removeAttributes('EMAIL')
-                        prop.addAttribute(PyCalendarAttribute('EMAIL', record['email']))
-                    prop.removeAttributes('CN')
-                    prop.addAttribute(PyCalendarAttribute('CN', record['name']))
+                        prop.removeParameters('EMAIL')
+                        prop.addParameter(Parameter('EMAIL', record['email']))
+                    prop.removeParameters('CN')
+                    prop.addParameter(Parameter('CN', record['name']))
             except KeyError:
                 pass
 
@@ -345,11 +345,12 @@
     return pyobj.getText(includeTimezones=True)
 
 
+
 class DirectoryMap(object):
 
     def __init__(self, node):
 
-        self.map = { }
+        self.map = {}
         self.byType = {
             'users' : [],
             'groups' : [],
@@ -373,10 +374,10 @@
 
         print("Fetching records from directory: %s" % (node,))
 
-        for internalType, (recordType, friendlyType) in self.strings.iteritems():
+        for internalType, (recordType, _ignore_friendlyType) in self.strings.iteritems():
             print(" %s..." % (internalType,))
             child = Popen(
-                args = [
+                args=[
                     "/usr/bin/dscl", "-plist", node, "-readall",
                     "/%s" % (recordType,),
                     "GeneratedUID", "RecordName", "EMailAddress", "GroupMembers"
@@ -405,6 +406,7 @@
         print("Done.")
         print("")
 
+
     def addRecord(self, internalType="users", guid=None, names=None,
         emails=None, members=None, cua=None):
 
@@ -458,6 +460,7 @@
                 keys.append(email)
         return keys
 
+
     def cua2key(self, cua):
         key = cua.lower()
 
@@ -473,10 +476,11 @@
 
         return key
 
+
     def lookupCUA(self, cua):
         key = self.cua2key(cua)
 
-        if key and self.map.has_key(key):
+        if key and key in self.map:
             return self.map[key]
         else:
             return None
@@ -491,6 +495,7 @@
         if unknown:
             print(" Principals not found in directory: %d" % (unknown,))
 
+
     def dumpDsImports(self, dirPath):
         if not os.path.exists(dirPath):
             os.makedirs(dirPath)
@@ -567,6 +572,8 @@
     Error trying to access dscl
     """
 
+
+
 class DatabaseError(Exception):
     """
     Error trying to access sqlite3
@@ -574,8 +581,6 @@
 
 
 
-
-
 def anonymize(text):
     """
     Return a string whose value is the hex digest of text, repeated as needed
@@ -592,19 +597,18 @@
     h = hashlib.md5(text)
     h = h.hexdigest()
     l = len(text)
-    return (h*((l/32)+1))[:-(32-(l%32))]
+    return (h * ((l / 32) + 1))[:-(32 - (l % 32))]
 
 
 
 nameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 def randomName(length):
     l = []
-    for i in xrange(length):
+    for _ignore in xrange(length):
         l.append(random.choice(nameChars))
     return "".join(l)
 
 
 
-
 if __name__ == "__main__":
     main()

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/calverify.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/calverify.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -47,12 +47,12 @@
 import traceback
 import uuid
 
-from pycalendar import definitions
-from pycalendar.calendar import PyCalendar
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.exceptions import PyCalendarError
-from pycalendar.period import PyCalendarPeriod
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.icalendar import definitions
+from pycalendar.icalendar.calendar import Calendar
+from pycalendar.datetime import DateTime
+from pycalendar.exceptions import ErrorBase
+from pycalendar.period import Period
+from pycalendar.timezone import Timezone
 
 from twisted.application.service import Service
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -543,7 +543,7 @@
         tr = schema.TIME_RANGE
         kwds = {
             "Start" : pyCalendarTodatetime(start),
-            "Max"   : pyCalendarTodatetime(PyCalendarDateTime(1900, 1, 1, 0, 0, 0))
+            "Max"   : pyCalendarTodatetime(DateTime(1900, 1, 1, 0, 0, 0))
         }
         rows = (yield Select(
             [ch.OWNER_UID, co.RESOURCE_ID, co.ICALENDAR_UID, cb.CALENDAR_RESOURCE_NAME, co.MD5, co.ORGANIZER, co.CREATED, co.MODIFIED],
@@ -596,7 +596,7 @@
         tr = schema.TIME_RANGE
         kwds = {
             "Start" : pyCalendarTodatetime(start),
-            "Max"   : pyCalendarTodatetime(PyCalendarDateTime(1900, 1, 1, 0, 0, 0)),
+            "Max"   : pyCalendarTodatetime(DateTime(1900, 1, 1, 0, 0, 0)),
             "UUID" : uuid,
         }
         rows = (yield Select(
@@ -626,7 +626,7 @@
 
         kwds = {
             "Start" : pyCalendarTodatetime(start),
-            "Max"   : pyCalendarTodatetime(PyCalendarDateTime(1900, 1, 1, 0, 0, 0)),
+            "Max"   : pyCalendarTodatetime(DateTime(1900, 1, 1, 0, 0, 0)),
             "UUID" : uuid,
         }
         rows = (yield Select(
@@ -704,8 +704,8 @@
             ),
         ).on(self.txn, **kwds))
         try:
-            caldata = PyCalendar.parseText(rows[0][0]) if rows else None
-        except PyCalendarError:
+            caldata = Calendar.parseText(rows[0][0]) if rows else None
+        except ErrorBase:
             caltxt = rows[0][0] if rows else None
             if caltxt:
                 caltxt = caltxt.replace("\r\n ", "")
@@ -713,8 +713,8 @@
                     if doFix:
                         caltxt = (yield self.fixBadOldCua(resid, caltxt))
                         try:
-                            caldata = PyCalendar.parseText(caltxt) if rows else None
-                        except PyCalendarError:
+                            caldata = Calendar.parseText(caltxt) if rows else None
+                        except ErrorBase:
                             self.parseError = "No fix bad CALENDARSERVER-OLD-CUA"
                             returnValue(None)
                     else:
@@ -746,8 +746,8 @@
         ).on(self.txn, **kwds))
 
         try:
-            caldata = PyCalendar.parseText(rows[0][0]) if rows else None
-        except PyCalendarError:
+            caldata = Calendar.parseText(rows[0][0]) if rows else None
+        except ErrorBase:
             returnValue((None, None, None, None,))
 
         returnValue((caldata, rows[0][1], rows[0][2], rows[0][3],) if rows else (None, None, None, None,))
@@ -1056,14 +1056,14 @@
 
         self.output.write("\n---- Scanning calendar data ----\n")
 
-        self.now = PyCalendarDateTime.getNowUTC()
-        self.start = PyCalendarDateTime.getToday()
+        self.now = DateTime.getNowUTC()
+        self.start = DateTime.getToday()
         self.start.setDateOnly(False)
         self.end = self.start.duplicate()
         self.end.offsetYear(1)
         self.fix = self.options["fix"]
 
-        self.tzid = PyCalendarTimezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
+        self.tzid = Timezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
 
         self.txn = self.store.newTransaction()
 
@@ -1426,14 +1426,14 @@
 
         self.output.write("\n---- Scanning calendar data ----\n")
 
-        self.now = PyCalendarDateTime.getNowUTC()
-        self.start = self.options["start"] if "start" in self.options else PyCalendarDateTime.getToday()
+        self.now = DateTime.getNowUTC()
+        self.start = self.options["start"] if "start" in self.options else DateTime.getToday()
         self.start.setDateOnly(False)
         self.end = self.start.duplicate()
         self.end.offsetYear(1)
         self.fix = self.options["fix"]
 
-        self.tzid = PyCalendarTimezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
+        self.tzid = Timezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
 
         self.txn = self.store.newTransaction()
 
@@ -2028,7 +2028,7 @@
         """
         Return the master iCal component in this calendar.
 
-        @return: the L{PyCalendarComponent} for the master component,
+        @return: the L{Component} for the master component,
             or C{None} if there isn't one.
         """
         for component in calendar.getComponents(definitions.cICalComponent_VEVENT):
@@ -2042,7 +2042,7 @@
         # Expand events into instances in the start/end range
         results = []
         calendar.getVEvents(
-            PyCalendarPeriod(
+            Period(
                 start=start,
                 end=end,
             ),
@@ -2082,10 +2082,10 @@
                 if cancelled:
                     partstat = "CANCELLED"
                 else:
-                    if not prop.hasAttribute(definitions.cICalAttribute_PARTSTAT):
-                        partstat = definitions.cICalAttribute_PARTSTAT_NEEDSACTION
+                    if not prop.hasParameter(definitions.cICalParameter_PARTSTAT):
+                        partstat = definitions.cICalParameter_PARTSTAT_NEEDSACTION
                     else:
-                        partstat = prop.getAttributeValue(definitions.cICalAttribute_PARTSTAT)
+                        partstat = prop.getParameterValue(definitions.cICalParameter_PARTSTAT)
 
                 attendees.setdefault(caladdr, set()).add((instance_id, partstat))
 
@@ -2140,9 +2140,9 @@
 
         self.output.write("\n---- Scanning calendar data ----\n")
 
-        self.tzid = PyCalendarTimezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
-        self.now = PyCalendarDateTime.getNowUTC()
-        self.start = PyCalendarDateTime.getToday()
+        self.tzid = Timezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
+        self.now = DateTime.getNowUTC()
+        self.start = DateTime.getToday()
         self.start.setDateOnly(False)
         self.start.setTimezone(self.tzid)
         self.end = self.start.duplicate()
@@ -2328,7 +2328,7 @@
                     continue
                 dtstart = instance.component.propertyValue("DTSTART")
                 if tzid is None and dtstart.getTimezoneID():
-                    tzid = PyCalendarTimezone(tzid=dtstart.getTimezoneID())
+                    tzid = Timezone(tzid=dtstart.getTimezoneID())
                 hasFloating |= dtstart.isDateOnly() or dtstart.floating()
 
                 details.append(InstanceDetails(resid, uid, instance.start, instance.end, instance.component.getOrganizer(), instance.component.propertyValue("SUMMARY")))
@@ -2369,7 +2369,7 @@
 
         # Adjust floating and sort
         if hasFloating and tzid is not None:
-            utc = PyCalendarTimezone(utc=True)
+            utc = Timezone(utc=True)
             for item in details:
                 if item.start.floating():
                     item.start.setTimezone(tzid)
@@ -2449,9 +2449,9 @@
 
         self.output.write("\n---- Scanning calendar data ----\n")
 
-        self.tzid = PyCalendarTimezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
-        self.now = PyCalendarDateTime.getNowUTC()
-        self.start = self.options["start"] if "start" in self.options else PyCalendarDateTime.getToday()
+        self.tzid = Timezone(tzid=self.options["tzid"] if self.options["tzid"] else "America/Los_Angeles")
+        self.now = DateTime.getNowUTC()
+        self.start = self.options["start"] if "start" in self.options else DateTime.getToday()
         self.start.setDateOnly(False)
         self.start.setTimezone(self.tzid)
         self.fix = self.options["fix"]

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/dbinspect.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/dbinspect.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/dbinspect.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -26,7 +26,7 @@
     recordType_locations, recordType_resources, recordType_groups
 from calendarserver.tools import tables
 from calendarserver.tools.cmdline import utilityMain
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from twext.enterprise.dal.syntax import Select, Parameter, Count, Delete, \
     Constant
 from twisted.application.service import Service
@@ -716,12 +716,12 @@
             end += "T000000Z"
 
         try:
-            start = PyCalendarDateTime.parseText(start)
+            start = DateTime.parseText(start)
         except ValueError:
             print("Invalid start value")
             returnValue(None)
         try:
-            end = PyCalendarDateTime.parseText(end)
+            end = DateTime.parseText(end)
         except ValueError:
             print("Invalid end value")
             returnValue(None)

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/gateway.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/gateway.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -36,9 +36,9 @@
 from calendarserver.tools.purge import WorkerService, PurgeOldEventsService, DEFAULT_BATCH_SIZE, DEFAULT_RETAIN_DAYS
 from calendarserver.tools.cmdline import utilityMain
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
-from twistedcaldav.config import config, ConfigDict 
+from twistedcaldav.config import config, ConfigDict
 
 from calendarserver.tools.config import WRITABLE_CONFIG_KEYS, setKeyPath, getKeyPath, flattenDictionary, WritableConfig
 
@@ -357,7 +357,7 @@
             return
         self.respondWithRecordsOfTypes(self.dir, command, ["resources"])
 
-        
+
     def command_getLocationAndResourceList(self, command):
         self.respondWithRecordsOfTypes(self.dir, command, ["locations", "resources"])
 
@@ -408,10 +408,8 @@
             self.command_readConfig(command)
 
 
-
     # Proxies
 
-
     @inlineCallbacks
     def command_listWriteProxies(self, command):
         principal = principalForPrincipalID(command['Principal'], directory=self.dir)
@@ -522,14 +520,13 @@
         @type command: C{dict}
         """
         retainDays = command.get("RetainDays", DEFAULT_RETAIN_DAYS)
-        cutoff = PyCalendarDateTime.getToday()
+        cutoff = DateTime.getToday()
         cutoff.setDateOnly(False)
         cutoff.offsetDay(-retainDays)
         eventCount = (yield PurgeOldEventsService.purgeOldEvents(self.store, cutoff, DEFAULT_BATCH_SIZE))
         self.respond(command, {'EventsRemoved' : eventCount, "RetainDays" : retainDays})
 
 
-
     @inlineCallbacks
     def respondWithProxies(self, directory, command, principal, proxyType):
         proxies = []
@@ -546,7 +543,6 @@
         })
 
 
-
     def respondWithRecordsOfTypes(self, directory, command, recordTypes):
         result = []
         for recordType in recordTypes:
@@ -556,7 +552,6 @@
         self.respond(command, result)
 
 
-
     def respond(self, command, result):
         self.output.write(writePlistToString({'command' : command['command'], 'result' : result}))
 
@@ -565,6 +560,7 @@
         self.output.write(writePlistToString({'error' : msg, }))
 
 
+
 def recordToDict(record):
     recordDict = {}
     for key, info in attrMap.iteritems():
@@ -580,6 +576,8 @@
             pass
     return recordDict
 
+
+
 def respondWithError(msg, status=1):
     sys.stdout.write(writePlistToString({'error' : msg, }))
 

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/managetimezones.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/managetimezones.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/managetimezones.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,8 +16,8 @@
 ##
 from __future__ import print_function
 
-from pycalendar.calendar import PyCalendar
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.icalendar.calendar import Calendar
+from pycalendar.datetime import DateTime
 
 
 from twext.python.log import StandardIOObserver
@@ -95,11 +95,11 @@
         pass
 
     if not tzvers:
-        tzvers = PyCalendarDateTime.getToday().getText()
+        tzvers = DateTime.getToday().getText()
     print("Converting data (version: %s) at: %s" % (tzvers, zonedir,))
     startYear = 1800
-    endYear = PyCalendarDateTime.getToday().getYear() + 10
-    PyCalendar.sProdID = "-//calendarserver.org//Zonal//EN"
+    endYear = DateTime.getToday().getYear() + 10
+    Calendar.sProdID = "-//calendarserver.org//Zonal//EN"
     zonefiles = "northamerica", "southamerica", "europe", "africa", "asia", "australasia", "antarctica", "etcetera", "backward"
     parser = tzconvert()
     for file in zonefiles:

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/purge.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/purge.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/purge.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -23,7 +23,7 @@
 
 from getopt import getopt, GetoptError
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twext.python.log import Logger
 
@@ -147,7 +147,7 @@
         if dryrun:
             verbose = True
 
-        cutoff = PyCalendarDateTime.getToday()
+        cutoff = DateTime.getToday()
         cutoff.setDateOnly(False)
         cutoff.offsetDay(-days)
         cls.cutoff = cutoff
@@ -328,7 +328,7 @@
 
         cls.uuid = uuid
         if days > 0:
-            cutoff = PyCalendarDateTime.getToday()
+            cutoff = DateTime.getToday()
             cutoff.setDateOnly(False)
             cutoff.offsetDay(-days)
             cls.cutoff = cutoff
@@ -352,7 +352,7 @@
         service = cls(store)
         service.uuid = uuid
         if days > 0:
-            cutoff = PyCalendarDateTime.getToday()
+            cutoff = DateTime.getToday()
             cutoff.setDateOnly(False)
             cutoff.offsetDay(-days)
             service.cutoff = cutoff
@@ -732,7 +732,7 @@
     def _purgeUID(self, uid):
 
         if self.when is None:
-            self.when = PyCalendarDateTime.getNowUTC()
+            self.when = DateTime.getNowUTC()
 
         # Does the record exist?
         record = self.directory.recordWithUID(uid)
@@ -1020,7 +1020,7 @@
         @type event: L{twistedcaldav.ical.Component}
 
         @param when: the cutoff date (anything after which is removed)
-        @type when: PyCalendarDateTime
+        @type when: DateTime
 
         @param cua: Calendar User Address of principal being purged, to compare
             to see if it's the organizer of the event or just an attendee

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_calverify.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_calverify.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_calverify.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -22,7 +22,7 @@
 from calendarserver.tools.calverify import BadDataService, \
     SchedulingMismatchService, DoubleBookingService, DarkPurgeService
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
@@ -969,7 +969,7 @@
         self.notifierFactory.reset()
 
 
-now = PyCalendarDateTime.getToday()
+now = DateTime.getToday()
 now.setDay(1)
 now.offsetMonth(2)
 nowYear = now.getYear()
@@ -1431,7 +1431,7 @@
             "uid": "",
             "uuid": "",
             "tzid": "",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = SchedulingMismatchService(self._sqlCalendarStore, options, output, reactor, config)
@@ -1498,7 +1498,7 @@
             "uid": "",
             "uuid": "",
             "tzid": "",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = SchedulingMismatchService(self._sqlCalendarStore, options, output, reactor, config)
@@ -1707,7 +1707,7 @@
             "uid": "",
             "uuid": "",
             "tzid": "",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = SchedulingMismatchService(self._sqlCalendarStore, options, output, reactor, config)
@@ -1758,7 +1758,7 @@
             "uid": "",
             "uuid": "",
             "tzid": "",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = SchedulingMismatchService(self._sqlCalendarStore, options, output, reactor, config)
@@ -1934,7 +1934,7 @@
             "uid": "",
             "uuid": CalVerifyMismatchTestsBase.uuidl1,
             "tzid": "",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = SchedulingMismatchService(self._sqlCalendarStore, options, output, reactor, config)
@@ -1983,7 +1983,7 @@
             "uid": "",
             "uuid": CalVerifyMismatchTestsBase.uuidl1,
             "tzid": "",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = SchedulingMismatchService(self._sqlCalendarStore, options, output, reactor, config)
@@ -2446,7 +2446,7 @@
             "uid": "",
             "uuid": self.uuidl1,
             "tzid": "utc",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
         }
         output = StringIO()
         calverify = DoubleBookingService(self._sqlCalendarStore, options, output, reactor, config)
@@ -2609,7 +2609,7 @@
             "uid": "",
             "uuid": self.uuidl1,
             "tzid": "utc",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
             "no-organizer": False,
             "invalid-organizer": False,
             "disabled-organizer": False,
@@ -2656,7 +2656,7 @@
             "uid": "",
             "uuid": self.uuidl1,
             "tzid": "utc",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
             "no-organizer": False,
             "invalid-organizer": False,
             "disabled-organizer": False,
@@ -2715,7 +2715,7 @@
             "uid": "",
             "uuid": self.uuidl1,
             "tzid": "utc",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
             "no-organizer": True,
             "invalid-organizer": False,
             "disabled-organizer": False,
@@ -2774,7 +2774,7 @@
             "uid": "",
             "uuid": self.uuidl1,
             "tzid": "utc",
-            "start": PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0),
+            "start": DateTime(nowYear, 1, 1, 0, 0, 0),
             "no-organizer": True,
             "invalid-organizer": True,
             "disabled-organizer": True,

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -21,8 +21,8 @@
 from twistedcaldav.ical import Component
 from twistedcaldav.test.util import StoreTestCase
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twisted.internet.defer import inlineCallbacks
 from txdav.common.datastore.test.util import populateCalendarsFrom
@@ -33,11 +33,11 @@
 import os
 
 
-future = PyCalendarDateTime.getNowUTC()
+future = DateTime.getNowUTC()
 future.offsetDay(1)
 future = future.getText()
 
-past = PyCalendarDateTime.getNowUTC()
+past = DateTime.getNowUTC()
 past.offsetDay(-1)
 past = past.getText()
 
@@ -230,7 +230,7 @@
     def test_cancelRepeating(self):
         # A repeating event where purged CUA is organizer
         event = Component.fromString(REPEATING_1_ICS_BEFORE)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:0F168477-CF3D-45D3-AE60-9875EA02C4D1")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_MODIFIED)
         self.assertEquals(str(event), REPEATING_1_ICS_AFTER)
@@ -239,7 +239,7 @@
     def test_cancelAllDayRepeating(self):
         # A repeating All Day event where purged CUA is organizer
         event = Component.fromString(REPEATING_2_ICS_BEFORE)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:0F168477-CF3D-45D3-AE60-9875EA02C4D1")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_MODIFIED)
         self.assertEquals(str(event), REPEATING_2_ICS_AFTER)
@@ -248,7 +248,7 @@
     def test_cancelFutureEvent(self):
         # A future event
         event = Component.fromString(FUTURE_EVENT_ICS)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:0F168477-CF3D-45D3-AE60-9875EA02C4D1")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_SHOULD_DELETE)
 
@@ -256,7 +256,7 @@
     def test_cancelNonMeeting(self):
         # A repeating non-meeting event
         event = Component.fromString(REPEATING_NON_MEETING_ICS)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:0F168477-CF3D-45D3-AE60-9875EA02C4D1")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_SHOULD_DELETE)
 
@@ -264,7 +264,7 @@
     def test_cancelAsAttendee(self):
         # A repeating meeting event where purged CUA is an attendee
         event = Component.fromString(REPEATING_ATTENDEE_MEETING_ICS)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:0F168477-CF3D-45D3-AE60-9875EA02C4D1")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_SHOULD_DELETE)
 
@@ -273,7 +273,7 @@
         # A repeating meeting occurrence with no master, where purged CUA is
         # an attendee
         event = Component.fromString(INVITED_TO_OCCURRENCE_ICS)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:9DC04A71-E6DD-11DF-9492-0800200C9A66")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_SHOULD_DELETE)
 
@@ -282,7 +282,7 @@
         # Multiple meeting occurrences with no master, where purged CUA is
         # an attendee
         event = Component.fromString(INVITED_TO_MULTIPLE_OCCURRENCES_ICS)
-        action = PurgePrincipalService._cancelEvent(event, PyCalendarDateTime(2010, 12, 6, 12, 0, 0, PyCalendarTimezone(utc=True)),
+        action = PurgePrincipalService._cancelEvent(event, DateTime(2010, 12, 6, 12, 0, 0, Timezone(utc=True)),
             "urn:uuid:9DC04A71-E6DD-11DF-9492-0800200C9A66")
         self.assertEquals(action, PurgePrincipalService.CANCELEVENT_SHOULD_DELETE)
 

Modified: CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge_old_events.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge_old_events.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/calendarserver/tools/test/test_purge_old_events.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -21,8 +21,8 @@
 from calendarserver.tools.purge import PurgeOldEventsService, PurgeAttachmentsService, \
     PurgePrincipalService
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twext.enterprise.dal.syntax import Update, Delete
 from twext.web2.http_headers import MimeType
@@ -39,7 +39,7 @@
 import os
 
 
-now = PyCalendarDateTime.getToday().getYear()
+now = DateTime.getToday().getYear()
 
 OLD_ICS = """BEGIN:VCALENDAR
 VERSION:2.0
@@ -443,7 +443,7 @@
 
     @inlineCallbacks
     def test_eventsOlderThan(self):
-        cutoff = PyCalendarDateTime(now, 4, 1, 0, 0, 0)
+        cutoff = DateTime(now, 4, 1, 0, 0, 0)
         txn = self._sqlCalendarStore.newTransaction()
 
         # Query for all old events
@@ -475,7 +475,7 @@
 
     @inlineCallbacks
     def test_removeOldEvents(self):
-        cutoff = PyCalendarDateTime(now, 4, 1, 0, 0, 0)
+        cutoff = DateTime(now, 4, 1, 0, 0, 0)
         txn = self._sqlCalendarStore.newTransaction()
 
         # Remove oldest event - except we don't know what that is because of the dummy timestamps
@@ -598,7 +598,7 @@
         self.assertTrue(os.path.exists(mattachmentPath2))
 
         # Delete all old events (including the event containing the attachment)
-        cutoff = PyCalendarDateTime(now, 4, 1, 0, 0, 0)
+        cutoff = DateTime(now, 4, 1, 0, 0, 0)
         count = (yield self.transactionUnderTest().removeOldEvents(cutoff))
 
         # See which events have gone and which exist
@@ -633,7 +633,7 @@
         # Dry run
         total = (yield PurgeOldEventsService.purgeOldEvents(
             self._sqlCalendarStore,
-            PyCalendarDateTime(now, 4, 1, 0, 0, 0),
+            DateTime(now, 4, 1, 0, 0, 0),
             2,
             dryrun=True,
             verbose=False
@@ -643,7 +643,7 @@
         # Actually remove
         total = (yield PurgeOldEventsService.purgeOldEvents(
             self._sqlCalendarStore,
-            PyCalendarDateTime(now, 4, 1, 0, 0, 0),
+            DateTime(now, 4, 1, 0, 0, 0),
             2,
             verbose=False
         ))
@@ -652,7 +652,7 @@
         # There should be no more left
         total = (yield PurgeOldEventsService.purgeOldEvents(
             self._sqlCalendarStore,
-            PyCalendarDateTime(now, 4, 1, 0, 0, 0),
+            DateTime(now, 4, 1, 0, 0, 0),
             2,
             verbose=False
         ))
@@ -681,7 +681,7 @@
         # Purge home1
         total, ignored = (yield PurgePrincipalService.purgeUIDs(self._sqlCalendarStore, self.directory,
             self.rootResource, ("home1",), verbose=False, proxies=False,
-            when=PyCalendarDateTime(now, 4, 1, 12, 0, 0, 0, PyCalendarTimezone(utc=True))))
+            when=DateTime(now, 4, 1, 12, 0, 0, 0, Timezone(utc=True))))
 
         # 4 items deleted: 3 events and 1 vcard
         self.assertEquals(total, 4)
@@ -768,7 +768,7 @@
         # Remove old events first
         total = (yield PurgeOldEventsService.purgeOldEvents(
             self._sqlCalendarStore,
-            PyCalendarDateTime(now, 4, 1, 0, 0, 0),
+            DateTime(now, 4, 1, 0, 0, 0),
             2,
             verbose=False
         ))

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/ical.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/ical.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -29,9 +29,9 @@
 from contrib.performance.httpclient import StringProducer, readBody
 from contrib.performance.loadtest.subscribe import Periodical
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.timezone import Timezone
 
 from twext.internet.adaptendpoint import connect
 from twext.internet.gaiendpoint import GAIEndpoint
@@ -1609,13 +1609,13 @@
             msg("Availability request spanning multiple days (%r to %r), "
                 "dropping the end date." % (start, end))
 
-        start.setTimezone(PyCalendarTimezone(utc=True))
+        start.setTimezone(Timezone(utc=True))
         start.setHHMMSS(0, 0, 0)
-        end = start + PyCalendarDuration(hours=24)
+        end = start + Duration(hours=24)
 
         start = start.getText()
         end = end.getText()
-        now = PyCalendarDateTime.getNowUTC().getText()
+        now = DateTime.getNowUTC().getText()
 
         label_suffix = "small"
         if len(users) > 5:
@@ -1919,7 +1919,7 @@
         # the sim can fire a PUT between the PROPFIND and when process the removals.
         old_hrefs = set([calendar.url + child for child in calendar.events.keys()])
 
-        now = PyCalendarDateTime.getNowUTC()
+        now = DateTime.getNowUTC()
         now.setDateOnly(True)
         now.offsetMonth(-1) # 1 month back default
         result = yield self._report(

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/profiles.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/profiles.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/profiles.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -42,8 +42,8 @@
 from contrib.performance.loadtest.logger import SummarizingMixin
 from contrib.performance.loadtest.ical import IncorrectResponseCode
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
 
 class ProfileBase(object):
     """
@@ -407,9 +407,9 @@
             vevent = vcalendar.mainComponent()
             uid = str(uuid4())
             dtstart = self._eventStartDistribution.sample()
-            dtend = dtstart + PyCalendarDuration(seconds=self._eventDurationDistribution.sample())
-            vevent.replaceProperty(Property("CREATED", PyCalendarDateTime.getNowUTC()))
-            vevent.replaceProperty(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+            dtend = dtstart + Duration(seconds=self._eventDurationDistribution.sample())
+            vevent.replaceProperty(Property("CREATED", DateTime.getNowUTC()))
+            vevent.replaceProperty(Property("DTSTAMP", DateTime.getNowUTC()))
             vevent.replaceProperty(Property("DTSTART", dtstart))
             vevent.replaceProperty(Property("DTEND", dtend))
             vevent.replaceProperty(Property("UID", uid))
@@ -650,9 +650,9 @@
             vevent = vcalendar.mainComponent()
             uid = str(uuid4())
             dtstart = self._eventStartDistribution.sample()
-            dtend = dtstart + PyCalendarDuration(seconds=self._eventDurationDistribution.sample())
-            vevent.replaceProperty(Property("CREATED", PyCalendarDateTime.getNowUTC()))
-            vevent.replaceProperty(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+            dtend = dtstart + Duration(seconds=self._eventDurationDistribution.sample())
+            vevent.replaceProperty(Property("CREATED", DateTime.getNowUTC()))
+            vevent.replaceProperty(Property("DTSTAMP", DateTime.getNowUTC()))
             vevent.replaceProperty(Property("DTSTART", dtstart))
             vevent.replaceProperty(Property("DTEND", dtend))
             vevent.replaceProperty(Property("UID", uid))
@@ -719,8 +719,8 @@
             vtodo = vcalendar.mainComponent()
             uid = str(uuid4())
             due = self._taskStartDistribution.sample()
-            vtodo.replaceProperty(Property("CREATED", PyCalendarDateTime.getNowUTC()))
-            vtodo.replaceProperty(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+            vtodo.replaceProperty(Property("CREATED", DateTime.getNowUTC()))
+            vtodo.replaceProperty(Property("DTSTAMP", DateTime.getNowUTC()))
             vtodo.replaceProperty(Property("DUE", due))
             vtodo.replaceProperty(Property("UID", uid))
 

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/test_ical.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/test_ical.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/loadtest/test_ical.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -24,8 +24,8 @@
 from contrib.performance.loadtest.ical import XMPPPush, Event, Calendar, OS_X_10_6
 from contrib.performance.loadtest.sim import _DirectoryRecord
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
 from twisted.internet.protocol import ProtocolToConsumerAdapter
@@ -1957,8 +1957,8 @@
         self.client.outbox = "/calendars/__uids__/%s/outbox/" % (self.record.uid,)
         requests = self.interceptRequests()
 
-        start = PyCalendarDateTime(2011, 6, 10, 10, 45, 0, tzid=PyCalendarTimezone(utc=True))
-        end = PyCalendarDateTime(2011, 6, 10, 11, 15, 0, tzid=PyCalendarTimezone(utc=True))
+        start = DateTime(2011, 6, 10, 10, 45, 0, tzid=Timezone(utc=True))
+        end = DateTime(2011, 6, 10, 11, 15, 0, tzid=Timezone(utc=True))
         d = self.client.requestAvailability(
             start, end, [u"urn:uuid:user05", u"urn:uuid:user10"])
 

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/invite.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/invite.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/invite.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,7 +16,7 @@
 
 from caldavclientlibrary.protocol.url import URL
 from contrib.performance.sqlusage.requests.httpTests import HTTPTestBase
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from twext.web2.dav.util import joinURL
 from caldavclientlibrary.protocol.webdav.definitions import davxml
 
@@ -67,7 +67,7 @@
         """
 
         # Invite as user02
-        now = PyCalendarDateTime.getNowUTC()
+        now = DateTime.getNowUTC()
         href = joinURL(self.sessions[1].calendarHref, "organizer.ics")
         self.sessions[1].writeData(URL(path=href), ICAL % (now.getYear() + 1,), "text/calendar")
 

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/put.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/put.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/put.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,7 +16,7 @@
 
 from caldavclientlibrary.protocol.url import URL
 from contrib.performance.sqlusage.requests.httpTests import HTTPTestBase
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from twext.web2.dav.util import joinURL
 
 ICAL = """BEGIN:VCALENDAR
@@ -62,7 +62,7 @@
         Execute the actual HTTP request.
         """
 
-        now = PyCalendarDateTime.getNowUTC()
+        now = DateTime.getNowUTC()
         href = joinURL(self.sessions[0].calendarHref, "put.ics")
         self.sessions[0].writeData(URL(path=href), ICAL % (now.getYear() + 1,), "text/calendar")
 

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/query.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/query.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/query.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -18,7 +18,7 @@
 from caldavclientlibrary.protocol.webdav.definitions import davxml, statuscodes
 from contrib.performance.sqlusage.requests.httpTests import HTTPTestBase
 from twext.web2.dav.util import joinURL
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from caldavclientlibrary.protocol.caldav.query import QueryVEVENTTimeRange
 from caldavclientlibrary.protocol.http.data.string import ResponseDataString
 
@@ -70,7 +70,7 @@
         Do some setup prior to the real request.
         """
         # Add resources to create required number of changes
-        self.start = PyCalendarDateTime.getNowUTC()
+        self.start = DateTime.getNowUTC()
         self.start.setHHMMSS(12, 0, 0)
         self.end = self.start.duplicate()
         self.end.offsetHours(1)

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/sync.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/sync.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/requests/sync.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -18,7 +18,7 @@
 from caldavclientlibrary.protocol.webdav.definitions import davxml
 from contrib.performance.sqlusage.requests.httpTests import HTTPTestBase
 from twext.web2.dav.util import joinURL
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 ICAL = """BEGIN:VCALENDAR
 CALSCALE:GREGORIAN
@@ -75,7 +75,7 @@
             self.synctoken = results[davxml.sync_token]
 
             # Add resources to create required number of changes
-            now = PyCalendarDateTime.getNowUTC()
+            now = DateTime.getNowUTC()
             for i in range(self.count):
                 href = joinURL(self.sessions[0].calendarHref, "sync-collection-%d.ics" % (i + 1,))
                 self.sessions[0].writeData(URL(path=href), ICAL % (now.getYear() + 1, i + 1,), "text/calendar")

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/sqlusage.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/sqlusage.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/sqlusage/sqlusage.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -27,7 +27,7 @@
 from contrib.performance.sqlusage.requests.put import PutTest
 from contrib.performance.sqlusage.requests.query import QueryTest
 from contrib.performance.sqlusage.requests.sync import SyncTest
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from twext.web2.dav.util import joinURL
 import getopt
 import itertools
@@ -176,7 +176,7 @@
         @param n: number of events
         @type n: C{int}
         """
-        now = PyCalendarDateTime.getNowUTC()
+        now = DateTime.getNowUTC()
         for i in range(n - self.currentCount):
             index = self.currentCount + i + 1
             href = joinURL(calendarhref, "%d.ics" % (index,))

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/stats.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/stats.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/stats.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,10 +16,10 @@
 
 from __future__ import print_function
 from math import log, sqrt
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.property import PyCalendarProperty
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration as PyDuration
+from pycalendar.icalendar.property import Property
+from pycalendar.timezone import Timezone
 from twisted.python.util import FancyEqMixin
 from zope.interface import Interface, implements
 import random
@@ -338,7 +338,7 @@
 
 
     def sample(self):
-        now = PyCalendarDateTime.getNowUTC()
+        now = DateTime.getNowUTC()
         now.offsetSeconds(int(self._offset.sample()))
         return now
 
@@ -390,7 +390,7 @@
             60 * 60 * 8 * 6,
             # Standard deviation of 4 workdays
             60 * 60 * 8 * 4)
-        self.now = PyCalendarDateTime.getNow
+        self.now = DateTime.getNow
 
 
     def astimestamp(self, dt):
@@ -406,7 +406,7 @@
         # Find a workday that follows the timestamp
         weekday = when.getDayOfWeek()
         for i in range(NUM_WEEKDAYS):
-            day = when + PyCalendarDuration(days=i)
+            day = when + PyDuration(days=i)
             if (weekday + i) % NUM_WEEKDAYS in self._daysOfWeek:
                 # Joy, a day on which work might occur.  Find the first hour on
                 # this day when work may start.
@@ -419,8 +419,8 @@
 
 
     def sample(self):
-        offset = PyCalendarDuration(seconds=int(self._helperDistribution.sample()))
-        beginning = self.now(PyCalendarTimezone(tzid=self._tzname))
+        offset = PyDuration(seconds=int(self._helperDistribution.sample()))
+        beginning = self.now(Timezone(tzid=self._tzname))
         while offset:
             start, end = self._findWorkAfter(beginning)
             if end - start > offset:
@@ -463,8 +463,7 @@
             index = self._helperDistribution.sample()
             rrule = self._rrules[index]
             if rrule:
-                prop = PyCalendarProperty()
-                prop.parse(rrule)
+                prop = Property.parseText(rrule)
                 return prop
 
         return None

Modified: CalendarServer/branches/users/cdaboo/json/contrib/performance/test_stats.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/performance/test_stats.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/performance/test_stats.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -20,8 +20,8 @@
     SQLDuration, LogNormalDistribution, UniformDiscreteDistribution,
     UniformIntegerDistribution, WorkDistribution, quantize,
     RecurrenceDistribution)
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 class SQLDurationTests(TestCase):
     def setUp(self):
@@ -90,21 +90,21 @@
         tzname = "US/Eastern"
         dist = WorkDistribution(["mon", "wed", "thu", "sat"], 10, 20, tzname)
         dist._helperDistribution = UniformDiscreteDistribution([35 * 60 * 60 + 30 * 60])
-        dist.now = lambda tzname = None: PyCalendarDateTime(2011, 5, 29, 18, 5, 36, tzid=tzname)
+        dist.now = lambda tzname = None: DateTime(2011, 5, 29, 18, 5, 36, tzid=tzname)
         value = dist.sample()
         self.assertEqual(
             # Move past three workdays - monday, wednesday, thursday - using 30
             # of the hours, and then five and a half hours into the fourth
             # workday, saturday.  Workday starts at 10am, so the sample value
             # is 3:30pm, ie 1530 hours.
-            PyCalendarDateTime(2011, 6, 4, 15, 30, 0, tzid=PyCalendarTimezone(tzid=tzname)),
+            DateTime(2011, 6, 4, 15, 30, 0, tzid=Timezone(tzid=tzname)),
             value
         )
 
         dist = WorkDistribution(["mon", "tue", "wed", "thu", "fri"], 10, 20, tzname)
         dist._helperDistribution = UniformDiscreteDistribution([35 * 60 * 60 + 30 * 60])
         value = dist.sample()
-        self.assertTrue(isinstance(value, PyCalendarDateTime))
+        self.assertTrue(isinstance(value, DateTime))
 
     # twisted.trial.unittest.FailTest: not equal:
     # a = datetime.datetime(2011, 6, 4, 15, 30, tzinfo=<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>)

Modified: CalendarServer/branches/users/cdaboo/json/contrib/tools/fix_calendar
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/tools/fix_calendar	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/tools/fix_calendar	2013-08-21 15:40:05 UTC (rev 11625)
@@ -28,9 +28,9 @@
 def usage():
     print """Usage: xattr_fix CALENDARS
 Options:
-    
+
 CALENDARS - a list of directories that are to be treated as calendars
-    
+
 Description:
 This utility will add xattrs to the specified directories and their contents
 to make them appear to be calendars and calendar resources when used with
@@ -40,8 +40,10 @@
 root without properly preserving the xattrs.
 """
 
+
+
 def fixCalendar(path):
-    
+
     # First fix the resourcetype & getctag on the calendar
     x = xattr.xattr(path)
     x["WebDAV:{DAV:}resourcetype"] = """<?xml version='1.0' encoding='UTF-8'?>
@@ -60,7 +62,7 @@
         if not child.endswith(".ics"):
             continue
         fullpath = os.path.join(path, child)
-        
+
         # getcontenttype
         x = xattr.xattr(fullpath)
         x["WebDAV:{DAV:}getcontenttype"] = """<?xml version='1.0' encoding='UTF-8'?>
@@ -94,7 +96,7 @@
             if not os.path.exists(arg):
                 print "Path does not exist: '%s'. Ignoring." % (arg,)
                 continue
-            
+
             if os.path.basename(arg) in ("inbox", "outbox", "dropbox",):
                 print "Cannot be used on inbox, outbox or dropbox."
                 continue
@@ -103,4 +105,3 @@
 
     except Exception, e:
         sys.exit(str(e))
-    
\ No newline at end of file

Modified: CalendarServer/branches/users/cdaboo/json/contrib/tools/sortrecurrences.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/contrib/tools/sortrecurrences.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/contrib/tools/sortrecurrences.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -20,7 +20,7 @@
 import os
 import sys
 import traceback
-from pycalendar.calendar import PyCalendar
+from pycalendar.icalendar.calendar import Calendar
 
 def usage(error_msg=None):
     if error_msg:
@@ -72,7 +72,7 @@
                 print("Path does not exist: '%s'. Ignoring." % (arg,))
                 continue
 
-            cal = PyCalendar()
+            cal = Calendar()
             cal.parse(open(arg))
             print(str(cal.serialize()))
 

Modified: CalendarServer/branches/users/cdaboo/json/support/build.sh
===================================================================
--- CalendarServer/branches/users/cdaboo/json/support/build.sh	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/support/build.sh	2013-08-21 15:40:05 UTC (rev 11625)
@@ -800,8 +800,8 @@
 
   # XXX actually PyCalendar should be imported in-place.
   py_dependency -fe -i "src" -r 11458 \
-    "PyCalendar" "pycalendar" "pycalendar" \
-    "${svn_uri_base}/PyCalendar/trunk";
+    "PyCalendar" "pycalendar" "pycalendar-json2" \
+    "${svn_uri_base}/PyCalendar/branches/json-2";
 
   #
   # Tool dependencies.  The code itself doesn't depend on these, but

Modified: CalendarServer/branches/users/cdaboo/json/support/version.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/support/version.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/support/version.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -36,7 +36,7 @@
             "trunk",
         )
     )
-    
+
     source_root = dirname(dirname(__file__))
 
     for branch in branches:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/__init__.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/__init__.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/__init__.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -59,12 +59,14 @@
 })
 
 # Do some PyCalendar init
-from pycalendar.calendar import PyCalendar
-from pycalendar.property import PyCalendarProperty
-from pycalendar.value import PyCalendarValue
+from pycalendar.icalendar.calendar import Calendar
+from pycalendar.icalendar.property import Property
+from pycalendar.vcard.card import Card
+from pycalendar.value import Value
 
-PyCalendar.setPRODID("-//CALENDARSERVER.ORG//NONSGML Version 1//EN")
+Calendar.setPRODID("-//CALENDARSERVER.ORG//NONSGML Version 1//EN")
+Card.setPRODID("-//CALENDARSERVER.ORG//NONSGML Version 1//EN")
 
 # These are properties we use directly and we want the default value type set for TEXT
-PyCalendarProperty.registerDefaultValue("X-CALENDARSERVER-PRIVATE-COMMENT", PyCalendarValue.VALUETYPE_TEXT)
-PyCalendarProperty.registerDefaultValue("X-CALENDARSERVER-ATTENDEE-COMMENT", PyCalendarValue.VALUETYPE_TEXT)
+Property.registerDefaultValue("X-CALENDARSERVER-PRIVATE-COMMENT", Value.VALUETYPE_TEXT)
+Property.registerDefaultValue("X-CALENDARSERVER-ATTENDEE-COMMENT", Value.VALUETYPE_TEXT)

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/accounting.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/accounting.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/accounting.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -42,6 +42,8 @@
         accountingEnabledForPrincipal(principal)
     )
 
+
+
 def accountingEnabledForCategory(category):
     """
     Determine if accounting is enabled for the given category.
@@ -51,6 +53,8 @@
         return False
     return AccountingCategories.get(category, False)
 
+
+
 def accountingEnabledForPrincipal(principal):
     """
     Determine if accounting is enabled for the given principal.
@@ -69,6 +73,8 @@
 
     return False
 
+
+
 def emitAccounting(category, principal, data, tag=None):
     """
     Write the supplied data to the appropriate location for the given
@@ -80,7 +86,7 @@
     @type category: C{tuple}
     @param data: data to write.
     @type data: C{str}
-    """    
+    """
     if isinstance(principal, str):
         principalLogPath = principal
     elif accountingEnabled(category, principal):
@@ -107,7 +113,7 @@
             logDirectory,
             datetime.datetime.now().isoformat()
         )
-    
+
         if not os.path.isdir(os.path.join(logRoot, logDirectory)):
             os.makedirs(os.path.join(logRoot, logDirectory))
             logFilename = "%s-01" % (logFilename,)
@@ -128,7 +134,7 @@
                     log.error("Too many %s accounting files for %s" % (category, principal))
                     return None
                 index += 1
-    
+
         #
         # Now write out the data to the log file
         #
@@ -137,7 +143,7 @@
             logFile.write(data)
         finally:
             logFile.close()
-            
+
         return logFilename
 
     except OSError, e:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/authkerb.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/authkerb.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/authkerb.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -22,7 +22,7 @@
 
     1. An alternative to password based BASIC authentication in which the BASIC credentials are
         verified against Kerberos.
-   
+
     2. The NEGOTIATE mechanism (as defined in http://www.ietf.org/rfc/rfc4559.txt)
         that implements full GSSAPI authentication.
 """
@@ -58,7 +58,7 @@
 
     def __init__(self, principal=None, type=None, hostname=None):
         """
-        
+
         @param principal:  full Kerberos principal (e.g., 'HTTP/server.example.com at EXAMPLE.COM'). If C{None}
             then the type and hostname arguments are used instead.
         @type service:     str
@@ -82,6 +82,7 @@
 
         self.service, self.realm = self._splitPrincipal(principal)
 
+
     def _splitPrincipal(self, principal):
 
         try:
@@ -93,12 +94,14 @@
         except IndexError:
             self.log.error("Invalid Kerberos principal: %s" % (principal,))
             raise ValueError('Authentication System Failure: Invalid Kerberos principal: %s' % (principal,))
-                
+
         service = "%s@%s" % (servicetype, service,)
         realm = realm
-        
+
         return (service, realm,)
-        
+
+
+
 class BasicKerberosCredentials(credentials.UsernamePassword):
     """
     A set of user/password credentials that checks itself against Kerberos.
@@ -106,7 +109,7 @@
 
     def __init__(self, username, password, service, realm):
         """
-        
+
         @param username:   user name of user to authenticate
         @type username:    str
         @param password:   password for user being authenticated
@@ -117,11 +120,13 @@
         @type hostname:    str
         """
         credentials.UsernamePassword.__init__(self, username, password)
-        
+
         # Convert Kerberos principal spec into service and realm
         self.service = service
         self.default_realm = realm
-        
+
+
+
 class BasicKerberosCredentialFactory(KerberosCredentialFactoryBase):
     """
     Authorizer for insecure Basic (base64-encoded plaintext) authentication.
@@ -134,7 +139,7 @@
 
     def __init__(self, principal=None, type=None, hostname=None):
         """
-        
+
         @param principal:  full Kerberos principal (e.g., 'HTTP/server.example.com at EXAMPLE.COM'). If C{None}
             then the type and hostname arguments are used instead.
         @type service:     str
@@ -146,9 +151,11 @@
 
         super(BasicKerberosCredentialFactory, self).__init__(principal, type, hostname)
 
+
     def getChallenge(self, _ignore_peer):
         return succeed({'realm': self.realm})
 
+
     def decode(self, response, request): #@UnusedVariable
         try:
             creds = (response + '===').decode('base64')
@@ -161,6 +168,8 @@
             return succeed(c)
         raise error.LoginFailed('Invalid credentials')
 
+
+
 class BasicKerberosCredentialsChecker(object):
     log = Logger()
 
@@ -187,9 +196,11 @@
                     pcreds.authnPrincipal,
                     pcreds.authzPrincipal,
                 ))
-        
+
         raise error.UnauthorizedLogin("Bad credentials for: %s" % (pcreds.authnURI,))
 
+
+
 class NegotiateCredentials(object):
     """
     A set of user/password credentials that checks itself against Kerberos.
@@ -198,10 +209,12 @@
     implements(credentials.ICredentials)
 
     def __init__(self, principal, username):
-        
+
         self.principal = principal
         self.username = username
-        
+
+
+
 class NegotiateCredentialFactory(KerberosCredentialFactoryBase):
     """
     Authorizer for Negotiate authentication (http://www.ietf.org/rfc/rfc4559.txt).
@@ -211,7 +224,7 @@
 
     def __init__(self, principal=None, type=None, hostname=None):
         """
-        
+
         @param principal:  full Kerberos principal (e.g., 'HTTP/server.example.com at EXAMPLE.COM'). If C{None}
             then the type and hostname arguments are used instead.
         @type service:     str
@@ -223,22 +236,24 @@
 
         super(NegotiateCredentialFactory, self).__init__(principal, type, hostname)
 
+
     def getChallenge(self, _ignore_peer):
         return succeed({})
 
+
     def decode(self, base64data, request):
-        
+
         # Init GSSAPI first - we won't specify the service now as we need to accept a target
         # name that is case-insenstive as some clients will use "http" instead of "HTTP"
         try:
-            _ignore_result, context = kerberos.authGSSServerInit("");
+            _ignore_result, context = kerberos.authGSSServerInit("")
         except kerberos.GSSError, ex:
             self.log.error("authGSSServerInit: %s(%s)" % (ex[0][0], ex[1][0],))
             raise error.LoginFailed('Authentication System Failure: %s(%s)' % (ex[0][0], ex[1][0],))
 
         # Do the GSSAPI step and get response and username
         try:
-            kerberos.authGSSServerStep(context, base64data);
+            kerberos.authGSSServerStep(context, base64data)
         except kerberos.GSSError, ex:
             self.log.error("authGSSServerStep: %s(%s)" % (ex[0][0], ex[1][0],))
             kerberos.authGSSServerClean(context)
@@ -264,13 +279,13 @@
         principal = kerberos.authGSSServerUserName(context)
         username = principal
         realmname = ""
-        
+
         # Username may include realm suffix which we want to strip
         if username.find("@") != -1:
             splits = username.split("@", 1)
             username = splits[0]
             realmname = splits[1]
-        
+
         # We currently do not support cross-realm authentication, so we
         # must verify that the realm we got exactly matches the one we expect.
         if realmname != self.realm:
@@ -278,11 +293,11 @@
 
         # Close the context
         try:
-            kerberos.authGSSServerClean(context);
+            kerberos.authGSSServerClean(context)
         except kerberos.GSSError, ex:
             self.log.error("authGSSServerClean: %s" % (ex[0][0], ex[1][0],))
             raise error.LoginFailed('Authentication System Failure %s(%s)' % (ex[0][0], ex[1][0],))
-        
+
         # If we successfully decoded and verified the Kerberos credentials we need to add the Kerberos
         # response data to the outgoing request
 
@@ -299,6 +314,8 @@
 
         return succeed(NegotiateCredentials(principal, username))
 
+
+
 class NegotiateCredentialsChecker(object):
 
     implements(checkers.ICredentialsChecker)
@@ -320,6 +337,5 @@
                 pcreds.authnPrincipal,
                 pcreds.authzPrincipal,
             ))
-        
+
         raise error.UnauthorizedLogin("Bad credentials for: %s" % (pcreds.authnURI,))
-

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/backup.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/backup.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/backup.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -38,19 +38,22 @@
         for x in xrange(0, len(argv)):
             opt = argv[x]
             if opt.startswith('-'):
-                self[opt.strip('-')] = argv[x+1]
+                self[opt.strip('-')] = argv[x + 1]
 
 
+
 def debug(string):
     if VERBOSE:
         print("DEBUG:", string)
 
 
+
 def funclog(string):
     if FUNCLOG:
         print("FUNCLOG:", string)
 
 
+
 def logFuncCall(func):
     def printArgs(args):
         a = []
@@ -60,6 +63,7 @@
 
         return ''.join(a).strip(', ')
 
+
     def printKwargs(kwargs):
         a = []
         for kwarg, value in kwargs:
@@ -67,8 +71,9 @@
 
         return ''.join(a).strip(', ')
 
+
     def _(*args, **kwargs):
-        funclog("%s(%s)" % (func.func_name, 
+        funclog("%s(%s)" % (func.func_name,
                             ', '.join((printArgs(args),
                                        printKwargs(kwargs))).strip(', ')))
 
@@ -77,10 +82,11 @@
         funclog("%s - > %s" % (func.func_name, retval))
 
         return retval
-    
+
     return _
 
 
+
 @logFuncCall
 def readConfig(configFile):
     config = readPlist(configFile + '.default')
@@ -89,14 +95,16 @@
         config.update(readPlist(configFile))
 
     return config
-        
 
+
+
 @logFuncCall
 def mkroot(path):
     root = '/'.join(path.rstrip('/').split('/')[:-1])
     os.makedirs(root)
 
 
+
 @logFuncCall
 def serveradmin(action, service):
     cmd = ' '.join((
@@ -112,6 +120,7 @@
     return status
 
 
+
 @logFuncCall
 def isRunning(service):
     cmd = ' '.join((
@@ -134,21 +143,25 @@
         return False
 
 
+
 @logFuncCall
 def copy(src, dst):
     shutil.copytree(src, dst)
 
 
+
 @logFuncCall
 def move(src, dst):
     os.rename(src, dst)
 
 
+
 @logFuncCall
 def remove(dst):
     shutil.rmtree(dst)
 
 
+
 @logFuncCall
 def purge(root, patterns):
     removed = []
@@ -175,5 +188,5 @@
                     os.remove(full)
 
                     removed.append(full)
-                    
+
     return removed

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/caldavxml.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/caldavxml.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -25,8 +25,8 @@
 See draft spec: http://ietf.webdav.org/caldav/draft-dusseault-caldav.txt
 """
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from txdav.xml.element import registerElement, dav_namespace
 from txdav.xml.element import WebDAVElement, PCDATAElement
@@ -106,8 +106,8 @@
         if "start" not in attributes and "end" not in attributes:
             raise ValueError("One of 'start' or 'end' must be present in CALDAV:time-range")
 
-        self.start = PyCalendarDateTime.parseText(attributes["start"]) if "start" in attributes else None
-        self.end = PyCalendarDateTime.parseText(attributes["end"]) if "end" in attributes else None
+        self.start = DateTime.parseText(attributes["start"]) if "start" in attributes else None
+        self.end = DateTime.parseText(attributes["end"]) if "end" in attributes else None
 
 
     def valid(self, level=0):
@@ -151,7 +151,7 @@
         """
         Get the timezone to use. If none, return UTC timezone.
 
-        @return: the L{PyCalendarTimezone} derived from the VTIMEZONE or utc.
+        @return: the L{Timezone} derived from the VTIMEZONE or utc.
         """
         calendar = self.calendar()
         if calendar is not None:
@@ -160,7 +160,7 @@
                 return tz
 
         # Default to using utc tzinfo
-        return PyCalendarTimezone(utc=True)
+        return Timezone(utc=True)
 
 
     def valid(self):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/carddavxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/carddavxml.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/carddavxml.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -22,7 +22,7 @@
 This API is considered private to static.py and is therefore subject to
 change.
 
-See draft spec: 
+See draft spec:
 """
 
 from txdav.xml.element import registerElement, dav_namespace
@@ -50,6 +50,7 @@
     namespace = carddav_namespace
 
 
+
 class CardDAVEmptyElement (WebDAVEmptyElement):
     """
     CardDAV element with no contents.
@@ -57,6 +58,7 @@
     namespace = carddav_namespace
 
 
+
 class CardDAVTextElement (WebDAVTextElement):
     """
     CardDAV element containing PCDATA.
@@ -64,6 +66,7 @@
     namespace = carddav_namespace
 
 
+
 @registerElement
 class AddressBookHomeSet (CardDAVElement):
     """
@@ -73,9 +76,10 @@
     name = "addressbook-home-set"
     hidden = True
 
-    allowed_children = { (dav_namespace, "href"): (0, None) }
+    allowed_children = {(dav_namespace, "href"): (0, None)}
 
 
+
 @registerElement
 class AddressBookDescription (CardDAVTextElement):
     """
@@ -88,6 +92,7 @@
     # May be protected; but we'll let the client set this if they like.
 
 
+
 @registerElement
 class SupportedAddressData (CardDAVElement):
     """
@@ -98,9 +103,10 @@
     hidden = True
     protected = True
 
-    allowed_children = { (carddav_namespace, "address-data-type"): (0, None) }
+    allowed_children = {(carddav_namespace, "address-data-type"): (0, None)}
 
 
+
 @registerElement
 class MaxResourceSize (CardDAVTextElement):
     """
@@ -112,6 +118,7 @@
     protected = True
 
 
+
 @registerElement
 class AddressBook (CardDAVEmptyElement):
     """
@@ -121,6 +128,7 @@
     name = "addressbook"
 
 
+
 @registerElement
 class AddressBookQuery (CardDAVElement):
     """
@@ -130,11 +138,11 @@
     name = "addressbook-query"
 
     allowed_children = {
-        (dav_namespace,     "allprop" ): (0, None),
-        (dav_namespace,     "propname"): (0, None),
-        (dav_namespace,     "prop"    ): (0, None),
-        (carddav_namespace, "filter"  ): (0, 1), # Actually (1, 1) unless element is empty
-        (carddav_namespace, "limit"    ): (0, None),
+        (dav_namespace, "allprop"): (0, None),
+        (dav_namespace, "propname"): (0, None),
+        (dav_namespace, "prop"): (0, None),
+        (carddav_namespace, "filter"): (0, 1), # Actually (1, 1) unless element is empty
+        (carddav_namespace, "limit"): (0, None),
     }
 
     def __init__(self, *children, **attributes):
@@ -148,9 +156,9 @@
             qname = child.qname()
 
             if qname in (
-                (dav_namespace, "allprop" ),
+                (dav_namespace, "allprop"),
                 (dav_namespace, "propname"),
-                (dav_namespace, "prop"    ),
+                (dav_namespace, "prop"),
             ):
                 if props is not None:
                     raise ValueError("Only one of CardDAV:allprop, CardDAV:propname, CardDAV:prop allowed")
@@ -159,7 +167,7 @@
             elif qname == (carddav_namespace, "filter"):
                 filter = child
             elif qname == (carddav_namespace, "limit"):
-                # type check 
+                # type check
                 child.childOfType(NResults)
                 limit = child
 
@@ -170,11 +178,12 @@
             if filter is None:
                 raise ValueError("CARDDAV:filter required")
 
-        self.props  = props
+        self.props = props
         self.filter = filter
         self.limit = limit
 
 
+
 @registerElement
 class AddressDataType (CardDAVEmptyElement):
     """
@@ -190,6 +199,7 @@
     }
 
 
+
 @registerElement
 class AddressData (CardDAVElement):
     """
@@ -201,7 +211,7 @@
 
     allowed_children = {
         (carddav_namespace, "allprop"): (0, 1),
-        (carddav_namespace, "prop"   ): (0, None),
+        (carddav_namespace, "prop"): (0, None),
         PCDATAElement                 : (0, None),
     }
     allowed_attributes = {
@@ -214,6 +224,7 @@
         assert address.name() == "VCARD", "Not a vCard: %r" % (address,)
         return clazz(PCDATAElement(str(address)))
 
+
     @classmethod
     def fromAddressData(clazz, addressdata):
         """
@@ -229,7 +240,7 @@
         super(AddressData, self).__init__(*children, **attributes)
 
         properties = None
-        data       = None
+        data = None
 
         for child in self.children:
             qname = child.qname()
@@ -256,17 +267,18 @@
                 else:
                     data += child
 
-            else: raise AssertionError("We shouldn't be here")
+            else:
+                raise AssertionError("We shouldn't be here")
 
-
         self.properties = properties
 
         if data is not None:
             try:
                 if properties is not None:
-                    raise ValueError("Only one of allprop, prop (%r) or PCDATA (%r) allowed"% (properties, str(data)))
+                    raise ValueError("Only one of allprop, prop (%r) or PCDATA (%r) allowed" % (properties, str(data)))
             except ValueError:
-                if not data.isWhitespace(): raise
+                if not data.isWhitespace():
+                    raise
             else:
                 # Since we've already combined PCDATA elements, we'd may as well
                 # optimize them originals away
@@ -282,19 +294,21 @@
         else:
             self.version = "3.0"
 
+
     def verifyTypeVersion(self, types_and_versions):
         """
         Make sure any content-type and version matches at least one of the supplied set.
-        
+
         @param types_and_versions: a list of (content-type, version) tuples to test against.
         @return:                   True if there is at least one match, False otherwise.
         """
         for item in types_and_versions:
             if (item[0] == self.content_type) and (item[1] == self.version):
                 return True
-        
+
         return False
 
+
     def address(self):
         """
         Returns an address component derived from this element.
@@ -323,6 +337,7 @@
     textData = addressData
 
 
+
 @registerElement
 class AllProperties (CardDAVEmptyElement):
     """
@@ -332,6 +347,7 @@
     name = "allprop"
 
 
+
 @registerElement
 class Property (CardDAVEmptyElement):
     """
@@ -362,6 +378,7 @@
             self.novalue = False
 
 
+
 @registerElement
 class Filter (CardDAVElement):
     """
@@ -370,10 +387,11 @@
     """
     name = "filter"
 
-    allowed_children = { (carddav_namespace, "prop-filter"): (0, None) }
-    allowed_attributes = { "test": False }
-        
+    allowed_children = {(carddav_namespace, "prop-filter"): (0, None)}
+    allowed_attributes = {"test": False}
 
+
+
 @registerElement
 class PropertyFilter (CardDAVElement):
     """
@@ -383,9 +401,9 @@
     name = "prop-filter"
 
     allowed_children = {
-        (carddav_namespace, "is-not-defined" ): (0, 1),
-        (carddav_namespace, "text-match"     ): (0, None),
-        (carddav_namespace, "param-filter"   ): (0, None),
+        (carddav_namespace, "is-not-defined"): (0, 1),
+        (carddav_namespace, "text-match"): (0, None),
+        (carddav_namespace, "param-filter"): (0, None),
     }
     allowed_attributes = {
         "name": True,
@@ -393,6 +411,7 @@
     }
 
 
+
 @registerElement
 class ParameterFilter (CardDAVElement):
     """
@@ -402,12 +421,13 @@
     name = "param-filter"
 
     allowed_children = {
-        (carddav_namespace, "is-not-defined" ): (0, 1),
-        (carddav_namespace, "text-match"     ): (0, 1),
+        (carddav_namespace, "is-not-defined"): (0, 1),
+        (carddav_namespace, "text-match"): (0, 1),
     }
-    allowed_attributes = { "name": True }
+    allowed_attributes = {"name": True}
 
 
+
 @registerElement
 class Limit (WebDAVElement):
     """
@@ -416,10 +436,11 @@
     namespace = carddav_namespace
     name = "limit"
     allowed_children = {
-        (carddav_namespace, "nresults" )  : (1, 1),
+        (carddav_namespace, "nresults")  : (1, 1),
     }
 
 
+
 @registerElement
 class NResults (WebDAVTextElement):
     """
@@ -439,6 +460,7 @@
     name = "is-not-defined"
 
 
+
 @registerElement
 class TextMatch (CardDAVTextElement):
     """
@@ -464,6 +486,7 @@
     }
 
 
+
 @registerElement
 class AddressBookMultiGet (CardDAVElement):
     """
@@ -475,10 +498,10 @@
     # To allow for an empty element in a supported-report-set property we need
     # to relax the child restrictions
     allowed_children = {
-        (dav_namespace, "allprop" ): (0, 1),
+        (dav_namespace, "allprop"): (0, 1),
         (dav_namespace, "propname"): (0, 1),
-        (dav_namespace, "prop"    ): (0, 1),
-        (dav_namespace, "href"    ): (0, None),    # Actually ought to be (1, None)
+        (dav_namespace, "prop"): (0, 1),
+        (dav_namespace, "href"): (0, None),    # Actually ought to be (1, None)
     }
 
     def __init__(self, *children, **attributes):
@@ -491,9 +514,9 @@
             qname = child.qname()
 
             if qname in (
-                (dav_namespace, "allprop" ),
+                (dav_namespace, "allprop"),
                 (dav_namespace, "propname"),
-                (dav_namespace, "prop"    ),
+                (dav_namespace, "prop"),
             ):
                 if property is not None:
                     raise ValueError("Only one of DAV:allprop, DAV:propname, DAV:prop allowed")
@@ -502,10 +525,11 @@
             elif qname == (dav_namespace, "href"):
                 resources.append(child)
 
-        self.property  = property
+        self.property = property
         self.resources = resources
 
 
+
 @registerElement
 class NoUIDConflict(CardDAVElement):
     """
@@ -514,9 +538,10 @@
     """
     name = "no-uid-conflict"
 
-    allowed_children = { (dav_namespace, "href"): (1, 1) }
-    
+    allowed_children = {(dav_namespace, "href"): (1, 1)}
 
+
+
 @registerElement
 class SupportedFilter(CardDAVElement):
     """
@@ -527,11 +552,12 @@
     name = "supported-filter"
 
     allowed_children = {
-        (carddav_namespace, "prop-filter" ): (0, None),
+        (carddav_namespace, "prop-filter"): (0, None),
         (carddav_namespace, "param-filter"): (0, None)
     }
-    
 
+
+
 @registerElement
 class DirectoryGateway(CardDAVElement):
     """
@@ -541,17 +567,19 @@
     hidden = True
     protected = True
 
-    allowed_children = { (dav_namespace, "href"): (0, None) }
-    
+    allowed_children = {(dav_namespace, "href"): (0, None)}
 
+
+
 @registerElement
 class Directory(CardDAVEmptyElement):
     """
     CardDAV property on a principal to indicate where the directory resource is.
     """
     name = "directory"
-    
 
+
+
 @registerElement
 class DefaultAddressBookURL (CardDAVElement):
     """
@@ -559,14 +587,17 @@
     """
     name = "default-addressbook-URL"
 
-    allowed_children = { (dav_namespace, "href"): (0, 1) }
+    allowed_children = {(dav_namespace, "href"): (0, 1)}
 
+
+
 ##
 # Extensions to ResourceType
 ##
 
-def _isAddressBook(self): return bool(self.childrenOfType(AddressBook))
+def _isAddressBook(self):
+    return bool(self.childrenOfType(AddressBook))
 ResourceType.isAddressBook = _isAddressBook
 
 ResourceType.addressbook = ResourceType(Collection(), AddressBook())
-ResourceType.directory   = ResourceType(Collection(), AddressBook(), Directory())
+ResourceType.directory = ResourceType(Collection(), AddressBook(), Directory())

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/customxml.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/customxml.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -34,7 +34,7 @@
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.ical import Component as iComponent
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 
 calendarserver_namespace = "http://calendarserver.org/ns/"
@@ -640,7 +640,7 @@
 
     def __init__(self, *children):
         super(DTStamp, self).__init__(children)
-        self.children = (PCDATAElement(PyCalendarDateTime.getNowUTC().getText()),)
+        self.children = (PCDATAElement(DateTime.getNowUTC().getText()),)
 
 
 

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/database.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/database.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/database.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -44,14 +44,15 @@
     """
     A ThreadPool that closes connections for each worker thread
     """
-    
+
     def _worker(self):
         log.debug("Starting ADBAPI thread: %s" % (thread.get_ident(),))
         ThreadPool._worker(self)
         self._closeConnection()
 
+
     def _closeConnection(self):
-        
+
         tid = thread.get_ident()
         log.debug("Closing ADBAPI thread: %s" % (tid,))
 
@@ -59,6 +60,8 @@
         self.pool._close(conn)
         del self.pool.connections[tid]
 
+
+
 class AbstractADBAPIDatabase(object):
     """
     A generic SQL database.
@@ -66,7 +69,7 @@
 
     def __init__(self, dbID, dbapiName, dbapiArgs, persistent, **kwargs):
         """
-        
+
         @param persistent: C{True} if the data in the DB must be perserved during upgrades,
             C{False} if the DB data can be re-created from an external source.
         @type persistent: bool
@@ -77,12 +80,14 @@
         self.dbapikwargs = kwargs
 
         self.persistent = persistent
-        
+
         self.initialized = False
 
+
     def __repr__(self):
         return "<%s %r>" % (self.__class__.__name__, self.pool)
 
+
     @inlineCallbacks
     def open(self):
         """
@@ -92,7 +97,7 @@
         if not self.initialized:
 
             self.pool = ConnectionPool(self.dbapiName, *self.dbapiArgs, **self.dbapikwargs)
-            
+
             # sqlite3 is not thread safe which means we have to close the sqlite3 connections in the same thread that
             # opened them. We need a special thread pool class that has a thread worker function that does a close
             # when a thread is closed.
@@ -126,7 +131,7 @@
                         elif version != self._db_version():
                             log.error("Database %s has different schema (v.%s vs. v.%s)"
                                       % (self.dbID, version, self._db_version()))
-                            
+
                             # Upgrade the DB
                             yield self._db_upgrade(version)
 
@@ -139,8 +144,9 @@
                 self.pool = None
                 raise
 
+
     def close(self):
-        
+
         if self.initialized:
             try:
                 self.pool.close()
@@ -149,9 +155,10 @@
             self.pool = None
             self.initialized = False
 
+
     @inlineCallbacks
     def clean(self):
-        
+
         # Re-try at least once
         for _ignore in (0, 1):
             if not self.initialized:
@@ -165,14 +172,15 @@
             else:
                 break
 
+
     @inlineCallbacks
     def execute(self, sql, *query_params):
-        
+
         # Re-try at least once
         for _ignore in (0, 1):
             if not self.initialized:
                 yield self.open()
-    
+
             try:
                 yield self._db_execute(sql, *query_params)
             except Exception, e:
@@ -181,14 +189,15 @@
             else:
                 break
 
+
     @inlineCallbacks
     def executescript(self, script):
-        
+
         # Re-try at least once
         for _ignore in (0, 1):
             if not self.initialized:
                 yield self.open()
-    
+
             try:
                 yield self._db_execute_script(script)
             except Exception, e:
@@ -197,14 +206,15 @@
             else:
                 break
 
+
     @inlineCallbacks
     def query(self, sql, *query_params):
-        
+
         # Re-try at least once
         for _ignore in (0, 1):
             if not self.initialized:
                 yield self.open()
-    
+
             try:
                 result = (yield self._db_all_values_for_sql(sql, *query_params))
             except Exception, e:
@@ -215,14 +225,15 @@
 
         returnValue(result)
 
+
     @inlineCallbacks
     def queryList(self, sql, *query_params):
-        
+
         # Re-try at least once
         for _ignore in (0, 1):
             if not self.initialized:
                 yield self.open()
-            
+
             try:
                 result = (yield self._db_values_for_sql(sql, *query_params))
             except Exception, e:
@@ -233,14 +244,15 @@
 
         returnValue(result)
 
+
     @inlineCallbacks
     def queryOne(self, sql, *query_params):
-        
+
         # Re-try at least once
         for _ignore in (0, 1):
             if not self.initialized:
                 yield self.open()
-    
+
             try:
                 result = (yield self._db_value_for_sql(sql, *query_params))
             except Exception, e:
@@ -251,21 +263,25 @@
 
         returnValue(result)
 
+
     def _db_version(self):
         """
         @return: the schema version assigned to this DB.
         """
         raise NotImplementedError
-        
+
+
     def _db_type(self):
         """
         @return: the collection type assigned to this DB.
         """
         raise NotImplementedError
-        
+
+
     def _test_schema_table(self):
         return self._test_table("CALDAV")
 
+
     @inlineCallbacks
     def _db_init(self):
         """
@@ -275,12 +291,12 @@
 
         # TODO we need an exclusive lock of some kind here to prevent a race condition
         # in which multiple processes try to create the tables.
-        
 
         yield self._db_init_schema_table()
         yield self._db_init_data_tables()
         yield self._db_recreate()
 
+
     @inlineCallbacks
     def _db_init_schema_table(self):
         """
@@ -310,12 +326,14 @@
             """, (self._db_type(),)
         )
 
+
     def _db_init_data_tables(self):
         """
         Initialise the underlying database tables.
         """
         raise NotImplementedError
 
+
     def _db_empty_data_tables(self):
         """
         Delete the database tables.
@@ -323,7 +341,8 @@
 
         # Implementations can override this to re-create data
         pass
-        
+
+
     def _db_recreate(self):
         """
         Recreate the database tables.
@@ -332,12 +351,13 @@
         # Implementations can override this to re-create data
         pass
 
+
     @inlineCallbacks
     def _db_upgrade(self, old_version):
         """
         Upgrade the database tables.
         """
-        
+
         if self.persistent:
             yield self._db_upgrade_data_tables(old_version)
             yield self._db_upgrade_schema()
@@ -346,7 +366,8 @@
             # DB upgrades they SHOULD override this method and handle those for better performance.
             yield self._db_remove()
             yield self._db_init()
-    
+
+
     def _db_upgrade_data_tables(self, old_version):
         """
         Upgrade the data from an older version of the DB.
@@ -372,12 +393,14 @@
         yield self._db_remove_data_tables()
         yield self._db_remove_schema()
 
+
     def _db_remove_data_tables(self):
         """
         Remove all the data from an older version of the DB.
         """
         raise NotImplementedError("Each database must remove its own tables.")
 
+
     @inlineCallbacks
     def _db_remove_schema(self):
         """
@@ -385,6 +408,7 @@
         """
         yield self._db_execute("drop table if exists CALDAV")
 
+
     @inlineCallbacks
     def _db_all_values_for_sql(self, sql, *query_params):
         """
@@ -395,11 +419,12 @@
             resulting from executing C{sql} with C{query_params}.
         @raise AssertionError: if the query yields multiple columns.
         """
-        
+
         sql = self._prepare_statement(sql)
         results = (yield self.pool.runQuery(sql, *query_params))
         returnValue(tuple(results))
 
+
     @inlineCallbacks
     def _db_values_for_sql(self, sql, *query_params):
         """
@@ -411,11 +436,12 @@
             resulting from executing C{sql} with C{query_params}.
         @raise AssertionError: if the query yields multiple columns.
         """
-        
+
         sql = self._prepare_statement(sql)
         results = (yield self.pool.runQuery(sql, *query_params))
         returnValue(tuple([row[0] for row in results]))
 
+
     @inlineCallbacks
     def _db_value_for_sql(self, sql, *query_params):
         """
@@ -433,6 +459,7 @@
             value = row
         returnValue(value)
 
+
     def _db_execute(self, sql, *query_params):
         """
         Execute an SQL operation that returns None.
@@ -442,7 +469,7 @@
         @return: an iterable of tuples for each row resulting from executing
             C{sql} with C{query_params}.
         """
-        
+
         sql = self._prepare_statement(sql)
         return self.pool.runOperation(sql, *query_params)
 
@@ -450,37 +477,43 @@
     Since different databases support different types of columns and modifiers on those we need to
     have an "abstract" way of specifying columns in our code and then map the abstract specifiers to
     the underlying DB's allowed types.
-    
+
     Types we can use are:
-    
+
     integer
     text
     text(n)
     date
     serial
-    
+
     The " unique" modifier can be appended to any of those.
     """
     def _map_column_types(self, type):
         raise NotImplementedError
-        
+
+
     def _create_table(self, name, columns, ifnotexists=False):
         raise NotImplementedError
 
+
     def _test_table(self, name):
         raise NotImplementedError
 
+
     def _create_index(self, name, ontable, columns, ifnotexists=False):
         raise NotImplementedError
 
+
     def _prepare_statement(self, sql):
         raise NotImplementedError
-        
+
+
+
 class ADBAPISqliteMixin(object):
 
     @classmethod
     def _map_column_types(self, coltype):
-        
+
         result = ""
         splits = coltype.split()
         if splits[0] == "integer":
@@ -493,15 +526,16 @@
             result = "date"
         elif splits[0] == "serial":
             result = "integer primary key autoincrement"
-        
+
         if len(splits) > 1 and splits[1] == "unique":
             result += " unique"
-        
+
         return result
 
+
     @inlineCallbacks
     def _create_table(self, name, columns, ifnotexists=False):
-        
+
         colDefs = ["%s %s" % (colname, self._map_column_types(coltype)) for colname, coltype in columns]
         statement = "create table %s%s (%s)" % (
             "if not exists " if ifnotexists else "",
@@ -510,6 +544,7 @@
         )
         yield self._db_execute(statement)
 
+
     @inlineCallbacks
     def _test_table(self, name):
         result = (yield self._db_value_for_sql("""
@@ -518,9 +553,10 @@
         """ % (name,)))
         returnValue(result)
 
+
     @inlineCallbacks
     def _create_index(self, name, ontable, columns, ifnotexists=False):
-        
+
         statement = "create index %s%s on %s (%s)" % (
             "if not exists " if ifnotexists else "",
             name,
@@ -529,6 +565,7 @@
         )
         yield self._db_execute(statement)
 
+
     def _prepare_statement(self, sql):
         # We are going to use the sqlite syntax of :1, :2 etc for our
         # internal statements so we do not need to remap those
@@ -537,10 +574,10 @@
 if pgdb:
 
     class ADBAPIPostgreSQLMixin(object):
-        
+
         @classmethod
         def _map_column_types(self, coltype):
-            
+
             result = ""
             splits = coltype.split()
             if splits[0] == "integer":
@@ -553,32 +590,34 @@
                 result = "date"
             elif splits[0] == "serial":
                 result = "serial"
-            
+
             if len(splits) > 1 and splits[1] == "unique":
                 result += " unique"
-            
+
             return result
-    
+
+
         @inlineCallbacks
         def _create_table(self, name, columns, ifnotexists=False):
-            
+
             colDefs = ["%s %s" % (colname, self._map_column_types(coltype)) for colname, coltype in columns]
             statement = "create table %s (%s)" % (
                 name,
                 ", ".join(colDefs),
             )
-            
+
             try:
                 yield self._db_execute(statement)
             except pgdb.DatabaseError:
-                
+
                 if not ifnotexists:
                     raise
-                
+
                 result = (yield self._test_table(name))
                 if not result:
-                    raise 
-    
+                    raise
+
+
         @inlineCallbacks
         def _test_table(self, name):
             result = (yield self._db_value_for_sql("""
@@ -586,27 +625,29 @@
              where tablename = '%s'
             """ % (name.lower(),)))
             returnValue(result)
-    
+
+
         @inlineCallbacks
         def _create_index(self, name, ontable, columns, ifnotexists=False):
-            
+
             statement = "create index %s on %s (%s)" % (
                 name,
                 ontable,
                 ", ".join(columns),
             )
-            
+
             try:
                 yield self._db_execute(statement)
             except pgdb.DatabaseError:
-                
+
                 if not ifnotexists:
                     raise
-                
+
                 result = (yield self._test_table(name))
                 if not result:
-                    raise 
-    
+                    raise
+
+
         @inlineCallbacks
         def _db_init_schema_table(self):
             """
@@ -614,7 +655,7 @@
             @param db_filename: the file name of the index database.
             @param q:           a database cursor to use.
             """
-    
+
             #
             # CALDAV table keeps track of our schema version and type
             #
@@ -623,7 +664,7 @@
                     ("KEY", "text unique"),
                     ("VALUE", "text unique"),
                 ), True)
-    
+
                 yield self._db_execute(
                     """
                     insert into CALDAV (KEY, VALUE)
@@ -638,7 +679,8 @@
                 )
             except pgdb.DatabaseError:
                 pass
-    
+
+
         def _prepare_statement(self, sql):
             # Convert :1, :2 etc format into %s
             ctr = 1
@@ -649,6 +691,6 @@
 
 else:
     class ADBAPIPostgreSQLMixin(object):
-        
+
         def __init__(self):
             raise ConfigurationError("PostgreSQL module not available.")

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/datafilters/calendardata.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/datafilters/calendardata.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/datafilters/calendardata.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -19,7 +19,7 @@
 from twistedcaldav.datafilters.filter import CalendarFilter
 from twistedcaldav.dateops import clipPeriod
 from twistedcaldav.ical import Component
-from pycalendar.period import PyCalendarPeriod
+from pycalendar.period import Period
 
 __all__ = [
     "CalendarDataFilter",
@@ -161,7 +161,7 @@
             for property in component.properties("FREEBUSY"):
                 newvalue = []
                 for period in property.value():
-                    clipped = clipPeriod(period.getValue(), PyCalendarPeriod(self.calendardata.freebusy_set.start, self.calendardata.freebusy_set.end))
+                    clipped = clipPeriod(period.getValue(), Period(self.calendardata.freebusy_set.start, self.calendardata.freebusy_set.end))
                     if clipped:
                         newvalue.append(clipped)
                 if len(newvalue):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/dateops.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/dateops.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/dateops.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -28,9 +28,9 @@
     "clipPeriod"
 ]
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
-from pycalendar.period import PyCalendarPeriod
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
+from pycalendar.period import Period
 
 import datetime
 import dateutil.tz
@@ -39,14 +39,14 @@
 
 def normalizeForIndex(dt):
     """
-    Normalize a L{PyCalendarDateTime} object for use in the Index.
+    Normalize a L{DateTime} object for use in the Index.
     Convert to date-time in UTC.
-    @param dt: a L{PyCalendarDateTime} object to normalize
-    @return: the normalized PyCalendarDateTime
+    @param dt: a L{DateTime} object to normalize
+    @return: the normalized DateTime
     """
-    if not isinstance(dt, PyCalendarDateTime):
-        raise TypeError("%r is not a PyCalendarDateTime instance" % (dt,))
-    
+    if not isinstance(dt, DateTime):
+        raise TypeError("%r is not a DateTime instance" % (dt,))
+
     dt = dt.duplicate()
     if dt.isDateOnly():
         dt.setDateOnly(False)
@@ -59,13 +59,15 @@
         dt.adjustToUTC()
         return dt
 
+
+
 def normalizeToUTC(dt):
     """
-    Normalize a L{PyCalendarDateTime} object to UTC.
+    Normalize a L{DateTime} object to UTC.
     """
-    if not isinstance(dt, PyCalendarDateTime):
-        raise TypeError("%r is not a PyCalendarDateTime instance" % (dt,))
-    
+    if not isinstance(dt, DateTime):
+        raise TypeError("%r is not a DateTime instance" % (dt,))
+
     dt = dt.duplicate()
     if dt.isDateOnly():
         dt.setDateOnly(False)
@@ -79,16 +81,18 @@
         dt.adjustToUTC()
         return dt
 
+
+
 def normalizeForExpand(dt):
     """
-    Normalize a L{PyCalendarDateTime} object for use with the CalDAV expand option.
+    Normalize a L{DateTime} object for use with the CalDAV expand option.
     Convert to date-time in UTC, leave date only and floating alone.
-    @param dt: a L{PyCalendarDateTime} object to normalize
-    @return: the normalized PyCalendarDateTime
+    @param dt: a L{DateTime} object to normalize
+    @return: the normalized DateTime
     """
-    if not isinstance(dt, PyCalendarDateTime):
-        raise TypeError("%r is not a PyCalendarDateTime instance" % (dt,))
-    
+    if not isinstance(dt, DateTime):
+        raise TypeError("%r is not a DateTime instance" % (dt,))
+
     dt = dt.duplicate()
     if dt.isDateOnly() or dt.floating():
         return dt
@@ -96,41 +100,49 @@
         dt.adjustToUTC()
         return dt
 
+
+
 def floatoffset(dt, pytz):
     """
     Apply the timezone offset to the supplied time, then force tz to utc. This gives the local
     date-time as if the local tz were UTC. It can be used in floating time comparisons with UTC date-times.
-    
-    @param dt: a L{PyCalendarDateTime} object to normalize
-    @param pytz: a L{PyCalendarTimezone} object to apply offset from
-    @return: the normalized PyCalendarDateTime
+
+    @param dt: a L{DateTime} object to normalize
+    @param pytz: a L{Timezone} object to apply offset from
+    @return: the normalized DateTime
     """
-    
+
     if pytz is None:
-        pytz = PyCalendarTimezone(utc=True)
-    
+        pytz = Timezone(utc=True)
+
     dt = dt.duplicate()
     dt.adjustTimezone(pytz)
     dt.setTimezoneUTC(True)
     return dt
 
+
+
 def adjustFloatingToTimezone(dtadjust, dtcopyfrom, pytz=None):
-    
+
     dtadjust = dtadjust.duplicate()
     dtadjust.setTimezone(pytz if pytz else dtcopyfrom.getTimezone())
     return dtadjust
 
+
+
 def compareDateTime(dt1, dt2, defaulttz=None):
-    
+
     if dt1.floating() and not dt2.floating():
         dt1 = adjustFloatingToTimezone(dt1, dt2, defaulttz)
     elif dt2.floating() and not dt1.floating():
         dt2 = adjustFloatingToTimezone(dt2, dt1, defaulttz)
-    
+
     return dt1.compareDateTime(dt2)
 
-def differenceDateTime(start, end, defaulttz = None):
 
+
+def differenceDateTime(start, end, defaulttz=None):
+
     if start.floating() and not end.floating():
         start = adjustFloatingToTimezone(start, end, defaulttz)
     elif end.floating() and not start.floating():
@@ -138,13 +150,19 @@
 
     return end - start
 
-def timeRangesOverlap(start1, end1, start2, end2, defaulttz = None):
+
+
+def timeRangesOverlap(start1, end1, start2, end2, defaulttz=None):
     # Can't compare date-time and date only, so normalize
     # to date only if they are mixed.
-    if (start1 is not None) and not start1.isDateOnly() and (start2 is not None) and start2.isDateOnly(): start1.setDateOnly(True)
-    if (start2 is not None) and not start2.isDateOnly() and (start1 is not None) and start1.isDateOnly(): start2.setDateOnly(True)
-    if (end1 is not None) and not end1.isDateOnly() and (end2 is not None) and end2.isDateOnly(): end1.setDateOnly(True)
-    if (end2 is not None) and not end2.isDateOnly() and (end1 is not None) and end1.isDateOnly(): end2.setDateOnly(True)
+    if (start1 is not None) and not start1.isDateOnly() and (start2 is not None) and start2.isDateOnly():
+        start1.setDateOnly(True)
+    if (start2 is not None) and not start2.isDateOnly() and (start1 is not None) and start1.isDateOnly():
+        start2.setDateOnly(True)
+    if (end1 is not None) and not end1.isDateOnly() and (end2 is not None) and end2.isDateOnly():
+        end1.setDateOnly(True)
+    if (end2 is not None) and not end2.isDateOnly() and (end1 is not None) and end1.isDateOnly():
+        end2.setDateOnly(True)
 
     # Note that start times are inclusive and end times are not.
     if start1 is not None and start2 is not None:
@@ -163,40 +181,41 @@
     else:
         return False
 
+
+
 def normalizePeriodList(periods):
     """
     Normalize the list of periods by merging overlapping or consecutive ranges
     and sorting the list by each periods start.
-    @param list: a list of tuples of L{PyCalendarPeriod}. The list is changed in place.
+    @param list: a list of tuples of L{Period}. The list is changed in place.
     """
-    
+
     # First sort the list
     def sortPeriods(p1, p2):
         """
         Compare two periods. Sort by their start and then end times.
-        A period is a L{PyCalendarPeriod}.
+        A period is a L{Period}.
         @param p1: first period
         @param p2: second period
         @return: 1 if p1>p2, 0 if p1==p2, -1 if p1<p2
         """
 
-        assert isinstance(p1, PyCalendarPeriod), "Period is not a PyCalendarPeriod: %r" % (p1,)
-        assert isinstance(p2, PyCalendarPeriod), "Period is not a PyCalendarPeriod: %r" % (p2,)
-        
-        
+        assert isinstance(p1, Period), "Period is not a Period: %r" % (p1,)
+        assert isinstance(p2, Period), "Period is not a Period: %r" % (p2,)
+
         if p1.getStart() == p2.getStart():
             cmp1 = p1.getEnd()
             cmp2 = p2.getEnd()
         else:
             cmp1 = p1.getStart()
             cmp2 = p2.getStart()
-        
+
         return compareDateTime(cmp1, cmp2)
 
     for period in periods:
         period.adjustToUTC()
     periods.sort(cmp=sortPeriods)
-    
+
     # Now merge overlaps and consecutive periods
     index = None
     p = None
@@ -210,15 +229,17 @@
         ie = periods[i].getEnd()
         if (pe >= periods[i].getStart()):
             if ie > pe:
-                periods[index] = PyCalendarPeriod(periods[index].getStart(), ie)
+                periods[index] = Period(periods[index].getStart(), ie)
                 pe = ie
             periods[i] = None
         else:
             index = i
             p = periods[i]
-            pe =p.getEnd()
+            pe = p.getEnd()
     periods[:] = [x for x in periods if x]
 
+
+
 def clipPeriod(period, clipPeriod):
     """
     Clip the start/end period so that it lies entirely within the clip period.
@@ -234,20 +255,22 @@
 
     if start < clipStart:
         start = clipStart
-    
+
     if end > clipEnd:
         end = clipEnd
-    
+
     if start >= end:
         return None
     else:
         # Try to preserve use of duration in period
-        result = PyCalendarPeriod(start, end)
+        result = Period(start, end)
         result.setUseDuration(period.getUseDuration())
         return result
 
+
+
 def pyCalendarTodatetime(pydt):
-    
+
     if pydt.isDateOnly():
         return datetime.date(year=pydt.getYear(), month=pydt.getMonth(), day=pydt.getDay())
     else:
@@ -261,17 +284,19 @@
             tzinfo=dateutil.tz.tzutc()
         )
 
+
+
 def parseSQLTimestampToPyCalendar(ts):
     """
-    Parse an SQL formated timestamp into a PyCalendarDateTime
+    Parse an SQL formated timestamp into a DateTime
     @param ts: the SQL timestamp
     @type ts: C{str}
-    
-    @return: L{PyCalendarDateTime} result
+
+    @return: L{DateTime} result
     """
-    
+
     # Format is "%Y-%m-%d %H:%M:%S"
-    return PyCalendarDateTime(
+    return DateTime(
         year=int(ts[0:4]),
         month=int(ts[5:7]),
         day=int(ts[8:10]),
@@ -280,22 +305,26 @@
         seconds=int(ts[17:19])
     )
 
+
+
 def parseSQLDateToPyCalendar(ts):
     """
-    Parse an SQL formated date into a PyCalendarDateTime
+    Parse an SQL formated date into a DateTime
     @param ts: the SQL date
     @type ts: C{str}
-    
-    @return: L{PyCalendarDateTime} result
+
+    @return: L{DateTime} result
     """
-    
+
     # Format is "%Y-%m-%d", though Oracle may add zero time which we ignore
-    return PyCalendarDateTime(
+    return DateTime(
         year=int(ts[0:4]),
         month=int(ts[5:7]),
         day=int(ts[8:10])
     )
 
+
+
 def datetimeMktime(dt):
 
     assert isinstance(dt, datetime.date)
@@ -303,4 +332,3 @@
     if dt.tzinfo is None:
         dt.replace(tzinfo=dateutil.tz.tzutc())
     return calendar.timegm(dt.utctimetuple())
-

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/addressbook.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/addressbook.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/addressbook.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -56,6 +56,8 @@
             + config.CalDAVComplianceClasses
         )
 
+
+
 class DirectoryAddressBookProvisioningResource (
     ReadOnlyResourceMixIn,
     CalDAVComplianceMixIn,
@@ -65,18 +67,21 @@
     def defaultAccessControlList(self):
         return config.ProvisioningResourceACL
 
+
     def etag(self):
         return succeed(ETag(str(uuid4())))
 
+
     def contentType(self):
         return MimeType("httpd", "unix-directory")
 
 
+
 class DirectoryAddressBookHomeProvisioningResource (
         DirectoryAddressBookProvisioningResource
     ):
     """
-    Resource which provisions address book home collections as needed.    
+    Resource which provisions address book home collections as needed.
     """
     def __init__(self, directory, url, store):
         """
@@ -103,22 +108,27 @@
 
         self.putChild(uidsResourceName, DirectoryAddressBookHomeUIDProvisioningResource(self))
 
+
     def url(self):
         return self._url
 
+
     def listChildren(self):
         return self.directory.recordTypes()
 
+
     def principalCollections(self):
         # FIXME: directory.principalCollection smells like a hack
         # See DirectoryPrincipalProvisioningResource.__init__()
         return self.directory.principalCollection.principalCollections()
 
+
     def principalForRecord(self, record):
         # FIXME: directory.principalCollection smells like a hack
         # See DirectoryPrincipalProvisioningResource.__init__()
         return self.directory.principalCollection.principalForRecord(record)
 
+
     def homeForDirectoryRecord(self, record, request):
         uidResource = self.getChild(uidsResourceName)
         if uidResource is None:
@@ -126,17 +136,20 @@
         else:
             return uidResource.homeResourceForRecord(record, request)
 
+
     ##
     # DAV
     ##
-    
+
     def isCollection(self):
         return True
 
+
     def displayName(self):
         return "addressbooks"
 
 
+
 class DirectoryAddressBookHomeTypeProvisioningResource (
         CommonHomeTypeProvisioningResource,
         DirectoryAddressBookProvisioningResource
@@ -159,6 +172,7 @@
         self.recordType = recordType
         self._parent = parent
 
+
     def url(self):
         return joinURL(self._parent.url(), self.recordType)
 
@@ -177,16 +191,19 @@
             # Not a listable collection
             raise HTTPError(responsecode.FORBIDDEN)
 
+
     def makeChild(self, name):
         return None
 
+
     ##
     # DAV
     ##
-    
+
     def isCollection(self):
         return True
 
+
     def displayName(self):
         return self.recordType
 
@@ -194,13 +211,16 @@
     # ACL
     ##
 
+
     def principalCollections(self):
         return self._parent.principalCollections()
 
+
     def principalForRecord(self, record):
         return self._parent.principalForRecord(record)
 
 
+
 class DirectoryAddressBookHomeUIDProvisioningResource (
         CommonUIDProvisioningResource,
         DirectoryAddressBookProvisioningResource
@@ -210,11 +230,13 @@
 
     enabledAttribute = 'enabledForAddressBooks'
 
+
     def homeResourceCreator(self, record, transaction):
         return DirectoryAddressBookHomeResource.createHomeResource(
             self, record, transaction)
 
 
+
 class DirectoryAddressBookHomeResource (AddressBookHomeResource):
     """
     Address book home collection resource.

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/opendirectorybacker.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/opendirectorybacker.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -35,9 +35,9 @@
 from tempfile import mkstemp, gettempdir
 from random import random
 
-from pycalendar.n import N
-from pycalendar.adr import Adr
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.vcard.n import N
+from pycalendar.vcard.adr import Adr
+from pycalendar.datetime import DateTime
 
 from socket import getfqdn
 
@@ -1494,7 +1494,7 @@
 
             birthdate = self.isoDateStringForDateAttribute(dsattributes.kDS1AttrBirthday)
             if birthdate:
-                vcard.addProperty(Property("BDAY", PyCalendarDateTime.parseText(birthdate, fullISO=True)))
+                vcard.addProperty(Property("BDAY", DateTime.parseText(birthdate, fullISO=True)))
 
             # 3.2 Delivery Addressing Types http://tools.ietf.org/html/rfc2426#section-3.2
             #
@@ -1685,7 +1685,7 @@
             # 3.6.4 REV Type Definition
             revDate = self.isoDateStringForDateAttribute(dsattributes.kDS1AttrModificationTimestamp)
             if revDate:
-                vcard.addProperty(Property("REV", PyCalendarDateTime.parseText(revDate, fullISO=True)))
+                vcard.addProperty(Property("REV", DateTime.parseText(revDate, fullISO=True)))
 
             """
             # UNIMPLEMENTED:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_aggregate.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_aggregate.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_aggregate.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -36,7 +36,8 @@
                 recordTypes.add(prefix + recordType)
         return recordTypes
 
-    def _records(key):
+
+    def _records(key): #@NoSelf
         def get(self):
             records = {}
             for prefix, testClass in testServices:
@@ -58,6 +59,7 @@
 
     recordTypePrefixes = tuple(s[0] for s in testServices)
 
+
     def service(self):
         """
         Returns an IDirectoryService.
@@ -71,9 +73,9 @@
         )
         xmlService.recordTypePrefix = xml_prefix
 
-
         return AggregateDirectoryService((xmlService,), None)
 
+
     def test_setRealm(self):
         """
         setRealm gets propagated to nested services
@@ -82,4 +84,3 @@
         aggregatedService.setRealm("foo.example.com")
         for service in aggregatedService._recordTypes.values():
             self.assertEquals("foo.example.com", service.realmName)
-

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_augment.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_augment.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -15,7 +15,7 @@
 ##
 
 from twistedcaldav.test.util import TestCase
-from twistedcaldav.directory.augment import AugmentXMLDB, AugmentSqliteDB,\
+from twistedcaldav.directory.augment import AugmentXMLDB, AugmentSqliteDB, \
     AugmentPostgreSQLDB, AugmentRecord
 from twistedcaldav.directory.directory import DirectoryService
 from twisted.internet.defer import inlineCallbacks
@@ -32,46 +32,46 @@
 xmlFileNormalization = os.path.join(os.path.dirname(__file__), "augments-normalization.xml")
 
 testRecords = (
-    {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "enabled":True,  "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"6423F94A-6B76-4A3A-815B-D52CFD77935D", "enabled":True,  "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"5A985493-EE2C-4665-94CF-4DFEA3A89500", "enabled":False, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "enabled":True,  "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "enabled":True,  "partitionID":"00001", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"543D28BA-F74F-4D5F-9243-B3E3A61171E5", "enabled":True,  "partitionID":"00002", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"6A73326A-F781-47E7-A9F8-AF47364D4152", "enabled":True,  "partitionID":"00002", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"default"},
-    {"uid":"C5BAADEE-6B35-4FD5-A98A-5DF6BBAAC47A", "enabled":True,  "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"default"},
-    {"uid":"8AB34DF9-0297-4BA3-AADB-DB557DDD21E7", "enabled":True,  "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"accept-always"},
-    {"uid":"FC674703-8008-4A77-B80E-0DB55A9CE620", "enabledForLogin":False,}, # Explicitly false
-    {"uid":"B473DC32-1B0D-45EE-9BAC-DA878AE9CE74", "enabledForLogin":True,}, # Explicitly True
-    {"uid":"9F2B176D-B3F5-483A-AA63-0A1FC6E6D54B", "enabledForLogin":True,}, # Default is True
+    {"uid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "enabled": True, "partitionID": "", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "6423F94A-6B76-4A3A-815B-D52CFD77935D", "enabled": True, "partitionID": "", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "5A985493-EE2C-4665-94CF-4DFEA3A89500", "enabled": False, "partitionID": "", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "enabled": True, "partitionID": "", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "enabled": True, "partitionID": "00001", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "543D28BA-F74F-4D5F-9243-B3E3A61171E5", "enabled": True, "partitionID": "00002", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "6A73326A-F781-47E7-A9F8-AF47364D4152", "enabled": True, "partitionID": "00002", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "default"},
+    {"uid": "C5BAADEE-6B35-4FD5-A98A-5DF6BBAAC47A", "enabled": True, "partitionID": "", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "default"},
+    {"uid": "8AB34DF9-0297-4BA3-AADB-DB557DDD21E7", "enabled": True, "partitionID": "", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "accept-always"},
+    {"uid": "FC674703-8008-4A77-B80E-0DB55A9CE620", "enabledForLogin": False, }, # Explicitly false
+    {"uid": "B473DC32-1B0D-45EE-9BAC-DA878AE9CE74", "enabledForLogin": True, }, # Explicitly True
+    {"uid": "9F2B176D-B3F5-483A-AA63-0A1FC6E6D54B", "enabledForLogin": True, }, # Default is True
 )
 
 testRecordWildcardDefault = (
-    {"uid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True,  "partitionID":"00001", "enabledForCalendaring":True,  "enabledForAddressBooks":True,  "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"AA5F935F-3358-4510-A649-B391D63279F2", "enabled":True,  "partitionID":"00001", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"ABF1A83B-1A29-4E04-BDC3-A6A66ECF27CA", "enabled":False, "partitionID":"",      "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"BC22A734-5E41-4FB7-B5C1-51DC0656DC2F", "enabled":True,  "partitionID":"00002", "enabledForCalendaring":True,  "enabledForAddressBooks":True,  "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"C6DEEBB1-E14A-47F2-98BA-7E3BB4353E3A", "enabled":True,  "partitionID":"00003", "enabledForCalendaring":True,  "enabledForAddressBooks":True,  "autoSchedule":True,  "autoScheduleMode":"accept-always"},
-    {"uid":"AA859321-2C72-4974-ADCF-0CBA0C76F95D", "enabled":True,  "partitionID":"00001", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"AB7C488B-9ED2-4265-881C-7E2E38A63584", "enabled":False, "partitionID":"",      "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"BB0C0DA1-0545-45F6-8D08-917C554D93A4", "enabled":True,  "partitionID":"00002", "enabledForCalendaring":True,  "enabledForAddressBooks":True,  "autoSchedule":False, "autoScheduleMode":"default"},
-    {"uid":"CCD30AD3-582F-4682-8B65-2EDE92C5656E", "enabled":True,  "partitionID":"00003", "enabledForCalendaring":True,  "enabledForAddressBooks":True,  "autoSchedule":True,  "autoScheduleMode":"accept-always"},
+    {"uid": "A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled": True, "partitionID": "00001", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "AA5F935F-3358-4510-A649-B391D63279F2", "enabled": True, "partitionID": "00001", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "ABF1A83B-1A29-4E04-BDC3-A6A66ECF27CA", "enabled": False, "partitionID": "", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "BC22A734-5E41-4FB7-B5C1-51DC0656DC2F", "enabled": True, "partitionID": "00002", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "C6DEEBB1-E14A-47F2-98BA-7E3BB4353E3A", "enabled": True, "partitionID": "00003", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "accept-always"},
+    {"uid": "AA859321-2C72-4974-ADCF-0CBA0C76F95D", "enabled": True, "partitionID": "00001", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "AB7C488B-9ED2-4265-881C-7E2E38A63584", "enabled": False, "partitionID": "", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "BB0C0DA1-0545-45F6-8D08-917C554D93A4", "enabled": True, "partitionID": "00002", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+    {"uid": "CCD30AD3-582F-4682-8B65-2EDE92C5656E", "enabled": True, "partitionID": "00003", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "accept-always"},
 )
 
 testRecordTypeDefault = (
-    ("locations", {"uid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True,  "partitionID":"00004", "enabledForCalendaring":True,  "enabledForAddressBooks":False,  "autoSchedule":True, "autoScheduleMode":"default"}),
-    ("locations", {"uid":"AA5F935F-3358-4510-A649-B391D63279F2", "enabled":True,  "partitionID":"00005", "enabledForCalendaring":True, "enabledForAddressBooks":False, "autoSchedule":True, "autoScheduleMode":"default"}),
-    ("resources", {"uid":"A5318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True,  "partitionID":"00006", "enabledForCalendaring":True,  "enabledForAddressBooks":False,  "autoSchedule":True, "autoScheduleMode":"default"}),
-    ("resources", {"uid":"AA6F935F-3358-4510-A649-B391D63279F2", "enabled":True,  "partitionID":"00007", "enabledForCalendaring":True, "enabledForAddressBooks":False, "autoSchedule":True, "autoScheduleMode":"default"}),
+    ("locations", {"uid": "A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled": True, "partitionID": "00004", "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
+    ("locations", {"uid": "AA5F935F-3358-4510-A649-B391D63279F2", "enabled": True, "partitionID": "00005", "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
+    ("resources", {"uid": "A5318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled": True, "partitionID": "00006", "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
+    ("resources", {"uid": "AA6F935F-3358-4510-A649-B391D63279F2", "enabled": True, "partitionID": "00007", "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
 )
 
 
 testAddRecords = (
-    {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled":True,  "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
+    {"uid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled": True, "partitionID": "", "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
 )
 
 testModifyRecords = (
-    {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled":True,  "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
+    {"uid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled": True, "partitionID": "", "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
 )
 
 
@@ -79,27 +79,31 @@
 
     @inlineCallbacks
     def _checkRecord(self, db, items, recordType=DirectoryService.recordType_users):
-        
+
         record = (yield db.getAugmentRecord(items["uid"], recordType))
         self.assertTrue(record is not None, "Failed record uid: %s" % (items["uid"],))
-        
-        for k,v in items.iteritems():
-            self.assertEqual(getattr(record, k), v, "Failed record uid: %s, attribute: %s" % (items["uid"], k, ))
 
+        for k, v in items.iteritems():
+            self.assertEqual(getattr(record, k), v, "Failed record uid: %s, attribute: %s" % (items["uid"], k,))
+
+
     @inlineCallbacks
     def _checkRecordExists(self, db, uid, recordType=DirectoryService.recordType_users):
-        
+
         record = (yield db.getAugmentRecord(uid, recordType))
         self.assertTrue(record is not None, "Failed record uid: %s" % (uid,))
 
+
+
 class AugmentTestsMixin(object):
 
     def _db(self, dbpath=None):
         raise NotImplementedError
 
+
     @inlineCallbacks
     def test_read(self):
-        
+
         dbpath = os.path.abspath(self.mktemp())
         db = self._db(dbpath)
 
@@ -113,9 +117,10 @@
         # in the DB
         yield self._checkRecordExists(db, "D11F03A0-97EA-48AF-9A6C-FAC7F3975767")
 
+
     @inlineCallbacks
     def test_read_default(self):
-        
+
         dbpath = os.path.abspath(self.mktemp())
         db = self._db(dbpath)
 
@@ -132,6 +137,7 @@
         for item in testRecordWildcardDefault:
             yield self._checkRecord(db, item)
 
+
     @inlineCallbacks
     def test_read_typed_default(self):
         """
@@ -159,7 +165,7 @@
 
     @inlineCallbacks
     def test_add_modify(self):
-        
+
         dbpath = os.path.abspath(self.mktemp())
         db = self._db(dbpath)
 
@@ -195,11 +201,13 @@
             yield self._checkRecord(newdb, item)
         yield self._checkRecord(newdb, testModifyRecords[0])
 
+
+
 class AugmentXMLTests(AugmentTests):
 
     @inlineCallbacks
     def test_read(self):
-        
+
         db = AugmentXMLDB((xmlFile,))
 
         for item in testRecords:
@@ -209,9 +217,10 @@
         # in the DB
         yield self._checkRecordExists(db, "D11F03A0-97EA-48AF-9A6C-FAC7F3975767")
 
+
     @inlineCallbacks
     def test_read_default(self):
-        
+
         db = AugmentXMLDB((xmlFileDefault,))
 
         for item in testRecords:
@@ -220,8 +229,9 @@
         for item in testRecordWildcardDefault:
             yield self._checkRecord(db, item)
 
+
     def test_parseErrors(self):
-        
+
         db = {}
         self.assertRaises(RuntimeError, XMLAugmentsParser, cStringIO.StringIO(""), db)
         self.assertRaises(RuntimeError, XMLAugmentsParser, cStringIO.StringIO("""<?xml version="1.0" encoding="utf-8"?>
@@ -249,13 +259,14 @@
   </record>
 """), db)
 
+
     @inlineCallbacks
     def test_add_modify(self):
-        
+
         # Duplicate file as we will change it
         newxmlfile = FilePath(self.mktemp())
         FilePath(xmlFile).copyTo(newxmlfile)
-        
+
         db = AugmentXMLDB((newxmlfile.path,))
 
         for item in testRecords:
@@ -283,6 +294,7 @@
             yield self._checkRecord(newdb, item)
         yield self._checkRecord(newdb, testModifyRecords[0])
 
+
     def test_shouldReparse(self):
         """
         Verify that a change to the file will get noticed
@@ -294,6 +306,7 @@
         newxmlfile.setContent("") # Change the file
         self.assertTrue(db._shouldReparse([newxmlfile.path])) # Need to parse
 
+
     def test_refresh(self):
         """
         Ensure that a refresh without any file changes doesn't zero out the
@@ -304,6 +317,7 @@
         dbxml.refresh()
         self.assertEquals(keys, dbxml.db.keys())
 
+
     def uidsFromFile(self, filename):
         """
         Return all uids from the augments xml file
@@ -316,6 +330,7 @@
             uid = record_node.find(xmlaugmentsparser.ELEMENT_UID).text
             yield uid
 
+
     def test_normalize(self):
         """
         Ensure augment uids are normalized upon opening
@@ -328,11 +343,15 @@
         uids = list(self.uidsFromFile(newxmlfile.path))
         self.assertEquals(uids, ['AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA'])
 
+
+
 class AugmentSqliteTests(AugmentTests, AugmentTestsMixin):
 
     def _db(self, dbpath=None):
         return AugmentSqliteDB(dbpath if dbpath else os.path.abspath(self.mktemp()))
 
+
+
 class AugmentPostgreSQLTests(AugmentTests, AugmentTestsMixin):
 
     def _db(self, dbpath=None):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_cachedirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_cachedirectory.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_cachedirectory.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -38,6 +38,7 @@
             DirectoryService.recordType_resources,
         )
 
+
     def queryDirectory(self, recordTypes, indexType, indexKey):
 
         self.queried = True
@@ -58,42 +59,47 @@
 
                 if cacheIt:
                     cacheRecord = CachingDirectoryRecord(
-                        service               = self,
-                        recordType            = recordType,
-                        guid                  = record.get("guid"),
-                        shortNames            = record.get("shortname"),
-                        authIDs               = record.get("authid"),
-                        fullName              = record.get("fullName"),
-                        firstName             = "",
-                        lastName              = "",
-                        emailAddresses        = record.get("email"),
-                    ) 
-                    
+                        service=self,
+                        recordType=recordType,
+                        guid=record.get("guid"),
+                        shortNames=record.get("shortname"),
+                        authIDs=record.get("authid"),
+                        fullName=record.get("fullName"),
+                        firstName="",
+                        lastName="",
+                        emailAddresses=record.get("email"),
+                    )
+
                     augmentRecord = AugmentRecord(
-                        uid = cacheRecord.guid,
+                        uid=cacheRecord.guid,
                         enabled=True,
-                        enabledForCalendaring = True,
+                        enabledForCalendaring=True,
                     )
-                    
+
                     cacheRecord.addAugmentInformation(augmentRecord)
 
                     self.recordCacheForType(recordType).addRecord(cacheRecord,
                         indexType, indexKey)
 
+
+
 class CachingDirectoryTest(TestCase):
-    
+
     baseGUID = str(uuid4())
 
+
     def setUp(self):
         super(CachingDirectoryTest, self).setUp()
         self.service = TestDirectoryService()
         self.service.queried = False
 
+
     def loadRecords(self, records):
         self.service._initCaches()
         self.service.fakerecords = records
         self.service.queried = False
 
+
     def fakeRecord(
         self,
         fullName,
@@ -109,15 +115,15 @@
             shortNames = (self.shortNameForFullName(fullName),)
             if multinames:
                 shortNames += (fullName,)
-    
+
         if guid is None:
             guid = self.guidForShortName(shortNames[0], recordType=recordType)
         else:
             guid = guid.lower()
-    
+
         if emails is None:
             emails = ("%s at example.com" % (shortNames[0],),)
-    
+
         attrs = {
             "fullName": fullName,
             "guid": guid,
@@ -126,35 +132,38 @@
             "cua": tuple(["mailto:%s" % email for email in emails]),
             "authid": tuple(["Kerberos:%s" % email for email in emails])
         }
-        
+
         if members:
             attrs["members"] = members
-    
+
         if resourceInfo:
             attrs["resourceInfo"] = resourceInfo
-    
+
         return attrs
-    
+
+
     def shortNameForFullName(self, fullName):
         return fullName.lower().replace(" ", "")
-    
+
+
     def guidForShortName(self, shortName, recordType=""):
         return uuidFromName(self.baseGUID, "%s%s" % (recordType, shortName))
 
+
     def dummyRecords(self):
         SIZE = 10
         records = {
             DirectoryService.recordType_users: [
-                self.fakeRecord("User %02d" % x, DirectoryService.recordType_users, multinames=(x>5)) for x in range(1,SIZE+1)
+                self.fakeRecord("User %02d" % x, DirectoryService.recordType_users, multinames=(x > 5)) for x in range(1, SIZE + 1)
             ],
             DirectoryService.recordType_groups: [
-                self.fakeRecord("Group %02d" % x, DirectoryService.recordType_groups) for x in range(1,SIZE+1)
+                self.fakeRecord("Group %02d" % x, DirectoryService.recordType_groups) for x in range(1, SIZE + 1)
             ],
             DirectoryService.recordType_resources: [
-                self.fakeRecord("Resource %02d" % x, DirectoryService.recordType_resources) for x in range(1,SIZE+1)
+                self.fakeRecord("Resource %02d" % x, DirectoryService.recordType_resources) for x in range(1, SIZE + 1)
             ],
             DirectoryService.recordType_locations: [
-                self.fakeRecord("Location %02d" % x, DirectoryService.recordType_locations) for x in range(1,SIZE+1)
+                self.fakeRecord("Location %02d" % x, DirectoryService.recordType_locations) for x in range(1, SIZE + 1)
             ],
         }
         # Add duplicate shortnames
@@ -165,14 +174,17 @@
 
         self.loadRecords(records)
 
+
     def verifyRecords(self, recordType, expectedGUIDs):
-        
+
         records = self.service.listRecords(recordType)
         recordGUIDs = set([record.guid for record in records])
         self.assertEqual(recordGUIDs, expectedGUIDs)
 
+
+
 class GUIDLookups(CachingDirectoryTest):
-    
+
     def test_emptylist(self):
         self.dummyRecords()
 
@@ -180,7 +192,8 @@
         self.verifyRecords(DirectoryService.recordType_groups, set())
         self.verifyRecords(DirectoryService.recordType_resources, set())
         self.verifyRecords(DirectoryService.recordType_locations, set())
-    
+
+
     def test_cacheoneguid(self):
         self.dummyRecords()
 
@@ -200,7 +213,8 @@
 
         # Make sure guid is case-insensitive
         self.assertTrue(self.service.recordWithGUID(self.guidForShortName("user01", recordType=DirectoryService.recordType_users).lower()) is not None)
-        
+
+
     def test_cacheoneshortname(self):
         self.dummyRecords()
 
@@ -224,6 +238,7 @@
         ) is not None)
         self.assertFalse(self.service.queried)
 
+
     def test_cacheoneemail(self):
         self.dummyRecords()
 
@@ -245,6 +260,7 @@
         ) is not None)
         self.assertFalse(self.service.queried)
 
+
     def test_cacheonePrincipalsURLWithUIDS(self):
         self.dummyRecords()
 
@@ -267,6 +283,7 @@
         ) is not None)
         self.assertFalse(self.service.queried)
 
+
     def test_cacheonePrincipalsURLWithUsers(self):
         self.dummyRecords()
 
@@ -288,6 +305,7 @@
         ) is not None)
         self.assertFalse(self.service.queried)
 
+
     def test_cacheoneauthid(self):
         self.dummyRecords()
 
@@ -309,6 +327,7 @@
         ) is not None)
         self.assertFalse(self.service.queried)
 
+
     def test_negativeCaching(self):
         self.dummyRecords()
 
@@ -324,7 +343,6 @@
         self.assertEquals(self.service.recordWithGUID(self.guidForShortName("missing")), None)
         self.assertTrue(self.service.queried)
 
-
         # However, if negativeCaching is on, a miss is recorded as such,
         # preventing a similar queryDirectory( ) until cacheTimeout passes
         self.service.negativeCaching = True
@@ -345,6 +363,7 @@
         self.assertEquals(self.service.recordWithGUID(self.guidForShortName("missing")), None)
         self.assertTrue(self.service.queried)
 
+
     def test_duplicateShortNames(self):
         """
         Verify that when looking up records having duplicate short-names, the record of the
@@ -370,6 +389,7 @@
             "Duplicate")
         self.assertEquals(record.recordType, DirectoryService.recordType_locations)
 
+
     def test_generateMemcacheKey(self):
         """
         Verify keys are correctly generated based on the index type -- if index type is

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_digest.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_digest.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_digest.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -55,7 +55,7 @@
 challengeResponse = ('digest',
                      {'nonce': challengeNonce,
                       'qop': 'auth', 'realm': 'test realm',
-                      'algorithm': 'md5',})
+                      'algorithm': 'md5', })
 
 cnonce = "29fc54aa1641c6fa0e151419361c8f23"
 
@@ -116,6 +116,7 @@
                                           self.namespace2
                                       ))
 
+
     def getDigestResponse(self, challenge, ncount):
         """
         Calculate the response for the given challenge
@@ -146,6 +147,7 @@
                 )
         return expected
 
+
     def getDigestResponseComma(self, challenge, ncount):
         """
         Calculate the response for the given challenge
@@ -176,6 +178,7 @@
                 )
         return expected
 
+
     @inlineCallbacks
     def assertRaisesDeferred(self, exception, f, *args, **kwargs):
         try:
@@ -191,6 +194,7 @@
             raise self.failureException('%s not raised (%r returned)'
                                         % (exception.__name__, result))
 
+
     @inlineCallbacks
     def test_getChallenge(self):
         """
@@ -203,14 +207,15 @@
         self.assertEquals(challenge['qop'], 'auth')
         self.assertEquals(challenge['realm'], 'test realm')
         self.assertEquals(challenge['algorithm'], 'md5')
-        self.assertTrue(challenge.has_key("nonce"))
+        self.assertTrue("nonce" in challenge)
 
         challenge = (yield self.credentialFactories[1].getChallenge(clientAddress))
-        self.assertFalse(challenge.has_key('qop'))
+        self.assertFalse('qop' in challenge)
         self.assertEquals(challenge['realm'], 'test realm')
         self.assertEquals(challenge['algorithm'], 'md5')
-        self.assertTrue(challenge.has_key("nonce"))
+        self.assertTrue("nonce" in challenge)
 
+
     @inlineCallbacks
     def test_response(self):
         """
@@ -219,15 +224,16 @@
 
         for ctr, factory in enumerate(self.credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
             self.failUnless(creds.checkPassword('password'))
 
+
     @inlineCallbacks
     def test_multiResponse(self):
         """
@@ -237,23 +243,24 @@
 
         for ctr, factory in enumerate(self.credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
             self.failUnless(creds.checkPassword('password'))
-    
+
             clientResponse = authRequest2[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000002"),
             )
-    
+
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
             self.failUnless(creds.checkPassword('password'))
 
+
     @inlineCallbacks
     def test_failsWithDifferentMethod(self):
         """
@@ -263,16 +270,17 @@
 
         for ctr, factory in enumerate(self.credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             creds = (yield factory.decode(clientResponse,
                                                   SimpleRequest(None, 'POST', '/')))
             self.failIf(creds.checkPassword('password'))
 
+
     @inlineCallbacks
     def test_noUsername(self):
         """
@@ -287,7 +295,7 @@
                                   namelessAuthRequest,
                                   _trivial_GET()))
             self.assertEquals(str(e), "Invalid response, no username given.")
-    
+
             # Check for an empty username
             e = (yield self.assertRaisesDeferred(error.LoginFailed,
                                   factory.decode,
@@ -295,6 +303,7 @@
                                   _trivial_GET()))
             self.assertEquals(str(e), "Invalid response, no username given.")
 
+
     @inlineCallbacks
     def test_noNonce(self):
         """
@@ -308,6 +317,7 @@
                                   _trivial_GET()))
             self.assertEquals(str(e), "Invalid response, no nonce given.")
 
+
     @inlineCallbacks
     def test_emptyAttribute(self):
         """
@@ -323,6 +333,7 @@
                                   _trivial_GET()))
             self.assertEquals(str(e), "Invalid response, no username given.")
 
+
     @inlineCallbacks
     def test_checkHash(self):
         """
@@ -332,20 +343,21 @@
 
         for ctr, factory in enumerate(self.credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
-    
+
             self.failUnless(creds.checkHash(
                     md5('username:test realm:password').hexdigest()))
-    
+
             self.failIf(creds.checkHash(
                     md5('username:test realm:bogus').hexdigest()))
 
+
     @inlineCallbacks
     def test_invalidNonceCount(self):
         """
@@ -359,20 +371,20 @@
 
         for ctr, factory in enumerate(credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse1 = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             clientResponse2 = authRequest2[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000002"),
             )
-    
+
             yield factory.decode(clientResponse1, _trivial_GET())
             yield factory.decode(clientResponse2, _trivial_GET())
-    
+
             if challenge.get('qop') is not None:
                 yield self.assertRaisesDeferred(
                     error.LoginFailed,
@@ -380,7 +392,7 @@
                     clientResponse2,
                     _trivial_GET()
                 )
-                
+
                 challenge = (yield factory.getChallenge(clientAddress))
 
                 clientResponse1 = authRequest1[ctr] % (
@@ -400,6 +412,7 @@
                     _trivial_GET()
                 )
 
+
     @inlineCallbacks
     def test_invalidNonce(self):
         """
@@ -415,12 +428,12 @@
         for ctr, factory in enumerate(credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
             challenge['nonce'] = "noNoncense"
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             request = _trivial_GET()
             yield self.assertRaisesDeferred(
                 error.LoginFailed,
@@ -431,11 +444,12 @@
 
             factory._invalidate(FAKE_STATIC_NONCE)
             response = (yield UnauthorizedResponse.makeResponse(
-                {"Digest":factory},
+                {"Digest": factory},
                 request.remoteAddr
             ))
             response.headers.getHeader("www-authenticate")[0][1]
 
+
     @inlineCallbacks
     def test_oldNonce(self):
         """
@@ -452,12 +466,12 @@
             challenge = (yield factory.getChallenge(clientAddress))
             nonce_count, timestamp = (yield factory.db.get(challenge['nonce']))
             factory.db.set(challenge['nonce'], (nonce_count, timestamp - 2 * digest.DigestCredentialFactory.CHALLENGE_LIFETIME_SECS))
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             request = _trivial_GET()
             yield self.assertRaisesDeferred(
                 error.LoginFailed,
@@ -465,15 +479,16 @@
                 clientResponse,
                 request
             )
-            
+
             response = (yield UnauthorizedResponse.makeResponse(
-                {"Digest":factory},
+                {"Digest": factory},
                 request.remoteAddr,
             ))
             wwwhdrs = response.headers.getHeader("www-authenticate")[0][1]
             self.assertTrue('stale' in wwwhdrs, msg="No stale parameter in Digest WWW-Authenticate headers: %s" % (wwwhdrs,))
             self.assertEquals(wwwhdrs['stale'], 'true', msg="stale parameter not set to true in Digest WWW-Authenticate headers: %s" % (wwwhdrs,))
 
+
     def test_incompatibleCalcHA1Options(self):
         """
         Test that the appropriate error is raised when any of the
@@ -500,6 +515,7 @@
                 preHA1=preHA1
                 )
 
+
     @inlineCallbacks
     def test_commaURI(self):
         """
@@ -508,15 +524,16 @@
 
         for ctr, factory in enumerate(self.credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse = authRequestComma[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponseComma(challenge, "00000001"),
             )
-    
+
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
             self.failUnless(creds.checkPassword('password'))
 
+
     @inlineCallbacks
     def test_stale_response(self):
         """
@@ -526,20 +543,20 @@
         class newtime(object):
             def time(self):
                 return theTime
-        from twistedcaldav.directory import digest
-        self.patch(digest, "time", newtime())
+        from twistedcaldav.directory import digest as ddigest
+        self.patch(ddigest, "time", newtime())
 
         for ctr, factory in enumerate(self.credentialFactories):
             challenge = (yield factory.getChallenge(clientAddress))
-    
+
             clientResponse = authRequest1[ctr] % (
                 challenge['nonce'],
                 self.getDigestResponse(challenge, "00000001"),
             )
-    
+
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
             self.failUnless(creds.checkPassword('password'))
-            
+
             theTime += DigestCredentialFactory.CHALLENGE_LIFETIME_SECS + 1
             request = _trivial_GET()
             try:
@@ -555,8 +572,8 @@
                 self.fail("Invalid exception from nonce timeout: %s" % e)
             challenge = (yield factory.getChallenge(request.remoteAddr))
             self.assertTrue(challenge.get("stale") == "true")
-            
 
+
+
 def _trivial_GET():
     return SimpleRequest(None, 'GET', '/')
-

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_directory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_directory.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_directory.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -121,7 +121,6 @@
         self.count += 1
 
 
-
     def test_expandedMembers(self):
         """
         Make sure expandedMembers( ) returns a complete, flattened set of
@@ -757,6 +756,7 @@
             ])
         )
 
+
     @inlineCallbacks
     def testScheduling(self):
         """
@@ -765,6 +765,7 @@
 
         groupCacher = StubGroupCacher()
 
+
         def decorateTransaction(txn):
             txn._groupCacher = groupCacher
 
@@ -776,15 +777,19 @@
 
     testScheduling.skip = "Fix WorkProposal to track delayed calls and cancel them"
 
+
+
 class StubGroupCacher(object):
     def __init__(self):
         self.called = False
         self.updateSeconds = 99
 
+
     def updateCache(self):
         self.called = True
 
 
+
 class RecordsMatchingTokensTests(TestCase):
 
     @inlineCallbacks
@@ -869,6 +874,7 @@
         )
 
 
+
 class GUIDTests(TestCase):
 
     def setUp(self):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_guidchange.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_guidchange.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_guidchange.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -52,7 +52,7 @@
         newUID = "38D8AC00-5490-4425-BE3A-05FFB9862444"
 
         homeResource = "/calendars/users/cdaboo/"
-        
+
         def privs1(result):
             # Change GUID in record
             self.xmlFile.setContent(
@@ -65,10 +65,10 @@
 
             # Now force the calendar home resource to be reset
             self.resetCalendars()
-            
+
             # Make sure new user cannot access old user's calendar home
             return self._checkPrivileges(None, homeResource, davxml.HRef("/principals/__uids__/" + newUID + "/"), davxml.Write, False)
-            
+
         # Make sure current user has access to their calendar home
         d = self._checkPrivileges(None, homeResource, davxml.HRef("/principals/__uids__/" + oldUID + "/"), davxml.Write, True)
         d.addCallback(privs1)

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_ldapdirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_ldapdirectory.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_ldapdirectory.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -276,6 +276,7 @@
                     entry["expected"]
                 )
 
+
     class StubList(object):
         def __init__(self, wrapper):
             self.ldap = wrapper
@@ -293,6 +294,7 @@
             self.allResults = self.ldap.search_s(self.base, self.scope,
                 self.filterstr, attrlist=self.attrList)
 
+
     class StubAsync(object):
         def List(self, wrapper):
             return StubList(wrapper)
@@ -304,7 +306,6 @@
         whatever you have previously called addTestResults( ) with.
         """
 
-
         def __init__(self, actual, records):
             self.actual = actual
             self.async = StubAsync()
@@ -1471,7 +1472,6 @@
             self.assertFalse(record.autoSchedule)
             self.assertEquals(record.autoAcceptGroup, "")
 
-
             # Now switch off the resourceInfoAttr and switch to individual
             # attributes...
             self.service.resourceSchema = {
@@ -1625,7 +1625,6 @@
                 self.assertFalse(self.service.isAllowedByRestrictToGroup(dn, attrs))
 
 
-
         @inlineCallbacks
         def test_groupMembershipAliases(self):
             """
@@ -1680,7 +1679,6 @@
             )
 
 
-
         def test_splitIntoBatches(self):
             self.setupService(self.nestedUsingDifferentAttributeUsingDN)
             # Data is perfect multiple of size

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_livedirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_livedirectory.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_livedirectory.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -142,8 +142,6 @@
             record = self.svc.recordWithShortName("users", "odtestcarlene")
             self.assertTrue(record in records)
 
-
-
     if runLDAPTests:
 
         from twistedcaldav.directory.ldapdirectory import LdapDirectoryService
@@ -196,7 +194,6 @@
                 }
                 self.svc = LdapDirectoryService(params)
 
-
     if runODTests:
 
         from twistedcaldav.directory.appleopendirectory import OpenDirectoryService

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_modify.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_modify.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_modify.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -47,6 +47,7 @@
         augmentsFile = os.path.join(testRoot, "augments.xml")
         config.AugmentService.params.xmlFiles = (augmentsFile,)
 
+
     def test_createRecord(self):
         directory = getDirectory()
 
@@ -75,6 +76,7 @@
         record = directory.recordWithUID("location01")
         self.assertNotEquals(record, None)
 
+
     def test_destroyRecord(self):
         directory = getDirectory()
 
@@ -95,6 +97,7 @@
         record = directory.recordWithUID("location01")
         self.assertNotEquals(record, None)
 
+
     def test_updateRecord(self):
         directory = getDirectory()
 
@@ -124,12 +127,14 @@
         record = directory.recordWithUID("location01")
         self.assertNotEquals(record, None)
 
+
     def test_createDuplicateRecord(self):
         directory = getDirectory()
 
         directory.createRecord("resources", guid="resource01", shortNames=("resource01",), uid="resource01")
         self.assertRaises(DirectoryError, directory.createRecord, "resources", guid="resource01", shortNames=("resource01",), uid="resource01")
 
+
     def test_missingShortNames(self):
         directory = getDirectory()
 
@@ -145,6 +150,7 @@
         self.assertEquals(record.shortNames[0], "resource01")
         self.assertEquals(record.fullName, "Resource #1")
 
+
     def test_missingGUID(self):
         directory = getDirectory()
 

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_opendirectorybacker.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_opendirectorybacker.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_opendirectorybacker.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -21,7 +21,20 @@
 
 
     def test_multiplePhoneNumbersAndEmailAddresses(self):
-        attributes={u'dsAttrTypeStandard:AppleMetaRecordName': ['uid=odtestamanda,cn=users,dc=dalek,dc=example,dc=com'], u'dsAttrTypeStandard:ModificationTimestamp': '20111017170937Z', u'dsAttrTypeStandard:PhoneNumber': ['408 555-1212', '415 555-1212'], u'dsAttrTypeStandard:RecordType': ['dsRecTypeStandard:Users'], u'dsAttrTypeStandard:AppleMetaNodeLocation': ['/LDAPv3/127.0.0.1'], u'dsAttrTypeStandard:RecordName': ['odtestamanda'], u'dsAttrTypeStandard:FirstName': 'Amanda', u'dsAttrTypeStandard:GeneratedUID': '9DC04A70-E6DD-11DF-9492-0800200C9A66', u'dsAttrTypeStandard:LastName': 'Test', u'dsAttrTypeStandard:CreationTimestamp': '20110927182945Z', u'dsAttrTypeStandard:EMailAddress': ['amanda at example.com', 'second at example.com'], u'dsAttrTypeStandard:RealName': 'Amanda Test'}
+        attributes = {
+            u'dsAttrTypeStandard:AppleMetaRecordName': ['uid=odtestamanda,cn=users,dc=dalek,dc=example,dc=com'],
+            u'dsAttrTypeStandard:ModificationTimestamp': '20111017170937Z',
+            u'dsAttrTypeStandard:PhoneNumber': ['408 555-1212', '415 555-1212'],
+            u'dsAttrTypeStandard:RecordType': ['dsRecTypeStandard:Users'],
+            u'dsAttrTypeStandard:AppleMetaNodeLocation': ['/LDAPv3/127.0.0.1'],
+            u'dsAttrTypeStandard:RecordName': ['odtestamanda'],
+            u'dsAttrTypeStandard:FirstName': 'Amanda',
+            u'dsAttrTypeStandard:GeneratedUID': '9DC04A70-E6DD-11DF-9492-0800200C9A66',
+            u'dsAttrTypeStandard:LastName': 'Test',
+            u'dsAttrTypeStandard:CreationTimestamp': '20110927182945Z',
+            u'dsAttrTypeStandard:EMailAddress': ['amanda at example.com', 'second at example.com'],
+            u'dsAttrTypeStandard:RealName': 'Amanda Test',
+        }
         vcardRecord = VCardRecord(StubService(), attributes)
         vcard = vcardRecord.vCard()
         properties = set([prop.value() for prop in vcard.properties("TEL")])
@@ -30,6 +43,7 @@
         self.assertEquals(properties, set(["amanda at example.com", "second at example.com"]))
 
 
+
 class StubService(object):
     addDSAttrXProperties = False
     directoryBackedAddressBook = None

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_proxyprincipaldb.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_proxyprincipaldb.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_proxyprincipaldb.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -17,7 +17,7 @@
 from twisted.internet.defer import inlineCallbacks
 from twistedcaldav.config import config
 from twistedcaldav.directory import calendaruserproxy
-from twistedcaldav.directory.calendaruserproxy import ProxySqliteDB,\
+from twistedcaldav.directory.calendaruserproxy import ProxySqliteDB, \
     ProxyPostgreSQLDB
 from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
 import twistedcaldav.test.util
@@ -28,21 +28,21 @@
     """
     Directory service provisioned principals.
     """
-    
+
     class old_ProxyDB(ProxySqliteDB):
-        
+
         def _db_version(self):
             """
             @return: the schema version assigned to this index.
             """
             return "3"
-            
+
         def _db_init_data_tables(self):
             """
             Initialise the underlying database tables.
             @param q:           a database cursor to use.
             """
-    
+
             #
             # GROUPS table
             #
@@ -55,70 +55,77 @@
                 """
             )
 
+
     class new_ProxyDB(ProxySqliteDB):
-        
+
         def _db_version(self):
             """
             @return: the schema version assigned to this index.
             """
             return "11"
-            
+
+
     class newer_ProxyDB(ProxySqliteDB):
-        
+
         def _db_version(self):
             """
             @return: the schema version assigned to this index.
             """
             return "51"
-    
+
+
     @inlineCallbacks
     def test_normalDB(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = ProxySqliteDB(db_path)
         yield db.setGroupMembers("A", ("B", "C", "D",))
-        
+
         membersA = yield db.getMembers("A")
         membershipsB = yield db.getMemberships("B")
-        
+
         self.assertEqual(membersA, set(("B", "C", "D",)))
         self.assertEqual(membershipsB, set(("A",)))
 
+
     @inlineCallbacks
     def test_normalDBNonAscii(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = ProxySqliteDB(db_path)
         principalID = "Test \xe4\xbd\x90\xe8\x97\xa4"
         yield db.setGroupMembers(principalID, ("B", "C", "D",))
-        
+
         membersA = yield db.getMembers(principalID)
         membershipsB = yield db.getMemberships("B")
-        
+
         self.assertEqual(membersA, set(("B", "C", "D",)))
         self.assertEqual(membershipsB, set((principalID,)))
 
+
     @inlineCallbacks
     def test_DBIndexed(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = ProxySqliteDB(db_path)
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set(("GROUPNAMES", "MEMBERS")))
 
+
     @inlineCallbacks
     def test_OldDB(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = self.old_ProxyDB(db_path)
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set())
 
+
     @inlineCallbacks
     def test_DBUpgrade(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = self.old_ProxyDB(db_path)
@@ -132,7 +139,7 @@
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set())
         db.close()
         db = None
-        
+
         db = ProxySqliteDB(db_path)
 
         membersA = yield db.getMembers("A")
@@ -144,9 +151,10 @@
         db.close()
         db = None
 
+
     @inlineCallbacks
     def test_DBUpgradeNewer(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = self.old_ProxyDB(db_path)
@@ -160,7 +168,7 @@
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set())
         db.close()
         db = None
-        
+
         db = self.new_ProxyDB(db_path)
 
         membersA = yield db.getMembers("A")
@@ -172,9 +180,10 @@
         db.close()
         db = None
 
+
     @inlineCallbacks
     def test_DBNoUpgradeNewer(self):
-    
+
         # Get the DB
         db_path = os.path.abspath(self.mktemp())
         db = self.new_ProxyDB(db_path)
@@ -188,7 +197,7 @@
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set(("GROUPNAMES", "MEMBERS")))
         db.close()
         db = None
-        
+
         db = self.newer_ProxyDB(db_path)
 
         membersA = yield db.getMembers("A")
@@ -200,40 +209,41 @@
         db.close()
         db = None
 
+
     @inlineCallbacks
     def test_cachingDBInsert(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
-            
+
             # Do one insert and check the result
             yield db.setGroupMembers("A", ("B", "C", "D",))
-    
+
             membersA = yield db.getMembers("A")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
             membershipsE = yield db.getMemberships("E")
-    
+
             self.assertEqual(membersA, set(("B", "C", "D",)))
             self.assertEqual(membershipsB, set(("A",)))
             self.assertEqual(membershipsC, set(("A",)))
             self.assertEqual(membershipsD, set(("A",)))
             self.assertEqual(membershipsE, set(()))
-            
+
             # Change and check the result
             yield db.setGroupMembers("A", ("B", "C", "E",))
-    
+
             membersA = yield db.getMembers("A")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
             membershipsE = yield db.getMemberships("E")
-    
+
             self.assertEqual(membersA, set(("B", "C", "E",)))
             self.assertEqual(membershipsB, set(("A",)))
             self.assertEqual(membershipsC, set(("A",)))
@@ -242,41 +252,42 @@
 
             yield db.clean()
 
+
     @inlineCallbacks
     def test_cachingDBRemove(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
-            
+
             # Do one insert and check the result
             yield db.setGroupMembers("A", ("B", "C", "D",))
             yield db.setGroupMembers("X", ("B", "C",))
-    
+
             membersA = yield db.getMembers("A")
             membersX = yield db.getMembers("X")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set(("B", "C", "D",)))
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set(("A", "X",)))
             self.assertEqual(membershipsC, set(("A", "X",)))
             self.assertEqual(membershipsD, set(("A",)))
-            
+
             # Remove and check the result
             yield db.removeGroup("A")
-    
+
             membersA = yield db.getMembers("A")
             membersX = yield db.getMembers("X")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set())
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set("X",))
@@ -285,33 +296,34 @@
 
             yield db.clean()
 
+
     @inlineCallbacks
     def test_cachingDBRemoveSpecial(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
-            
+
             # Do one insert and check the result
             yield db.setGroupMembers("A", ("B", "C", "D",))
             yield db.setGroupMembers("X", ("B", "C",))
-    
+
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
-            
+
             # Remove and check the result
             yield db.removeGroup("A")
-    
+
             membersA = yield db.getMembers("A")
             membersX = yield db.getMembers("X")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set())
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set("X",))
@@ -320,41 +332,42 @@
 
             yield db.clean()
 
+
     @inlineCallbacks
     def test_cachingDBRemovePrincipal(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
-            
+
             # Do one insert and check the result
             yield db.setGroupMembers("A", ("B", "C", "D",))
             yield db.setGroupMembers("X", ("B", "C",))
-    
+
             membersA = yield db.getMembers("A")
             membersX = yield db.getMembers("X")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set(("B", "C", "D",)))
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set(("A", "X",)))
             self.assertEqual(membershipsC, set(("A", "X",)))
             self.assertEqual(membershipsD, set(("A",)))
-            
+
             # Remove and check the result
             yield db.removePrincipal("B")
-    
+
             membersA = yield db.getMembers("A")
             membersX = yield db.getMembers("X")
             membershipsB = yield db.getMemberships("B")
             membershipsC = yield db.getMemberships("C")
             membershipsD = yield db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set(("C", "D",)))
             self.assertEqual(membersX, set(("C",)))
             self.assertEqual(membershipsB, set())
@@ -363,29 +376,30 @@
 
             yield db.clean()
 
+
     @inlineCallbacks
     def test_cachingDBInsertUncached(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
-            
+
             # Do one insert and check the result for the one we will remove
             yield db.setGroupMembers("AA", ("BB", "CC", "DD",))
             yield db.getMemberships("DD")
-    
+
             # Change and check the result
             yield db.setGroupMembers("AA", ("BB", "CC", "EE",))
-    
+
             membersAA = yield db.getMembers("AA")
             membershipsBB = yield db.getMemberships("BB")
             membershipsCC = yield db.getMemberships("CC")
             membershipsDD = yield db.getMemberships("DD")
             membershipsEE = yield db.getMemberships("EE")
-    
+
             self.assertEqual(membersAA, set(("BB", "CC", "EE",)))
             self.assertEqual(membershipsBB, set(("AA",)))
             self.assertEqual(membershipsCC, set(("AA",)))
@@ -394,11 +408,13 @@
 
             yield db.clean()
 
+
+
 class ProxyPrincipalDBPostgreSQL (twistedcaldav.test.util.TestCase):
     """
     Directory service provisioned principals.
     """
-    
+
     @inlineCallbacks
     def setUp(self):
 
@@ -406,209 +422,217 @@
         self.db = ProxyPostgreSQLDB(host="localhost", database="proxies")
         yield self.db.clean()
 
+
     @inlineCallbacks
     def tearDown(self):
         yield self.db.close()
         self.db = None
 
+
     @inlineCallbacks
     def test_normalDB(self):
-    
+
         # Get the DB
         yield self.db.clean()
-        
+
         calendaruserproxy.ProxyDBService = self.db
         loader = XMLCalendarUserProxyLoader("/Volumes/Data/Users/cyrusdaboo/Documents/Development/Apple/eclipse/CalendarServer-3/conf/auth/proxies-test.xml")
         yield loader.updateProxyDB()
 
         yield self.db.setGroupMembers("A", ("B", "C", "D",))
-        
+
         membersA = yield self.db.getMembers("A")
         membershipsB = yield self.db.getMemberships("B")
-        
+
         self.assertEqual(membersA, set(("B", "C", "D",)))
         self.assertEqual(membershipsB, set(("A",)))
 
+
     @inlineCallbacks
     def test_DBIndexed(self):
-    
+
         # Get the DB
         yield self.db.clean()
         self.assertTrue((yield self.db.queryOne("select hasindexes from pg_tables where tablename = 'groups'")))
 
+
     @inlineCallbacks
     def test_cachingDBInsert(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             yield self.db.clean()
-            
+
             # Do one insert and check the result
             yield self.db.setGroupMembers("A", ("B", "C", "D",))
-    
+
             membersA = yield self.db.getMembers("A")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
             membershipsE = yield self.db.getMemberships("E")
-    
+
             self.assertEqual(membersA, set(("B", "C", "D",)))
             self.assertEqual(membershipsB, set(("A",)))
             self.assertEqual(membershipsC, set(("A",)))
             self.assertEqual(membershipsD, set(("A",)))
             self.assertEqual(membershipsE, set(()))
-            
+
             # Change and check the result
             yield self.db.setGroupMembers("A", ("B", "C", "E",))
-    
+
             membersA = yield self.db.getMembers("A")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
             membershipsE = yield self.db.getMemberships("E")
-    
+
             self.assertEqual(membersA, set(("B", "C", "E",)))
             self.assertEqual(membershipsB, set(("A",)))
             self.assertEqual(membershipsC, set(("A",)))
             self.assertEqual(membershipsD, set())
             self.assertEqual(membershipsE, set(("A",)))
 
+
     @inlineCallbacks
     def test_cachingDBRemove(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             yield self.db.clean()
-            
+
             # Do one insert and check the result
             yield self.db.setGroupMembers("A", ("B", "C", "D",))
             yield self.db.setGroupMembers("X", ("B", "C",))
-    
+
             membersA = yield self.db.getMembers("A")
             membersX = yield self.db.getMembers("X")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set(("B", "C", "D",)))
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set(("A", "X",)))
             self.assertEqual(membershipsC, set(("A", "X",)))
             self.assertEqual(membershipsD, set(("A",)))
-            
+
             # Remove and check the result
             yield self.db.removeGroup("A")
-    
+
             membersA = yield self.db.getMembers("A")
             membersX = yield self.db.getMembers("X")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set())
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set("X",))
             self.assertEqual(membershipsC, set("X",))
             self.assertEqual(membershipsD, set())
 
+
     @inlineCallbacks
     def test_cachingDBRemoveSpecial(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             yield self.db.clean()
-            
+
             # Do one insert and check the result
             yield self.db.setGroupMembers("A", ("B", "C", "D",))
             yield self.db.setGroupMembers("X", ("B", "C",))
-    
+
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
-            
+
             # Remove and check the result
             yield self.db.removeGroup("A")
-    
+
             membersA = yield self.db.getMembers("A")
             membersX = yield self.db.getMembers("X")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set())
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set("X",))
             self.assertEqual(membershipsC, set("X",))
             self.assertEqual(membershipsD, set())
 
+
     @inlineCallbacks
     def test_cachingDBRemovePrincipal(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             yield self.db.clean()
-            
+
             # Do one insert and check the result
             yield self.db.setGroupMembers("A", ("B", "C", "D",))
             yield self.db.setGroupMembers("X", ("B", "C",))
-    
+
             membersA = yield self.db.getMembers("A")
             membersX = yield self.db.getMembers("X")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set(("B", "C", "D",)))
             self.assertEqual(membersX, set(("B", "C",)))
             self.assertEqual(membershipsB, set(("A", "X",)))
             self.assertEqual(membershipsC, set(("A", "X",)))
             self.assertEqual(membershipsD, set(("A",)))
-            
+
             # Remove and check the result
             yield self.db.removePrincipal("B")
-    
+
             membersA = yield self.db.getMembers("A")
             membersX = yield self.db.getMembers("X")
             membershipsB = yield self.db.getMemberships("B")
             membershipsC = yield self.db.getMemberships("C")
             membershipsD = yield self.db.getMemberships("D")
-    
+
             self.assertEqual(membersA, set(("C", "D",)))
             self.assertEqual(membersX, set(("C",)))
             self.assertEqual(membershipsB, set())
             self.assertEqual(membershipsC, set(("A", "X",)))
             self.assertEqual(membershipsD, set(("A",),))
 
+
     @inlineCallbacks
     def test_cachingDBInsertUncached(self):
-    
+
         for processType in ("Single", "Combined",):
             config.ProcessType = processType
 
             # Get the DB
             yield self.db.clean()
-            
+
             # Do one insert and check the result for the one we will remove
             yield self.db.setGroupMembers("AA", ("BB", "CC", "DD",))
             yield self.db.getMemberships("DD")
-    
+
             # Change and check the result
             yield self.db.setGroupMembers("AA", ("BB", "CC", "EE",))
-    
+
             membersAA = yield self.db.getMembers("AA")
             membershipsBB = yield self.db.getMemberships("BB")
             membershipsCC = yield self.db.getMemberships("CC")
             membershipsDD = yield self.db.getMemberships("DD")
             membershipsEE = yield self.db.getMemberships("EE")
-    
+
             self.assertEqual(membersAA, set(("BB", "CC", "EE",)))
             self.assertEqual(membershipsBB, set(("AA",)))
             self.assertEqual(membershipsCC, set(("AA",)))

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_resources.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_resources.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_resources.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -41,6 +41,7 @@
 #    def test_loadConfig(self):
 #        directory = getDirectory()
 
+
     def test_recordInPrimaryDirectory(self):
         directory = getDirectory()
 
@@ -48,6 +49,7 @@
         record = directory.recordWithUID("user01")
         self.assertNotEquals(record, None)
 
+
     def test_recordInSupplementalDirectory(self):
         directory = getDirectory()
 
@@ -55,6 +57,7 @@
         record = directory.recordWithUID("resource01")
         self.assertNotEquals(record, None)
 
+
     def test_augments(self):
         directory = getDirectory()
 

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_xmlfile.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_xmlfile.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/test_xmlfile.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -38,49 +38,50 @@
     ))
 
     users = {
-        "admin"      : { "password": "nimda",      "guid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "addresses": () },
-        "wsanchez"   : { "password": "zehcnasw",   "guid": "6423F94A-6B76-4A3A-815B-D52CFD77935D", "addresses": ("mailto:wsanchez at example.com",) },
-        "cdaboo"     : { "password": "oobadc",     "guid": "5A985493-EE2C-4665-94CF-4DFEA3A89500", "addresses": ("mailto:cdaboo at example.com",)   },
-        "lecroy"     : { "password": "yorcel",     "guid": "8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "addresses": ("mailto:lecroy at example.com",)   },
-        "dreid"      : { "password": "dierd",      "guid": "5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "addresses": ("mailto:dreid at example.com",)    },
-        "nocalendar" : { "password": "radnelacon", "guid": "543D28BA-F74F-4D5F-9243-B3E3A61171E5", "addresses": () },
-        "user01"     : { "password": "01user",     "guid": None                                  , "addresses": ("mailto:c4ca4238a0 at example.com",) },
-        "user02"     : { "password": "02user",     "guid": None                                  , "addresses": ("mailto:c81e728d9d at example.com",) },
-    }
+        "admin"      : {"password": "nimda", "guid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "addresses": ()},
+        "wsanchez"   : {"password": "zehcnasw", "guid": "6423F94A-6B76-4A3A-815B-D52CFD77935D", "addresses": ("mailto:wsanchez at example.com",)},
+        "cdaboo"     : {"password": "oobadc", "guid": "5A985493-EE2C-4665-94CF-4DFEA3A89500", "addresses": ("mailto:cdaboo at example.com",)  },
+        "lecroy"     : {"password": "yorcel", "guid": "8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "addresses": ("mailto:lecroy at example.com",)  },
+        "dreid"      : {"password": "dierd", "guid": "5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "addresses": ("mailto:dreid at example.com",)   },
+        "nocalendar" : {"password": "radnelacon", "guid": "543D28BA-F74F-4D5F-9243-B3E3A61171E5", "addresses": ()},
+        "user01"     : {"password": "01user", "guid": None, "addresses": ("mailto:c4ca4238a0 at example.com",)},
+        "user02"     : {"password": "02user", "guid": None, "addresses": ("mailto:c81e728d9d at example.com",)},
+   }
 
     groups = {
-        "admin"      : { "password": "admin",       "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "managers"),)},
-        "managers"   : { "password": "managers",    "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "lecroy"),)},
-        "grunts"     : { "password": "grunts",      "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "wsanchez"),
+        "admin"      : {"password": "admin", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "managers"),)},
+        "managers"   : {"password": "managers", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "lecroy"),)},
+        "grunts"     : {"password": "grunts", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "wsanchez"),
                                                                                                (DirectoryService.recordType_users , "cdaboo"),
                                                                                                (DirectoryService.recordType_users , "dreid"))},
-        "right_coast": { "password": "right_coast", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "cdaboo"),)},
-        "left_coast" : { "password": "left_coast",  "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "wsanchez"),
+        "right_coast": {"password": "right_coast", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "cdaboo"),)},
+        "left_coast" : {"password": "left_coast", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "wsanchez"),
                                                                                                (DirectoryService.recordType_users , "dreid"),
                                                                                                (DirectoryService.recordType_users , "lecroy"))},
-        "both_coasts": { "password": "both_coasts", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "right_coast"),
+        "both_coasts": {"password": "both_coasts", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "right_coast"),
                                                                                                (DirectoryService.recordType_groups, "left_coast"))},
-        "recursive1_coasts":  { "password": "recursive1_coasts",  "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "recursive2_coasts"),
+        "recursive1_coasts": {"password": "recursive1_coasts", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "recursive2_coasts"),
                                                                                                (DirectoryService.recordType_users, "wsanchez"))},
-        "recursive2_coasts":  { "password": "recursive2_coasts",  "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "recursive1_coasts"),
+        "recursive2_coasts": {"password": "recursive2_coasts", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_groups, "recursive1_coasts"),
                                                                                                (DirectoryService.recordType_users, "cdaboo"))},
-        "non_calendar_group": { "password": "non_calendar_group", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "cdaboo"),
+        "non_calendar_group": {"password": "non_calendar_group", "guid": None, "addresses": (), "members": ((DirectoryService.recordType_users , "cdaboo"),
                                                                                                (DirectoryService.recordType_users , "lecroy"))},
-    }
+   }
 
     locations = {
-        "mercury": { "password": "mercury", "guid": None, "addresses": ("mailto:mercury at example.com",) },
-        "gemini" : { "password": "gemini",  "guid": None, "addresses": ("mailto:gemini at example.com",)  },
-        "apollo" : { "password": "apollo",  "guid": None, "addresses": ("mailto:apollo at example.com",)  },
-        "orion"  : { "password": "orion",   "guid": None, "addresses": ("mailto:orion at example.com",)   },
-    }
+        "mercury": {"password": "mercury", "guid": None, "addresses": ("mailto:mercury at example.com",)},
+        "gemini" : {"password": "gemini", "guid": None, "addresses": ("mailto:gemini at example.com",)},
+        "apollo" : {"password": "apollo", "guid": None, "addresses": ("mailto:apollo at example.com",)},
+        "orion"  : {"password": "orion", "guid": None, "addresses": ("mailto:orion at example.com",)},
+   }
 
     resources = {
-        "transporter"        : { "password": "transporter",        "guid": None,                 "addresses": ("mailto:transporter at example.com",)        },
-        "ftlcpu"             : { "password": "ftlcpu",             "guid": None,                 "addresses": ("mailto:ftlcpu at example.com",)             },
-        "non_calendar_proxy" : { "password": "non_calendar_proxy", "guid": "non_calendar_proxy", "addresses": ("mailto:non_calendar_proxy at example.com",) },
-    }
+        "transporter"        : {"password": "transporter", "guid": None, "addresses": ("mailto:transporter at example.com",)       },
+        "ftlcpu"             : {"password": "ftlcpu", "guid": None, "addresses": ("mailto:ftlcpu at example.com",)            },
+        "non_calendar_proxy" : {"password": "non_calendar_proxy", "guid": "non_calendar_proxy", "addresses": ("mailto:non_calendar_proxy at example.com",)},
+   }
 
+
     def xmlFile(self):
         """
         Create a L{FilePath} that points to a temporary file containing a copy
@@ -155,10 +156,10 @@
 """
         )
         for recordType, expectedRecords in (
-            ( DirectoryService.recordType_users     , ("admin",) ),
-            ( DirectoryService.recordType_groups    , ()         ),
-            ( DirectoryService.recordType_locations , ()         ),
-            ( DirectoryService.recordType_resources , ()         ),
+            (DirectoryService.recordType_users     , ("admin",)),
+            (DirectoryService.recordType_groups    , ()),
+            (DirectoryService.recordType_locations , ()),
+            (DirectoryService.recordType_resources , ()),
         ):
             # Fault records in
             for name in expectedRecords:
@@ -169,6 +170,7 @@
                 set(expectedRecords)
             )
 
+
     def test_okAutoSchedule(self):
         service = self.service()
 
@@ -201,10 +203,10 @@
         service.augmentService.refresh()
 
         for recordType, expectedRecords in (
-            ( DirectoryService.recordType_users     , ()             ),
-            ( DirectoryService.recordType_groups    , ()             ),
-            ( DirectoryService.recordType_locations , ("my office",) ),
-            ( DirectoryService.recordType_resources , ()             ),
+            (DirectoryService.recordType_users     , ()),
+            (DirectoryService.recordType_groups    , ()),
+            (DirectoryService.recordType_locations , ("my office",)),
+            (DirectoryService.recordType_resources , ()),
         ):
             # Fault records in
             for name in expectedRecords:
@@ -239,12 +241,12 @@
 </accounts>
 """
         )
-        
+
         for recordType, expectedRecords in (
-            ( DirectoryService.recordType_users     , ()                       ),
-            ( DirectoryService.recordType_groups    , ("enabled", "disabled")  ),
-            ( DirectoryService.recordType_locations , ()                       ),
-            ( DirectoryService.recordType_resources , ()                       ),
+            (DirectoryService.recordType_users     , ()),
+            (DirectoryService.recordType_groups    , ("enabled", "disabled")),
+            (DirectoryService.recordType_locations , ()),
+            (DirectoryService.recordType_resources , ()),
         ):
             # Fault records in
             for name in expectedRecords:
@@ -279,13 +281,14 @@
 </accounts>
 """
         )
-        
+
         record = service.recordWithShortName(
             DirectoryService.recordType_locations, "my office")
         self.assertEquals(record.guid, "myoffice")
         self.assertEquals(record.extras["comment"], "This is the comment")
         self.assertEquals(record.extras["capacity"], "40")
 
+
     def test_writeExtras(self):
         service = self.service()
 
@@ -302,7 +305,6 @@
         self.assertEquals(record.extras["comment"], "Test comment")
         self.assertEquals(record.extras["capacity"], "10")
 
-
         service.updateRecord(DirectoryService.recordType_locations, "newguid",
             shortNames=("New office",),
             fullName="My Newer Office",
@@ -333,6 +335,7 @@
         self.assertNotEquals(None, service._lookupInIndex(service.recordType_locations, service.INDEX_TYPE_SHORTNAME, "orion"))
         self.assertEquals(None, service._lookupInIndex(service.recordType_users, service.INDEX_TYPE_CUA, "mailto:nobody at example.com"))
 
+
     def test_repeat(self):
         service = self.service()
         record = service.recordWithShortName(
@@ -342,6 +345,8 @@
         self.assertEquals(record.lastName, "c4ca4238a User 01")
         self.assertEquals(record.emailAddresses, set(['c4ca4238a0 at example.com']))
 
+
+
 class XMLFileSubset (XMLFileBase, TestCase):
     """
     Test the recordTypes subset feature of XMLFile service.
@@ -351,6 +356,7 @@
         DirectoryService.recordType_groups,
     ))
 
+
     def test_recordTypesSubset(self):
         directory = XMLDirectoryService(
             {
@@ -366,4 +372,3 @@
             alwaysStat=True
         )
         self.assertEquals(set(("users", "groups")), set(directory.recordTypes()))
-    

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/util.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/util.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/directory/test/util.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -54,12 +54,14 @@
     # For aggregator subclasses
     recordTypePrefixes = ("",)
 
+
     def test_realm(self):
         """
         IDirectoryService.realm
         """
         self.failUnless(self.service().realmName)
 
+
     def test_recordTypes(self):
         """
         IDirectoryService.recordTypes()
@@ -69,15 +71,16 @@
 
         self.assertEquals(set(self.service().recordTypes()), self.recordTypes)
 
+
     def test_recordWithShortName(self):
         """
         IDirectoryService.recordWithShortName()
         """
         for recordType, data in (
-            ( DirectoryService.recordType_users    , self.users     ),
-            ( DirectoryService.recordType_groups   , self.groups    ),
-            ( DirectoryService.recordType_locations, self.locations ),
-            ( DirectoryService.recordType_resources, self.resources ),
+            (DirectoryService.recordType_users    , self.users),
+            (DirectoryService.recordType_groups   , self.groups),
+            (DirectoryService.recordType_locations, self.locations),
+            (DirectoryService.recordType_resources, self.resources),
         ):
             if not data:
                 raise SkipTest("No %s" % (recordType,))
@@ -95,6 +98,7 @@
                     continue
                 self.assertEquals(record, None)
 
+
     def test_recordWithUID(self):
         service = self.service()
         record = None
@@ -108,6 +112,7 @@
         if record is None:
             raise SkipTest("No GUIDs provided to test")
 
+
     def test_recordWithCalendarUserAddress(self):
         service = self.service()
         record = None
@@ -120,6 +125,7 @@
         if record is None:
             raise SkipTest("No calendar user addresses provided to test")
 
+
     def test_groupMembers(self):
         """
         IDirectoryRecord.members()
@@ -138,6 +144,7 @@
                 "Wrong membership for group %r: %s != %s" % (group, result, expected)
             )
 
+
     def test_groupMemberships(self):
         """
         IDirectoryRecord.groups()
@@ -148,8 +155,8 @@
             raise SkipTest("No groups")
 
         for recordType, data in (
-            ( DirectoryService.recordType_users , self.users  ),
-            ( DirectoryService.recordType_groups, self.groups ),
+            (DirectoryService.recordType_users , self.users),
+            (DirectoryService.recordType_groups, self.groups),
         ):
             service = self.service()
             for shortName, info in data.iteritems():
@@ -162,6 +169,7 @@
                     "Wrong groups for %s %r: %s != %s" % (record.recordType, shortName, result, expected)
                 )
 
+
     def recordNames(self, recordType):
         service = self.service()
         names = set()
@@ -176,16 +184,18 @@
 
         return names
 
+
     def allEntries(self):
         for data, _ignore_recordType in (
-            (self.users,     DirectoryService.recordType_users    ),
-            (self.groups,    DirectoryService.recordType_groups   ),
+            (self.users, DirectoryService.recordType_users),
+            (self.groups, DirectoryService.recordType_groups),
             (self.locations, DirectoryService.recordType_locations),
             (self.resources, DirectoryService.recordType_resources),
         ):
             for item in data.iteritems():
                 yield item
 
+
     def compare(self, record, shortName, data):
         def value(key):
             if key in data:
@@ -217,6 +227,7 @@
         if value("name"):
             self.assertEquals(record.fullName, value("name"))
 
+
     def servicePrefix(self):
         service = self.service()
         if hasattr(service, "recordTypePrefix"):
@@ -224,6 +235,8 @@
         else:
             return ""
 
+
+
 class NonCachingTestCase (DirectoryTestCase):
 
     def test_listRecords_user(self):
@@ -235,6 +248,7 @@
 
         self.assertEquals(self.recordNames(DirectoryService.recordType_users), set(self.users.keys()))
 
+
     def test_listRecords_group(self):
         """
         IDirectoryService.listRecords(DirectoryService.recordType_groups)
@@ -244,6 +258,7 @@
 
         self.assertEquals(self.recordNames(DirectoryService.recordType_groups), set(self.groups.keys()))
 
+
     def test_listRecords_locations(self):
         """
         IDirectoryService.listRecords("locations")
@@ -253,6 +268,7 @@
 
         self.assertEquals(self.recordNames(DirectoryService.recordType_locations), set(self.locations.keys()))
 
+
     def test_listRecords_resources(self):
         """
         IDirectoryService.listRecords("resources")
@@ -263,6 +279,7 @@
         self.assertEquals(self.recordNames(DirectoryService.recordType_resources), set(self.resources.keys()))
 
 
+
 class BasicTestCase (DirectoryTestCase):
     """
     Tests a directory implementation with basic auth.
@@ -279,6 +296,8 @@
             userRecord = service.recordWithShortName(DirectoryService.recordType_users, user)
             self.failUnless(userRecord.verifyCredentials(UsernamePassword(user, self.users[user]["password"])))
 
+
+
 # authRequest = {
 #    username="username",
 #    realm="test realm",
@@ -351,6 +370,8 @@
                 else:
                     self.failIf(userRecord.verifyCredentials(credentials))
 
+
+
 def maybeCommit(req):
     class JustForCleanup(object):
         def newTransaction(self, *whatever):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/dropbox.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/dropbox.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -44,12 +44,15 @@
     def resourceType(self):
         return davxml.ResourceType.dropboxhome #@UndefinedVariable
 
+
     def isCollection(self):
         return True
 
+
     def http_PUT(self, request):
         return responsecode.FORBIDDEN
 
+
     @inlineCallbacks
     def accessControlList(self, request, *args, **kwargs):
         """
@@ -57,7 +60,7 @@
         """
 
         acl = (yield super(DropBoxHomeResource, self).accessControlList(request, *args, **kwargs))
-        
+
         if config.EnableProxyPrincipals:
             owner = (yield self.ownerPrincipal(request))
 
@@ -75,10 +78,12 @@
             )
 
             returnValue(davxml.ACL(*newaces))
-        
+
         else:
             returnValue(acl)
 
+
+
 class DropBoxCollectionResource (DAVResource):
     """
     Drop box resource.
@@ -99,7 +104,7 @@
         calendar collection have the same privileges unless explicitly overridden. The same applies
         to drop box collections as we want all resources (attachments) to have the same privileges as
         the drop box collection.
-        
+
         @param newaces: C{list} of L{ACE} for ACL being set.
         """
         # Add inheritable option to each ACE in the list

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/extensions.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/extensions.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -1004,6 +1004,7 @@
     return tokens, context, applyTo, clientLimit, propElement
 
 
+
 def validateTokens(tokens):
     """
     Make sure there is at least one token longer than one character

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/freebusyurl.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/freebusyurl.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/freebusyurl.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -47,8 +47,8 @@
 from txdav.caldav.datastore.scheduling.cuaddress import LocalCalendarUser
 from txdav.caldav.datastore.scheduling.scheduler import Scheduler
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
 
 log = Logger()
 
@@ -189,15 +189,15 @@
         # Start/end/duration must be valid iCalendar DATE-TIME UTC or DURATION values
         try:
             if self.start:
-                self.start = PyCalendarDateTime.parseText(self.start)
+                self.start = DateTime.parseText(self.start)
                 if not self.start.utc():
                     raise ValueError()
             if self.end:
-                self.end = PyCalendarDateTime.parseText(self.end)
+                self.end = DateTime.parseText(self.end)
                 if not self.end.utc():
                     raise ValueError()
             if self.duration:
-                self.duration = PyCalendarDuration.parseText(self.duration)
+                self.duration = Duration.parseText(self.duration)
         except ValueError:
             raise HTTPError(ErrorResponse(
                 responsecode.BAD_REQUEST,
@@ -225,12 +225,12 @@
 
         # Now fill in the missing pieces
         if self.start is None:
-            self.start = PyCalendarDateTime.getNowUTC()
+            self.start = DateTime.getNowUTC()
             self.start.setHHMMSS(0, 0, 0)
         if self.duration:
             self.end = self.start + self.duration
         if self.end is None:
-            self.end = self.start + PyCalendarDuration(days=config.FreeBusyURL.TimePeriod)
+            self.end = self.start + Duration(days=config.FreeBusyURL.TimePeriod)
 
         # End > start
         if self.end <= self.start:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/ical.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/ical.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -46,17 +46,18 @@
 from txdav.caldav.datastore.scheduling.cuaddress import normalizeCUAddr
 from twistedcaldav.timezones import hasTZ, TimezoneException
 
-from pycalendar import definitions
-from pycalendar.attribute import PyCalendarAttribute
-from pycalendar.calendar import PyCalendar
-from pycalendar.componentbase import PyCalendarComponentBase
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.exceptions import PyCalendarError
-from pycalendar.period import PyCalendarPeriod
-from pycalendar.property import PyCalendarProperty
-from pycalendar.timezone import PyCalendarTimezone
-from pycalendar.utcoffsetvalue import PyCalendarUTCOffsetValue
+from pycalendar.icalendar import definitions
+from pycalendar.parameter import Parameter
+from pycalendar.icalendar.calendar import Calendar
+from pycalendar.icalendar.component import Component as PyComponent
+from pycalendar.componentbase import ComponentBase
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.exceptions import ErrorBase
+from pycalendar.period import Period
+from pycalendar.icalendar.property import Property as PyProperty
+from pycalendar.timezone import Timezone
+from pycalendar.utcoffsetvalue import UTCOffsetValue
 
 log = Logger()
 
@@ -145,8 +146,8 @@
 ignoredComponents = ("VTIMEZONE", PERUSER_COMPONENT,)
 
 # Used for min/max time-range query limits
-minDateTime = PyCalendarDateTime(1900, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-maxDateTime = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+minDateTime = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+maxDateTime = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
 
 class InvalidICalendarDataError(ValueError):
     pass
@@ -170,16 +171,16 @@
 
             pyobj = kwargs["pycalendar"]
 
-            if not isinstance(pyobj, PyCalendarProperty):
-                raise TypeError("Not a PyCalendarProperty: %r" % (property,))
+            if not isinstance(pyobj, PyProperty):
+                raise TypeError("Not a Property: %r" % (property,))
 
             self._pycalendar = pyobj
         else:
             # Convert params dictionary to list of lists format used by pycalendar
             valuetype = kwargs.get("valuetype")
-            self._pycalendar = PyCalendarProperty(name, value, valuetype=valuetype)
+            self._pycalendar = PyProperty(name, value, valuetype=valuetype)
             for attrname, attrvalue in params.items():
-                self._pycalendar.addAttribute(PyCalendarAttribute(attrname, attrvalue))
+                self._pycalendar.addParameter(Parameter(attrname, attrvalue))
 
         self._parent = parent
 
@@ -267,7 +268,7 @@
         Returns a set containing parameter names for this property.
         """
         result = set()
-        for pyattrlist in self._pycalendar.getAttributes().values():
+        for pyattrlist in self._pycalendar.getParameters().values():
             for pyattr in pyattrlist:
                 result.add(pyattr.getName())
         return result
@@ -279,27 +280,27 @@
         InvalidICalendarDataError if the parameter has more than one value.
         """
         try:
-            return self._pycalendar.getAttributeValue(name)
+            return self._pycalendar.getParameterValue(name)
         except KeyError:
             return default
 
 
     def hasParameter(self, paramname):
-        return self._pycalendar.hasAttribute(paramname)
+        return self._pycalendar.hasParameter(paramname)
 
 
     def setParameter(self, paramname, paramvalue):
-        self._pycalendar.replaceAttribute(PyCalendarAttribute(paramname, paramvalue))
+        self._pycalendar.replaceParameter(Parameter(paramname, paramvalue))
         self._markAsDirty()
 
 
     def removeParameter(self, paramname):
-        self._pycalendar.removeAttributes(paramname)
+        self._pycalendar.removeParameters(paramname)
         self._markAsDirty()
 
 
     def removeAllParameters(self):
-        self._pycalendar.setAttributes({})
+        self._pycalendar.setParameters({})
         self._markAsDirty()
 
 
@@ -308,11 +309,11 @@
         paramname = paramname.upper()
         for attrName in self.parameterNames():
             if attrName.upper() == paramname:
-                for attr in tuple(self._pycalendar.getAttributes()[attrName]):
+                for attr in tuple(self._pycalendar.getParameters()[attrName]):
                     for value in attr.getValues():
                         if value == paramvalue:
                             if not attr.removeValue(value):
-                                self._pycalendar.removeAttributes(paramname)
+                                self._pycalendar.removeParameters(paramname)
         self._markAsDirty()
 
 
@@ -322,8 +323,8 @@
         start/end period.
         The only properties allowed for this query are: COMPLETED, CREATED, DTSTAMP and
         LAST-MODIFIED (caldav -09).
-        @param start: a L{PyCalendarDateTime} specifying the beginning of the given time span.
-        @param end: a L{PyCalendarDateTime} specifying the end of the given time span.
+        @param start: a L{DateTime} specifying the beginning of the given time span.
+        @param end: a L{DateTime} specifying the end of the given time span.
             C{end} may be None, indicating that there is no end date.
         @param defaulttz: the default L{PyTimezone} to use in datetime comparisons.
         @return: True if the property's date/date-time value is within the given time range,
@@ -337,7 +338,7 @@
 
         # get date/date-time value
         dt = self._pycalendar.getValue().getValue()
-        assert isinstance(dt, PyCalendarDateTime), "Not a date/date-time value: %r" % (self,)
+        assert isinstance(dt, DateTime), "Not a date/date-time value: %r" % (self,)
 
         return timeRangesOverlap(dt, None, start, end, defaulttz)
 
@@ -420,11 +421,11 @@
         @return: a L{Component} representing the first component described by
             C{stream}.
         """
-        cal = PyCalendar()
+        cal = Calendar()
         errmsg = "Unknown"
         try:
             result = cal.parse(stream)
-        except PyCalendarError, e:
+        except ErrorBase, e:
             errmsg = "%s: %s" % (e.mReason, e.mData,)
             result = None
         if not result:
@@ -480,8 +481,8 @@
                 pyobj = kwargs["pycalendar"]
 
                 if pyobj is not None:
-                    if not isinstance(pyobj, PyCalendarComponentBase):
-                        raise TypeError("Not a PyCalendarComponentBase: %r" % (pyobj,))
+                    if not isinstance(pyobj, ComponentBase):
+                        raise TypeError("Not a ComponentBase: %r" % (pyobj,))
 
                 self._pycalendar = pyobj
             else:
@@ -499,7 +500,7 @@
                 self._parent = None
         else:
             # FIXME: figure out creating an arbitrary component
-            self._pycalendar = PyCalendar(add_defaults=False) if name == "VCALENDAR" else PyCalendar.makeComponent(name, None)
+            self._pycalendar = Calendar(add_defaults=False) if name == "VCALENDAR" else PyComponent.makeComponent(name, None)
             self._parent = None
 
 
@@ -627,14 +628,14 @@
         This also returns the matching master component if recurrence_id is C{None}.
 
         @param recurrence_id: The RECURRENCE-ID property value to match.
-        @type recurrence_id: L{PyCalendarDateTime}
+        @type recurrence_id: L{DateTime}
         @return: the L{Component} for the overridden component,
             or C{None} if there isn't one.
         """
         assert self.name() == "VCALENDAR", "Must be a VCALENDAR: %r" % (self,)
 
         if isinstance(recurrence_id, str):
-            recurrence_id = PyCalendarDateTime.parseText(recurrence_id) if recurrence_id else None
+            recurrence_id = DateTime.parseText(recurrence_id) if recurrence_id else None
 
         for component in self.subcomponents():
             if component.name() in ignoredComponents:
@@ -760,7 +761,7 @@
         Return the start date or date-time for the specified component
         converted to UTC.
         @param component: the Component whose start should be returned.
-        @return: the L{PyCalendarDateTime} for the start.
+        @return: the L{DateTime} for the start.
         """
         dtstart = self.propertyValue("DTSTART")
         return dtstart.duplicateAsUTC() if dtstart is not None else None
@@ -772,7 +773,7 @@
         taking into account the presence or absence of DTEND/DURATION properties.
         The returned date-time is converted to UTC.
         @param component: the Component whose end should be returned.
-        @return: the L{PyCalendarDateTime} for the end.
+        @return: the L{DateTime} for the end.
         """
         dtend = self.propertyValue("DTEND")
         if dtend is None:
@@ -789,7 +790,7 @@
         Return the due date or date-time for the specified component
         converted to UTC. Use DTSTART/DURATION if no DUE property.
         @param component: the Component whose start should be returned.
-        @return: the L{PyCalendarDateTime} for the start.
+        @return: the L{DateTime} for the start.
         """
         due = self.propertyValue("DUE")
         if due is None:
@@ -827,7 +828,7 @@
         """
         Return the recurrence-id for the specified component.
         @param component: the Component whose r-id should be returned.
-        @return: the L{PyCalendarDateTime} for the r-id.
+        @return: the L{DateTime} for the r-id.
         """
         rid = self.propertyValue("RECURRENCE-ID")
         return rid.duplicateAsUTC() if rid is not None else None
@@ -1086,7 +1087,7 @@
         to match the new limit, remove RDATEs/EXDATEs and overridden components beyond the limit.
 
         @param rid: the recurrence-id limit
-        @type rid: L{PyCalendarDateTime}
+        @type rid: L{DateTime}
         """
 
         if not self.isRecurring():
@@ -1148,7 +1149,7 @@
         match any RRULE pattern.
 
         @param rid: the recurrence-id limit
-        @type rid: L{PyCalendarDateTime}
+        @type rid: L{DateTime}
         """
 
         if not self.isRecurring():
@@ -1169,7 +1170,7 @@
                     rrule_expanded = []
                     rrule.expand(
                         master.propertyValue("DTSTART"),
-                        PyCalendarPeriod(PyCalendarDateTime(1900, 1, 1), upperlimit),
+                        Period(DateTime(1900, 1, 1), upperlimit),
                         rrule_expanded,
                     )
                     for i in sorted(rrule_expanded):
@@ -1244,14 +1245,14 @@
         instance in the specified range. Date-times are converted to UTC. A
         new calendar object is returned.
 
-        @param start: the L{PyCalendarDateTime} for the start of the range.
-        @param end: the L{PyCalendarDateTime} for the end of the range.
-        @param timezone: the L{Component} or L{PyCalendarTimezone} of the VTIMEZONE to use for floating/all-day.
+        @param start: the L{DateTime} for the start of the range.
+        @param end: the L{DateTime} for the end of the range.
+        @param timezone: the L{Component} or L{Timezone} of the VTIMEZONE to use for floating/all-day.
         @return: the L{Component} for the new calendar with expanded instances.
         """
 
         if timezone is not None and isinstance(timezone, Component):
-            pytz = PyCalendarTimezone(tzid=timezone.propertyValue("TZID"))
+            pytz = Timezone(tzid=timezone.propertyValue("TZID"))
         else:
             pytz = timezone
 
@@ -1297,7 +1298,7 @@
         # Convert all datetime properties to UTC unless they are floating
         for property in newcomp.properties():
             value = property.value()
-            if isinstance(value, PyCalendarDateTime) and value.local():
+            if isinstance(value, DateTime) and value.local():
                 property.removeParameter("TZID")
                 property.setValue(value.duplicateAsUTC())
 
@@ -1324,7 +1325,7 @@
         breathing room to return results for future instances.
 
         @param limit: the max datetime to cache up to.
-        @type limit: L{PyCalendarDateTime}
+        @type limit: L{DateTime}
         """
 
         # Checked for cached values first
@@ -1335,7 +1336,7 @@
                 # so return cached instances
                 return self.cachedInstances
 
-        lookAheadLimit = limit + PyCalendarDuration(days=365)
+        lookAheadLimit = limit + Duration(days=365)
         self.cachedInstances = self.expandTimeRanges(
             lookAheadLimit,
             ignoreInvalidInstances=ignoreInvalidInstances
@@ -1349,7 +1350,7 @@
         contained within this VCALENDAR component. We will assume
         that this component has already been validated as a CalDAV resource
         (i.e. only one type of component, all with the same UID)
-        @param limit: L{PyCalendarDateTime} value representing the end of the expansion.
+        @param limit: L{DateTime} value representing the end of the expansion.
         @param ignoreInvalidInstances: C{bool} whether to ignore instance errors.
         @return: a set of Instances for each recurrence in the set.
         """
@@ -1368,14 +1369,14 @@
         @param componentSet: the set of components that are to make up the
                 recurrence set. These MUST all be components with the same UID
                 and type, forming a proper recurring set.
-        @param limit: L{PyCalendarDateTime} value representing the end of the expansion.
+        @param limit: L{DateTime} value representing the end of the expansion.
 
         @param componentSet: the set of components that are to make up the recurrence set.
             These MUST all be components with the same UID and type, forming a proper
             recurring set.
         @type componentSet: C{list}
         @param limit: the end of the expansion
-        @type limit: L{PyCalendarDateTime}
+        @type limit: L{DateTime}
         @param ignoreInvalidInstances: whether or not invalid recurrences raise an exception
         @type ignoreInvalidInstances: C{bool}
         @param normalizeFunction: a function used to normalize date/time values in instances
@@ -1451,7 +1452,7 @@
         There is always some new thing that will surprise you.
 
         @param rid: recurrence-id value
-        @type rid: L{PyCalendarDateTime} or C{str}
+        @type rid: L{DateTime} or C{str}
         @param allowCancelled: whether to allow a STATUS:CANCELLED override
         @type allowCancelled: C{bool}
         @param allowExcluded: whether to derive an instance for an existing EXDATE
@@ -1469,7 +1470,7 @@
             return None
 
         if isinstance(rid, str):
-            rid = PyCalendarDateTime.parseText(rid) if rid else None
+            rid = DateTime.parseText(rid) if rid else None
 
         # TODO: Check that the recurrence-id is a valid instance
         # For now we just check that there is no matching EXDATE
@@ -1586,7 +1587,7 @@
             # Pre-cache instance expansion up to the highest rid
             highest_rid = max(non_master_rids)
             self.cacheExpandedTimeRanges(
-                highest_rid + PyCalendarDuration(days=1),
+                highest_rid + Duration(days=1),
                 ignoreInvalidInstances=ignoreInvalidInstances
             )
         for rid in rids:
@@ -1600,7 +1601,7 @@
         Test whether the specified recurrence-id is a valid instance in this event.
 
         @param rid: recurrence-id value
-        @type rid: L{PyCalendarDateTime}
+        @type rid: L{DateTime}
 
         @return: C{bool}
         """
@@ -1984,12 +1985,12 @@
 
     def gettimezone(self):
         """
-        Get the PyCalendarTimezone for a Timezone component.
+        Get the Timezone for a Timezone component.
 
-        @return: L{PyCalendarTimezone} if this is a VTIMEZONE, otherwise None.
+        @return: L{Timezone} if this is a VTIMEZONE, otherwise None.
         """
         if self.name() == "VTIMEZONE":
-            return PyCalendarTimezone(tzid=self._pycalendar.getID())
+            return Timezone(tzid=self._pycalendar.getID())
         elif self.name() == "VCALENDAR":
             for component in self.subcomponents():
                 if component.name() == "VTIMEZONE":
@@ -2977,7 +2978,7 @@
             # Bump all components
             self.replacePropertyInAllComponents(Property("SEQUENCE", newseq))
 
-        self.replacePropertyInAllComponents(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+        self.replacePropertyInAllComponents(Property("DTSTAMP", DateTime.getNowUTC()))
 
 
     def sequenceInSync(self, oldcalendar):
@@ -3059,7 +3060,7 @@
             dtend = self.getProperty("DTEND")
             duration = self.getProperty("DURATION")
 
-            timeRange = PyCalendarPeriod(
+            timeRange = Period(
                 start=dtstart.value(),
                 end=dtend.value()    if dtend is not None else None,
                 duration=duration.value() if duration is not None else None,
@@ -3311,7 +3312,7 @@
         Determine whether an event exists completely prior to a given moment.
 
         @param limit: the moment to compare against.
-        @type limit: L{PyCalendarDateTime}
+        @type limit: L{DateTime}
 
         @return: a C{bool}, True if the event has any instances occurring after
         limit, False otherwise.
@@ -3369,13 +3370,13 @@
     start.setDateOnly(False)
     if tzexpanded:
         if start != tzexpanded[0][0]:
-            results.append((str(start), PyCalendarUTCOffsetValue(tzexpanded[0][1]).getText(),))
+            results.append((str(start), UTCOffsetValue(tzexpanded[0][1]).getText(),))
     else:
-        results.append((str(start), PyCalendarUTCOffsetValue(tzcomp._pycalendar.getTimezoneOffsetSeconds(start)).getText(),))
+        results.append((str(start), UTCOffsetValue(tzcomp._pycalendar.getTimezoneOffsetSeconds(start)).getText(),))
     for tzstart, _ignore_tzoffsetfrom, tzoffsetto in tzexpanded:
         results.append((
             tzstart.getText(),
-            PyCalendarUTCOffsetValue(tzoffsetto).getText(),
+            UTCOffsetValue(tzoffsetto).getText(),
         ))
 
     return results
@@ -3388,7 +3389,7 @@
     time range.
 
     @param tzdata: the iCalendar data containing a VTIMEZONE.
-    @type tzdata: L{PyCalendar}
+    @type tzdata: L{Calendar}
     @param start: date for the start of the expansion.
     @type start: C{date}
     @param end: date for the end of the expansion.

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/icaldav.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/icaldav.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/icaldav.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -29,14 +29,14 @@
     """
     CalDAV resource.
     """
-    def isCalendarCollection():
+    def isCalendarCollection(): #@NoSelf
         """
         (CalDAV-access-10, Section 4.2)
         @return: True if this resource is a calendar collection, False
             otherwise.
         """
 
-    def isSpecialCollection(collectiontype):
+    def isSpecialCollection(collectiontype): #@NoSelf
         """
         (CalDAV-access-10, Section 4.2)
         @param collectiontype: L{WebDAVElement} for the collection type to test for.
@@ -44,30 +44,30 @@
             False otherwise.
         """
 
-    def isPseudoCalendarCollection():
+    def isPseudoCalendarCollection(): #@NoSelf
         """
         @return: True if this resource is a calendar collection like (e.g.
             a regular calendar collection or schedule inbox/outbox), False
             otherwise.
         """
 
-    def findCalendarCollections(depth):
+    def findCalendarCollections(depth): #@NoSelf
         """
         Returns an iterable of child calendar collection resources for the given
         depth.
-        Because resources do not know their request URIs, chidren are returned
+        Because resources do not know their request URIs, children are returned
         as tuples C{(resource, uri)}, where C{resource} is the child resource
         and C{uri} is a URL path relative to this resource.
         @param depth: the search depth (one of "0", "1", or "infinity")
         @return: an iterable of tuples C{(resource, uri)}.
         """
 
-    def createCalendar(request):
+    def createCalendar(request): #@NoSelf
         """
         Create a calendar collection for this resource.
         """
 
-    def iCalendar():
+    def iCalendar(): #@NoSelf
         """
         Instantiate an iCalendar component object representing this resource or
         its child with the given name.
@@ -78,52 +78,42 @@
         @return: a L{twistedcaldav.ical.Component} of type C{"VCALENDAR"}.
         """
 
-    def iCalendarText():
-        """
-        Obtains the iCalendar text representing this resource or its child with
-        the given name.
-        The behavior of this method is not specified if it is called on a
-        resource that is not a calendar collection or a calendar resource within
-        a calendar collection.
 
-        @return: a string containing iCalendar text with a top-level component
-            of type C{"VCALENDAR"}.
-        """
 
 class ICalendarPrincipalResource(IDAVResource):
     """
     CalDAV principle resource.
     """
-    def principalUID():
+    def principalUID(): #@NoSelf
         """
         @return: the user id for this principal.
         """
 
-    def calendarHomeURLs():
+    def calendarHomeURLs(): #@NoSelf
         """
         @return: a list of calendar home URLs for this principal's calendar user.
         """
 
-    def calendarUserAddresses():
+    def calendarUserAddresses(): #@NoSelf
         """
         @return: a list of calendar user addresses for this principal's calendar
             user.
         """
 
-    def calendarFreeBusyURIs(self, request):
+    def calendarFreeBusyURIs(request): #@NoSelf
         """
         @param request: the request being processed.
         @return: a L{Deferred} list of URIs for calendars that contribute to
             free-busy for this principal's calendar user.
         """
 
-    def scheduleInboxURL():
+    def scheduleInboxURL(): #@NoSelf
         """
         Get the schedule INBOX URL for this principal's calendar user.
         @return: a string containing the URL from the schedule-inbox-URL property.
         """
 
-    def scheduleOutboxURL():
+    def scheduleOutboxURL(): #@NoSelf
         """
         Get the schedule OUTBOX URL for this principal's calendar user.
         @return: a string containing the URL from the schedule-outbox-URL property.

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/instance.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/instance.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/instance.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -21,10 +21,10 @@
 from twistedcaldav.config import config
 from twistedcaldav.dateops import normalizeForIndex, differenceDateTime
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.period import PyCalendarPeriod
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.period import Period
+from pycalendar.timezone import Timezone
 
 class TooManyInstancesError(Exception):
 
@@ -80,7 +80,7 @@
             (trigger, related, repeat, duration) = alarm.getTriggerDetails()
 
             # Handle relative vs absolute triggers
-            if isinstance(trigger, PyCalendarDateTime):
+            if isinstance(trigger, DateTime):
                 # Absolute trigger
                 start = trigger
             else:
@@ -135,7 +135,7 @@
         @param componentSet: the set of components that are to make up the
                 recurrence set. These MUST all be components with the same UID
                 and type, forming a proper recurring set.
-        @param limit: L{PyCalendarDateTime} value representing the end of the expansion.
+        @param limit: L{DateTime} value representing the end of the expansion.
         """
 
         # Look at each component type
@@ -232,10 +232,10 @@
         if end is None:
             if not start.isDateOnly():
                 # Timed event with zero duration
-                duration = PyCalendarDuration(days=0)
+                duration = Duration(days=0)
             else:
                 # All day event default duration is one day
-                duration = PyCalendarDuration(days=1)
+                duration = Duration(days=1)
             end = start + duration
         else:
             duration = differenceDateTime(start, end)
@@ -248,7 +248,7 @@
         Add the specified master VEVENT Component to the instance list, expanding it
         within the supplied time range.
         @param component: the Component to expand
-        @param limit: the end L{PyCalendarDateTime} for expansion
+        @param limit: the end L{DateTime} for expansion
         """
 
         details = self._getMasterEventDetails(component)
@@ -330,7 +330,7 @@
         Add the specified master VTODO Component to the instance list, expanding it
         within the supplied time range.
         @param component: the Component to expand
-        @param limit: the end L{PyCalendarDateTime} for expansion
+        @param limit: the end L{DateTime} for expansion
         """
         details = self._getMasterToDoDetails(component)
         if details is None:
@@ -370,7 +370,7 @@
             # than the master DTSTART, and if we exclude those, the associated
             # overridden instances will cause an InvalidOverriddenInstance.
             limited = rrules.expand(rulestart,
-                PyCalendarPeriod(PyCalendarDateTime(1900, 1, 1), upperlimit), expanded)
+                Period(DateTime(1900, 1, 1), upperlimit), expanded)
             for startDate in expanded:
                 startDate = self.normalizeFunction(startDate)
                 endDate = startDate + duration
@@ -478,7 +478,7 @@
         Add the specified master VFREEBUSY Component to the instance list, expanding it
         within the supplied time range.
         @param component: the Component to expand
-        @param limit: the end L{PyCalendarDateTime} for expansion
+        @param limit: the end L{DateTime} for expansion
         """
 
         start = component.getStartDateUTC()
@@ -519,7 +519,7 @@
         depending on the presence of the properties. If unbounded at one or both ends, we will
         set the time to 1/1/1900 in the past and 1/1/3000 in the future.
         @param component: the Component to expand
-        @param limit: the end L{PyCalendarDateTime} for expansion
+        @param limit: the end L{DateTime} for expansion
         """
 
         start = component.getStartDateUTC()
@@ -531,7 +531,7 @@
             # If the availability is beyond the end of the range we want, ignore it
             return
         if start is None:
-            start = PyCalendarDateTime(1900, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            start = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         start = self.normalizeFunction(start)
 
         end = component.getEndDateUTC()
@@ -539,7 +539,7 @@
             # If the availability is before the start of the range we want, ignore it
             return
         if end is None:
-            end = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            end = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         end = self.normalizeFunction(end)
 
         self.addInstance(Instance(component, start, end))

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/linkresource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/linkresource.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/linkresource.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -47,16 +47,17 @@
     case of a missing underlying resource (broken link) as indicated by self._linkedResource being None.
     """
     log = Logger()
-    
+
     def __init__(self, parent, link_url):
         self.parent = parent
         self.linkURL = link_url
         self.loopDetect = set()
         super(LinkResource, self).__init__(self.parent.principalCollections())
 
+
     @inlineCallbacks
     def linkedResource(self, request):
-        
+
         if not hasattr(self, "_linkedResource"):
             if self.linkURL in self.loopDetect:
                 raise HTTPError(StatusResponse(responsecode.LOOP_DETECTED, "Recursive link target: %s" % (self.linkURL,)))
@@ -67,17 +68,20 @@
 
         if self._linkedResource is None:
             raise HTTPError(StatusResponse(responsecode.NOT_FOUND, "Missing link target: %s" % (self.linkURL,)))
-            
+
         returnValue(self._linkedResource)
 
+
     def isCollection(self):
         return True if hasattr(self, "_linkedResource") else False
 
+
     def resourceType(self):
         return self._linkedResource.resourceType() if hasattr(self, "_linkedResource") else davxml.ResourceType.link
-        
+
+
     def locateChild(self, request, segments):
-        
+
         def _defer(result):
             if result is None:
                 return (self, server.StopTraversal)
@@ -87,6 +91,7 @@
         d.addCallback(_defer)
         return d
 
+
     @inlineCallbacks
     def renderHTTP(self, request):
         linked_to = (yield self.linkedResource(request))
@@ -95,27 +100,33 @@
         else:
             returnValue(http.StatusResponse(responsecode.OK, "Link resource with missing target: %s" % (self.linkURL,)))
 
+
     def getChild(self, name):
         return self._linkedResource.getChild(name) if hasattr(self, "_linkedResource") else None
 
+
     @inlineCallbacks
     def hasProperty(self, property, request):
         hosted = (yield self.linkedResource(request))
         result = (yield hosted.hasProperty(property, request)) if hosted else False
         returnValue(result)
 
+
     @inlineCallbacks
     def readProperty(self, property, request):
         hosted = (yield self.linkedResource(request))
         result = (yield hosted.readProperty(property, request)) if hosted else None
         returnValue(result)
 
+
     @inlineCallbacks
     def writeProperty(self, property, request):
         hosted = (yield self.linkedResource(request))
         result = (yield hosted.writeProperty(property, request)) if hosted else None
         returnValue(result)
 
+
+
 class LinkFollowerMixIn(object):
 
     @inlineCallbacks
@@ -128,6 +139,5 @@
             if linked_to is None:
                 break
             resource = linked_to
-        
+
         returnValue((resource, path))
-        

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/localization.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/localization.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/localization.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -24,7 +24,7 @@
 from locale import normalize
 
 from twext.python.log import Logger
-from pycalendar.duration import PyCalendarDuration
+from pycalendar.duration import Duration
 
 try:
     from Foundation import (
@@ -89,12 +89,12 @@
 helper methods for date formatting:
 
     with translationTo('en') as trans:
-        print(trans.dtDate(PyCalendarDateTime.getToday()))
+        print(trans.dtDate(DateTime.getToday()))
 
     ... Thursday, October 23, 2008
 
     with translationTo('fr') as trans:
-        print(trans.dtDate(PyCalendarDateTime.getToday()))
+        print(trans.dtDate(DateTime.getToday()))
 
     ... Jeudi, Octobre 23, 2008
 
@@ -124,12 +124,13 @@
                 localedir=localeDir, languages=[lang, 'en'], fallback=True)
             self.translations[key] = self.translation
 
+
     def __enter__(self):
         # Get the caller's globals so we can rebind their '_' to our translator
         caller_globals = inspect.stack()[1][0].f_globals
 
         # Store whatever '_' is already bound to so we can restore it later
-        if caller_globals.has_key('_'):
+        if '_' in caller_globals:
             self.prev = caller_globals['_']
 
         # Rebind '_' to our translator
@@ -138,6 +139,7 @@
         # What we return here is accessible to the caller via the 'as' clause
         return self
 
+
     def __exit__(self, type, value, traceback):
         # Restore '_' if it previously had a value
         if hasattr(self, 'prev'):
@@ -146,13 +148,16 @@
         # Don't swallow exceptions
         return False
 
+
     def monthAbbreviation(self, monthNumber):
         return self.translation.ugettext(monthsAbbrev[monthNumber])
 
+
     def date(self, component):
         dtStart = component.propertyValue("DTSTART")
         return self.dtDate(dtStart)
 
+
     def time(self, component):
         """
         Examples:
@@ -191,9 +196,9 @@
             else:
                 if dtStart.isDateOnly():
                     dtEnd = None
-                    duration = PyCalendarDuration(days=1)
+                    duration = Duration(days=1)
                 else:
-                    dtEnd = dtStart + PyCalendarDuration(days=1)
+                    dtEnd = dtStart + Duration(days=1)
                     dtEnd.setHHMMSS(0, 0, 0)
                     duration = dtEnd - dtStart
 
@@ -225,6 +230,7 @@
             }
         )
 
+
     def dtTime(self, val, includeTimezone=True):
         if val.isDateOnly():
             return ""
@@ -252,6 +258,7 @@
 
         return result
 
+
     def dtDuration(self, val):
 
         # Bind to '_' so pygettext.py will pick this up for translation
@@ -265,7 +272,7 @@
             parts.append(_("1 day"))
         elif days > 1:
             parts.append(_("%(dayCount)d days") %
-                { 'dayCount' : days })
+                {'dayCount' : days})
 
         hours = divmod(total / 3600, 24)[1]
         minutes = divmod(total / 60, 60)[1]
@@ -275,19 +282,19 @@
             parts.append(_("1 hour"))
         elif hours > 1:
             parts.append(_("%(hourCount)d hours") %
-                { 'hourCount' : hours })
+                {'hourCount' : hours})
 
         if minutes == 1:
             parts.append(_("1 minute"))
         elif minutes > 1:
             parts.append(_("%(minuteCount)d minutes") %
-                { 'minuteCount' : minutes })
+                {'minuteCount' : minutes})
 
         if seconds == 1:
             parts.append(_("1 second"))
         elif seconds > 1:
             parts.append(_("%(secondCount)d seconds") %
-                { 'secondCount' : seconds })
+                {'secondCount' : seconds})
 
         return " ".join(parts)
 
@@ -398,12 +405,14 @@
                     else:
                         log.info("%s is up to date" % (moFile,))
 
+
+
 class ParseError(Exception):
     pass
 
 
+
 def convertStringsFile(src, dest):
-    strings = { }
 
     dir = os.path.dirname(dest)
 
@@ -458,13 +467,13 @@
 
     result = struct.pack(
         "Iiiiiii",
-        0x950412DEL,         # magic number
-        0,                   # file format revision
-        len(originals),      # number of strings
-        28,                  # offset of table with original strings
-        28+len(originals)*8, # offset of table with translation strings
-        0,                   # size of hashing table
-        0                    # offset of hashing table
+        0x950412DEL,           # magic number
+        0,                     # file format revision
+        len(originals),        # number of strings
+        28,                    # offset of table with original strings
+        28 + len(originals) * 8, # offset of table with translation strings
+        0,                     # size of hashing table
+        0                      # offset of hashing table
     )
     result += array.array("i", keyDescriptors).tostring()
     result += array.array("i", valueDescriptors).tostring()
@@ -475,6 +484,7 @@
         outFile.write(result)
 
 
+
 def getLanguage(config):
     """
     If the language has been specified explicitly in the config, return it.  Otherwise

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachelock.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachelock.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachelock.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -15,7 +15,7 @@
 ##
 
 from twistedcaldav.memcacher import Memcacher
-from twisted.internet.defer import inlineCallbacks, Deferred, returnValue,\
+from twisted.internet.defer import inlineCallbacks, Deferred, returnValue, \
     succeed
 from twisted.internet import reactor
 import time
@@ -24,7 +24,7 @@
 
     def __init__(self, namespace, locktoken, timeout=5.0, retry_interval=0.1, expire_time=0):
         """
-        
+
         @param namespace: a unique namespace for this lock's tokens
         @type namespace: C{str}
         @param locktoken: the name of the locktoken
@@ -44,31 +44,33 @@
         self._expire_time = expire_time
         self._hasLock = False
 
+
     def _getMemcacheProtocol(self):
-        
+
         result = super(MemcacheLock, self)._getMemcacheProtocol()
 
         if isinstance(result, Memcacher.nullCacher):
             raise AssertionError("No implementation of shared locking without memcached")
-        
+
         return result
 
+
     @inlineCallbacks
     def acquire(self):
-        
+
         assert not self._hasLock, "Lock already acquired."
-    
+
         timeout_at = time.time() + self._timeout
         waiting = False
         while True:
-            
+
             result = (yield self.add(self._locktoken, "1", expireTime=self._expire_time))
             if result:
                 self._hasLock = True
                 if waiting:
                     self.log.debug("Got lock after waiting on %s" % (self._locktoken,))
                 break
-            
+
             if self._timeout and time.time() < timeout_at:
                 waiting = True
                 self.log.debug("Waiting for lock on %s" % (self._locktoken,))
@@ -80,13 +82,14 @@
             else:
                 self.log.debug("Timed out lock after waiting on %s" % (self._locktoken,))
                 raise MemcacheLockTimeoutError()
-        
+
         returnValue(True)
 
+
     def release(self):
-        
+
         assert self._hasLock, "Lock not acquired."
-    
+
         def _done(result):
             self._hasLock = False
             return result
@@ -95,18 +98,20 @@
         d.addCallback(_done)
         return d
 
+
     def clean(self):
-        
+
         if self._hasLock:
             return self.release()
         else:
             return succeed(True)
 
+
     def locked(self):
         """
         Test if the lock is currently being held.
         """
-        
+
         def _gotit(value):
             return value is not None
 
@@ -114,5 +119,7 @@
         d.addCallback(_gotit)
         return d
 
+
+
 class MemcacheLockTimeoutError(Exception):
     pass

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachepool.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachepool.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/memcachepool.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -99,6 +99,7 @@
             connector,
             reason)
 
+
     def buildProtocol(self, addr):
         """
         Attach the C{self.connectionPool} to the protocol so it can tell it,
@@ -167,6 +168,7 @@
         self._pendingConnects = 0
         self._commands = []
 
+
     def _isIdle(self):
         return (
             len(self._busyClients) == 0 and
@@ -174,6 +176,7 @@
             self._pendingConnects == 0
         )
 
+
     def _shutdownCallback(self):
         self.shutdown_requested = True
         if self._isIdle():
@@ -181,13 +184,14 @@
         self.shutdown_deferred = Deferred()
         return self.shutdown_deferred
 
+
     def _newClientConnection(self):
         """
         Create a new client connection.
 
         @return: A L{Deferred} that fires with the L{IProtocol} instance.
         """
-        self.log.debug("Initating new client connection to: %r" % (
+        self.log.debug("Initiating new client connection to: %r" % (
                 self._endpoint,))
         self._logClientStats()
 
@@ -219,7 +223,7 @@
 
         @param command: A C{str} representing an attribute of
             L{MemCacheProtocol}.
-        @parma args: Any positional arguments that should be passed to
+        @param args: Any positional arguments that should be passed to
             C{command}.
         @param kwargs: Any keyword arguments that should be passed to
             C{command}.
@@ -258,7 +262,7 @@
 
         @param command: A C{str} representing an attribute of
             L{MemCacheProtocol}.
-        @parma args: Any positional arguments that should be passed to
+        @param args: Any positional arguments that should be passed to
             C{command}.
         @param kwargs: Any keyword arguments that should be passed to
             C{command}.
@@ -371,24 +375,31 @@
     def get(self, *args, **kwargs):
         return self.performRequest('get', *args, **kwargs)
 
+
     def set(self, *args, **kwargs):
         return self.performRequest('set', *args, **kwargs)
 
+
     def checkAndSet(self, *args, **kwargs):
         return self.performRequest('checkAndSet', *args, **kwargs)
 
+
     def delete(self, *args, **kwargs):
         return self.performRequest('delete', *args, **kwargs)
 
+
     def add(self, *args, **kwargs):
         return self.performRequest('add', *args, **kwargs)
 
+
     def incr(self, *args, **kwargs):
         return self.performRequest('increment', *args, **kwargs)
 
+
     def decr(self, *args, **kwargs):
         return self.performRequest('decrement', *args, **kwargs)
 
+
     def flushAll(self, *args, **kwargs):
         return self.performRequest('flushAll', *args, **kwargs)
 

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/method/report_common.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/method/report_common.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -69,10 +69,10 @@
 
 from txdav.common.icommondatastore import IndexedSearchException
 
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
-from pycalendar.period import PyCalendarPeriod
+from pycalendar.duration import Duration
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
+from pycalendar.period import Period
 
 log = Logger()
 
@@ -436,8 +436,8 @@
         if entry:
 
             # Offset one day at either end to account for floating
-            cached_start = entry.timerange.start + PyCalendarDuration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
-            cached_end = entry.timerange.end - PyCalendarDuration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
+            cached_start = entry.timerange.start + Duration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
+            cached_end = entry.timerange.end - Duration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
 
             # Verify that the requested timerange lies within the cache timerange
             if compareDateTime(timerange.end, cached_end) <= 0 and compareDateTime(timerange.start, cached_start) >= 0:
@@ -559,8 +559,8 @@
             request.extendedLogItems["fb-uncached"] = request.extendedLogItems.get("fb-uncached", 0) + 1
 
             # We want to cache a large range of time based on the current date
-            cache_start = normalizeToUTC(PyCalendarDateTime.getToday() + PyCalendarDuration(days=0 - config.FreeBusyCacheDaysBack))
-            cache_end = normalizeToUTC(PyCalendarDateTime.getToday() + PyCalendarDuration(days=config.FreeBusyCacheDaysForward))
+            cache_start = normalizeToUTC(DateTime.getToday() + Duration(days=0 - config.FreeBusyCacheDaysBack))
+            cache_end = normalizeToUTC(DateTime.getToday() + Duration(days=config.FreeBusyCacheDaysForward))
 
             # If the requested timerange would fit in our allowed cache range, trigger the cache creation
             if compareDateTime(timerange.start, cache_start) >= 0 and compareDateTime(timerange.end, cache_end) <= 0:
@@ -602,7 +602,7 @@
         request.extendedLogItems["fb-cached"] = request.extendedLogItems.get("fb-cached", 0) + 1
 
         # Determine appropriate timezone (UTC is the default)
-        tzinfo = tz.gettimezone() if tz is not None else PyCalendarTimezone(utc=True)
+        tzinfo = tz.gettimezone() if tz is not None else Timezone(utc=True)
 
     # We care about separate instances for VEVENTs only
     aggregated_resources = {}
@@ -645,15 +645,15 @@
                 if float == 'Y':
                     fbstart.setTimezone(tzinfo)
                 else:
-                    fbstart.setTimezone(PyCalendarTimezone(utc=True))
+                    fbstart.setTimezone(Timezone(utc=True))
                 fbend = parseSQLTimestampToPyCalendar(end)
                 if float == 'Y':
                     fbend.setTimezone(tzinfo)
                 else:
-                    fbend.setTimezone(PyCalendarTimezone(utc=True))
+                    fbend.setTimezone(Timezone(utc=True))
 
                 # Clip instance to time range
-                clipped = clipPeriod(PyCalendarPeriod(fbstart, duration=fbend - fbstart), PyCalendarPeriod(timerange.start, timerange.end))
+                clipped = clipPeriod(Period(fbstart, duration=fbend - fbstart), Period(timerange.start, timerange.end))
 
                 # Double check for overlap
                 if clipped:
@@ -735,7 +735,7 @@
     @param timerange: the time-range in which to expand
     @type timerange: L{TimeRange}
     @param tzinfo: timezone for floating time calculations
-    @type tzinfo: L{PyCalendarTimezone}
+    @type tzinfo: L{Timezone}
     """
 
     # First expand the component
@@ -775,7 +775,7 @@
     @param calendar: the L{Component} that is the VCALENDAR containing the VEVENT's.
     @param fbinfo: the tuple used to store the three types of fb data.
     @param timerange: the time range to restrict free busy data to.
-    @param tzinfo: the L{PyCalendarTimezone} for the timezone to use for floating/all-day events.
+    @param tzinfo: the L{Timezone} for the timezone to use for floating/all-day events.
     """
 
     # Expand out the set of instances for the event with in the required range
@@ -820,10 +820,10 @@
         # Clip period for this instance - use duration for period end if that
         # is what original component used
         if instance.component.hasProperty("DURATION"):
-            period = PyCalendarPeriod(fbstart, duration=fbend - fbstart)
+            period = Period(fbstart, duration=fbend - fbstart)
         else:
-            period = PyCalendarPeriod(fbstart, fbend)
-        clipped = clipPeriod(period, PyCalendarPeriod(timerange.start, timerange.end))
+            period = Period(fbstart, fbend)
+        clipped = clipPeriod(period, Period(timerange.start, timerange.end))
 
         # Double check for overlap
         if clipped:
@@ -861,7 +861,7 @@
             assert isinstance(fb.value(), list), "FREEBUSY property does not contain a list of values: %r" % (fb,)
             for period in fb.value():
                 # Clip period for this instance
-                clipped = clipPeriod(period.getValue(), PyCalendarPeriod(timerange.start, timerange.end))
+                clipped = clipPeriod(period.getValue(), Period(timerange.start, timerange.end))
                 if clipped:
                     fbinfo[fbtype_mapper.get(fbtype, 0)].append(clipped)
 
@@ -880,12 +880,12 @@
         # Get overall start/end
         start = vav.getStartDateUTC()
         if start is None:
-            start = PyCalendarDateTime(1900, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            start = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         end = vav.getEndDateUTC()
         if end is None:
-            end = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-        period = PyCalendarPeriod(start, end)
-        overall = clipPeriod(period, PyCalendarPeriod(timerange.start, timerange.end))
+            end = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+        period = Period(start, end)
+        overall = clipPeriod(period, Period(timerange.start, timerange.end))
         if overall is None:
             continue
 
@@ -897,10 +897,10 @@
         last_end = timerange.start
         for period in periods:
             if last_end < period.getStart():
-                busyperiods.append(PyCalendarPeriod(last_end, period.getStart()))
+                busyperiods.append(Period(last_end, period.getStart()))
             last_end = period.getEnd()
         if last_end < timerange.end:
-            busyperiods.append(PyCalendarPeriod(last_end, timerange.end))
+            busyperiods.append(Period(last_end, timerange.end))
 
         # Add to actual results mapped by busy type
         fbtype = vav.propertyValue("BUSYTYPE")
@@ -947,10 +947,10 @@
             # Clip period for this instance - use duration for period end if that
             # is what original component used
             if instance.component.hasProperty("DURATION"):
-                period = PyCalendarPeriod(start, duration=end - start)
+                period = Period(start, duration=end - start)
             else:
-                period = PyCalendarPeriod(start, end)
-            clipped = clipPeriod(period, PyCalendarPeriod(timerange.start, timerange.end))
+                period = Period(start, end)
+            clipped = clipPeriod(period, Period(timerange.start, timerange.end))
             if clipped:
                 periods.append(clipped)
 
@@ -993,7 +993,7 @@
         fb.addProperty(attendee)
     fb.addProperty(Property("DTSTART", timerange.start))
     fb.addProperty(Property("DTEND", timerange.end))
-    fb.addProperty(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+    fb.addProperty(Property("DTSTAMP", DateTime.getNowUTC()))
     if len(fbinfo[0]) != 0:
         fb.addProperty(Property("FREEBUSY", fbinfo[0], {"FBTYPE": "BUSY"}))
     if len(fbinfo[1]) != 0:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/mkcolxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/mkcolxml.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/mkcolxml.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -45,11 +45,12 @@
     """
     name = "mkcol"
 
-    allowed_children = { (davxml.dav_namespace, "set"): (0, 1) }
+    allowed_children = {(davxml.dav_namespace, "set"): (0, 1)}
 
-    child_types = { "WebDAVUnknownElement": (0, None) }
+    child_types = {"WebDAVUnknownElement": (0, None)}
 
 
+
 @registerElement
 class MakeCollectionResponse (davxml.WebDAVElement):
     """
@@ -58,4 +59,4 @@
     """
     name = "mkcol-response"
 
-    allowed_children = { davxml.WebDAVElement: (0, None) }
+    allowed_children = {davxml.WebDAVElement: (0, None)}

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/notifications.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/notifications.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/notifications.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -48,43 +48,53 @@
         self._parent = parent
         CalDAVResource.__init__(self)
 
+
     def principalCollections(self):
         return self._parent.principalCollections()
 
+
     def isCollection(self):
         return False
 
+
     def resourceName(self):
         raise NotImplementedError
-        
+
+
     def http_PUT(self, request):
         return responsecode.FORBIDDEN
 
+
     @inlineCallbacks
     def http_DELETE(self, request):
-        
+
         response = (yield super(NotificationResource, self).http_DELETE(request))
         if response == responsecode.NO_CONTENT:
             yield self._parent.removedNotifictionMessage(request, self.resourceName())
         returnValue(response)
-    
+
+
+
 class NotificationCollectionResource(ReadOnlyNoCopyResourceMixIn, CalDAVResource):
 
     def notificationsDB(self):
-        
+
         if not hasattr(self, "_notificationsDB"):
             self._notificationsDB = NotificationsDatabase(self)
         return self._notificationsDB
 
+
     def isCollection(self):
         return True
 
+
     def resourceType(self):
         return davxml.ResourceType.notification
 
+
     @inlineCallbacks
     def addNotification(self, request, uid, xmltype, xmldata):
-        
+
         # Write data to file
         rname = uid + ".xml"
         yield self._writeNotification(request, uid, rname, xmltype, xmldata)
@@ -103,7 +113,7 @@
 
     @inlineCallbacks
     def deleteNotifictionMessageByUID(self, request, uid):
-        
+
         # See if it exists and delete the resource
         record = yield self.notificationsDB().recordForUID(uid)
         if record:
@@ -117,7 +127,7 @@
         record = yield self.notificationsDB().recordForName(rname)
         if record:
             yield self.deleteNotification(request, record)
-        
+
         returnValue(None)
 
 
@@ -131,13 +141,16 @@
         return maybeDeferred(self.notificationsDB().removeRecordForName, rname)
 
 
+
 class NotificationRecord(object):
-    
+
     def __init__(self, uid, name, xmltype):
         self.uid = uid
         self.name = name
         self.xmltype = xmltype
 
+
+
 class NotificationsDatabase(AbstractSQLDatabase):
     log = Logger()
 
@@ -154,35 +167,40 @@
         db_filename = os.path.join(self.resource.fp.path, NotificationsDatabase.db_basename)
         super(NotificationsDatabase, self).__init__(db_filename, True, autocommit=True)
 
+
     def allRecords(self):
-        
+
         records = self._db_execute("select * from NOTIFICATIONS")
         return [self._makeRecord(row) for row in (records if records is not None else ())]
-    
+
+
     def recordForUID(self, uid):
-        
+
         row = self._db_execute("select * from NOTIFICATIONS where UID = :1", uid)
         return self._makeRecord(row[0]) if row else None
-    
+
+
     def addOrUpdateRecord(self, record):
 
         self._db_execute("""insert or replace into NOTIFICATIONS (UID, NAME, TYPE)
             values (:1, :2, :3)
             """, record.uid, record.name, record.xmltype,
         )
-            
+
         self._db_execute(
             """
             insert or replace into REVISIONS (NAME, REVISION, DELETED)
             values (:1, :2, :3)
             """, record.name, self.bumpRevision(fast=True), 'N',
         )
-    
+
+
     def removeRecordForUID(self, uid):
 
         record = self.recordForUID(uid)
         self.removeRecordForName(record.name)
-    
+
+
     def removeRecordForName(self, rname):
 
         self._db_execute("delete from NOTIFICATIONS where NAME = :1", rname)
@@ -192,12 +210,13 @@
             where NAME = :3
             """, self.bumpRevision(fast=True), 'Y', rname
         )
-    
+
+
     def whatchanged(self, revision):
 
         results = [(name.encode("utf-8"), deleted) for name, deleted in self._db_execute("select NAME, DELETED from REVISIONS where REVISION > :1", revision)]
-        results.sort(key=lambda x:x[1])
-        
+        results.sort(key=lambda x: x[1])
+
         changed = []
         deleted = []
         for name, wasdeleted in results:
@@ -209,14 +228,16 @@
                     changed.append(name)
             else:
                 raise SyncTokenValidException
-        
+
         return changed, deleted,
 
+
     def lastRevision(self):
         return self._db_value_for_sql(
             "select REVISION from REVISION_SEQUENCE"
         )
 
+
     def bumpRevision(self, fast=False):
         self._db_execute(
             """
@@ -230,18 +251,21 @@
             """,
         )
 
+
     def _db_version(self):
         """
         @return: the schema version assigned to this index.
         """
         return NotificationsDatabase.schema_version
 
+
     def _db_type(self):
         """
         @return: the collection type assigned to this index.
         """
         return NotificationsDatabase.db_type
 
+
     def _db_init_data_tables(self, q):
         """
         Initialise the underlying database tables.
@@ -302,6 +326,7 @@
             """
         )
 
+
     def _db_upgrade_data_tables(self, q, old_version):
         """
         Upgrade the data from an older version of the DB.
@@ -310,7 +335,7 @@
         # Nothing to do as we have not changed the schema
         pass
 
+
     def _makeRecord(self, row):
-        
+
         return NotificationRecord(*[str(item) if type(item) == types.UnicodeType else item for item in row])
-

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/calendarqueryfilter.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/calendarqueryfilter.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/calendarqueryfilter.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -28,8 +28,8 @@
 from twistedcaldav.dateops import timeRangesOverlap
 from twistedcaldav.ical import Component, Property
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 log = Logger()
 
@@ -89,7 +89,7 @@
                     instances = None
                 else:
                     # Expand the instances up to infinity
-                    instances = component.expandTimeRanges(PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), ignoreInvalidInstances=True)
+                    instances = component.expandTimeRanges(DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True)), ignoreInvalidInstances=True)
             else:
                 instances = component.expandTimeRanges(maxend, ignoreInvalidInstances=True)
         else:
@@ -117,7 +117,7 @@
         Set the default timezone to use with this query.
         @param calendar: a L{Component} for the VCALENDAR containing the one
             VTIMEZONE that we want
-        @return: the L{PyCalendarTimezone} derived from the VTIMEZONE or utc.
+        @return: the L{Timezone} derived from the VTIMEZONE or utc.
         """
 
         if tzelement is None:
@@ -127,7 +127,7 @@
         elif isinstance(tzelement, Component):
             tz = tzelement.gettimezone()
         if tz is None:
-            tz = PyCalendarTimezone(utc=True)
+            tz = Timezone(utc=True)
         self.child.settzinfo(tz)
         return tz
 
@@ -357,7 +357,7 @@
     def settzinfo(self, tzinfo):
         """
         Set the default timezone to use with this query.
-        @param tzinfo: a L{PyCalendarTimezone} to use.
+        @param tzinfo: a L{Timezone} to use.
         """
 
         # Give tzinfo to any TimeRange we have
@@ -374,7 +374,7 @@
         Get the date farthest into the future in any time-range elements
 
         @param currentMaximum: current future value to compare with
-        @type currentMaximum: L{PyCalendarDateTime}
+        @type currentMaximum: L{DateTime}
         """
 
         # Give tzinfo to any TimeRange we have
@@ -471,7 +471,7 @@
     def settzinfo(self, tzinfo):
         """
         Set the default timezone to use with this query.
-        @param tzinfo: a L{PyCalendarTimezone} to use.
+        @param tzinfo: a L{Timezone} to use.
         """
 
         # Give tzinfo to any TimeRange we have
@@ -484,7 +484,7 @@
         Get the date farthest into the future in any time-range elements
 
         @param currentMaximum: current future value to compare with
-        @type currentMaximum: L{PyCalendarDateTime}
+        @type currentMaximum: L{DateTime}
         """
 
         # Give tzinfo to any TimeRange we have
@@ -652,15 +652,15 @@
         if "start" not in xml_element.attributes and "end" not in xml_element.attributes:
             raise ValueError("One of 'start' or 'end' must be present in CALDAV:time-range")
 
-        self.start = PyCalendarDateTime.parseText(xml_element.attributes["start"]) if "start" in xml_element.attributes else None
-        self.end = PyCalendarDateTime.parseText(xml_element.attributes["end"]) if "end" in xml_element.attributes else None
+        self.start = DateTime.parseText(xml_element.attributes["start"]) if "start" in xml_element.attributes else None
+        self.end = DateTime.parseText(xml_element.attributes["end"]) if "end" in xml_element.attributes else None
         self.tzinfo = None
 
 
     def settzinfo(self, tzinfo):
         """
         Set the default timezone to use with this query.
-        @param tzinfo: a L{PyCalendarTimezone} to use.
+        @param tzinfo: a L{Timezone} to use.
         """
 
         # Give tzinfo to any TimeRange we have

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_calendarquery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_calendarquery.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_calendarquery.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -17,7 +17,7 @@
 from twistedcaldav import caldavxml
 from twistedcaldav.query import calendarqueryfilter
 import twistedcaldav.test.util
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.timezone import Timezone
 from twistedcaldav.query.calendarquery import sqlcalendarquery
 
 class Tests(twistedcaldav.test.util.TestCase):
@@ -36,7 +36,7 @@
             )
         )
         filter = calendarqueryfilter.Filter(filter)
-        filter.child.settzinfo(PyCalendarTimezone(tzid="America/New_York"))
+        filter.child.settzinfo(Timezone(tzid="America/New_York"))
 
         sql, args = sqlcalendarquery(filter)
         self.assertTrue(sql.find("RESOURCE") != -1)
@@ -60,7 +60,7 @@
             )
         )
         filter = calendarqueryfilter.Filter(filter)
-        filter.child.settzinfo(PyCalendarTimezone(tzid="America/New_York"))
+        filter.child.settzinfo(Timezone(tzid="America/New_York"))
 
         sql, args = sqlcalendarquery(filter)
         self.assertTrue(sql.find("RESOURCE") != -1)
@@ -88,7 +88,7 @@
             )
         )
         filter = calendarqueryfilter.Filter(filter)
-        filter.child.settzinfo(PyCalendarTimezone(tzid="America/New_York"))
+        filter.child.settzinfo(Timezone(tzid="America/New_York"))
 
         sql, args = sqlcalendarquery(filter)
         self.assertTrue(sql.find("RESOURCE") != -1)
@@ -119,7 +119,7 @@
             )
         )
         filter = calendarqueryfilter.Filter(filter)
-        filter.child.settzinfo(PyCalendarTimezone(tzid="America/New_York"))
+        filter.child.settzinfo(Timezone(tzid="America/New_York"))
 
         sql, args = sqlcalendarquery(filter)
         self.assertTrue(sql.find("RESOURCE") != -1)

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_queryfilter.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_queryfilter.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/query/test/test_queryfilter.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -18,7 +18,7 @@
 from twistedcaldav.query import calendarqueryfilter
 import twistedcaldav.test.util
 from twistedcaldav.caldavxml import TimeZone
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.timezone import Timezone
 
 class Tests(twistedcaldav.test.util.TestCase):
 
@@ -227,4 +227,4 @@
 END:VCALENDAR
 """))
 
-        self.assertTrue(isinstance(tz, PyCalendarTimezone))
+        self.assertTrue(isinstance(tz, Timezone))

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/resource.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/resource.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -1436,11 +1436,6 @@
         returnValue(caldata)
 
 
-    def iCalendarText(self):
-        # storebridge handles this method
-        raise NotImplementedError()
-
-
     def iCalendar(self):
         # storebridge handles this method
         raise NotImplementedError()

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/sharing.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/sharing.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -46,7 +46,7 @@
 from twistedcaldav.directory.wiki import WikiDirectoryService, getWikiAccess
 from twistedcaldav.linkresource import LinkFollowerMixIn
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 
 # FIXME: Get rid of these imports
@@ -740,7 +740,7 @@
         typeAttr = {'shared-type': self.sharedResourceType()}
         xmltype = customxml.InviteNotification(**typeAttr)
         xmldata = customxml.Notification(
-            customxml.DTStamp.fromString(PyCalendarDateTime.getNowUTC().getText()),
+            customxml.DTStamp.fromString(DateTime.getNowUTC().getText()),
             customxml.InviteNotification(
                 customxml.UID.fromString(invitation.uid()),
                 element.HRef.fromString(userid),
@@ -1362,7 +1362,7 @@
         record = shareePrincipal.record
 
         xmldata = customxml.Notification(
-            customxml.DTStamp.fromString(PyCalendarDateTime.getNowUTC().getText()),
+            customxml.DTStamp.fromString(DateTime.getNowUTC().getText()),
             customxml.InviteReply(
                 *(
                     (

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/sql.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/sql.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/sql.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -18,7 +18,7 @@
 Generic SQL database access object.
 """
 
-__all__ = [ 
+__all__ = [
     "db_prefix",
     "DatabaseError",
     "AbstractSQLDatabase",
@@ -50,7 +50,7 @@
 
     def __init__(self, dbpath, persistent, autocommit=False):
         """
-        
+
         @param dbpath: the path where the db file is stored.
         @type dbpath: str
         @param persistent: C{True} if the data in the DB must be perserved during upgrades,
@@ -63,21 +63,25 @@
         self.persistent = persistent
         self.autocommit = autocommit
 
+
     def __repr__(self):
         return "<%s %r>" % (self.__class__.__name__, self.dbpath)
 
+
     def _db_version(self):
         """
         @return: the schema version assigned to this index.
         """
         raise NotImplementedError
-        
+
+
     def _db_type(self):
         """
         @return: the collection type assigned to this index.
         """
         raise NotImplementedError
-        
+
+
     def _db(self):
         """
         Access the underlying database.
@@ -108,7 +112,7 @@
                 # Create CALDAV table if needed
 
                 if self._test_schema_table(q):
-                    
+
                     version, dbtype = self._get_schema_version(q)
 
                     if (version != self._db_version()) or (dbtype != self._db_type()):
@@ -130,7 +134,7 @@
                         if version != self._db_version():
                             log.error("Database %s has different schema (v.%s vs. v.%s)"
                                       % (db_filename, version, self._db_version()))
-                            
+
                             # Upgrade the DB
                             return self._db_upgrade(version)
 
@@ -139,9 +143,11 @@
 
                 self._db_connection.commit()
             finally:
-                if q is not None: q.close()
+                if q is not None:
+                    q.close()
         return self._db_connection
 
+
     def _test_schema_table(self, q):
         q.execute("""
         select (1) from SQLITE_MASTER
@@ -149,6 +155,7 @@
         """)
         return q.fetchone()
 
+
     def _get_schema_version(self, q):
         q.execute(
             """
@@ -157,7 +164,8 @@
             """)
         version = q.fetchone()
 
-        if version is not None: version = version[0]
+        if version is not None:
+            version = version[0]
 
         q.execute(
             """
@@ -166,10 +174,12 @@
             """)
         dbtype = q.fetchone()
 
-        if dbtype is not None: dbtype = dbtype[0]
+        if dbtype is not None:
+            dbtype = dbtype[0]
 
         return version, dbtype
 
+
     def _db_init(self, db_filename, q):
         """
         Initialise the underlying database tables.
@@ -183,7 +193,7 @@
         old_isolation = self._db_connection.isolation_level
         self._db_connection.isolation_level = None
         q.execute("begin exclusive transaction")
-        
+
         # We re-check whether the schema table is present again AFTER we've got an exclusive
         # lock as some other server process may have snuck in and already created it
         # before we got the lock, or whilst we were waiting for it.
@@ -199,6 +209,7 @@
 
         self._db_connection.isolation_level = old_isolation
 
+
     def _db_init_schema_table(self, q):
         """
         Initialise the underlying database tables.
@@ -229,6 +240,7 @@
             """, [self._db_type()]
         )
 
+
     def _db_init_data_tables(self, q):
         """
         Initialise the underlying database tables.
@@ -237,6 +249,7 @@
         """
         raise NotImplementedError
 
+
     def _db_recreate(self, do_commit=True):
         """
         Recreate the database tables.
@@ -246,15 +259,17 @@
         if do_commit:
             self._db_commit()
 
+
     def _db_can_upgrade(self, old_version):
-        
+
         return self.persistent
 
+
     def _db_upgrade(self, old_version):
         """
         Upgrade the database tables.
         """
-        
+
         if self._db_can_upgrade(old_version):
             self._db_connection = sqlite.connect(self.dbpath, isolation_level=None)
             q = self._db_connection.cursor()
@@ -278,6 +293,7 @@
 
         return self._db()
 
+
     def _db_upgrade_data_tables(self, q, old_version):
         """
         Upgrade the data from an older version of the DB.
@@ -286,6 +302,7 @@
         # cannot be thrown away.
         raise NotImplementedError("Persistent databases MUST support an upgrade method.")
 
+
     def _db_upgrade_schema(self, q):
         """
         Upgrade the stored schema version to the current one.
@@ -297,11 +314,13 @@
             """, [self._db_version()]
         )
 
+
     def _db_close(self):
         if hasattr(self, "_db_connection"):
             self._db_connection.close()
             del self._db_connection
 
+
     def _db_values_for_sql(self, sql, *query_params):
         """
         Execute an SQL query and obtain the resulting values.
@@ -313,6 +332,7 @@
         """
         return (row[0] for row in self._db_execute(sql, *query_params))
 
+
     def _db_value_for_sql(self, sql, *query_params):
         """
         Execute an SQL query and obtain a single value.
@@ -328,6 +348,7 @@
             value = row
         return value
 
+
     def _db_execute(self, sql, *query_params):
         """
         Execute an SQL query and obtain the resulting values.
@@ -347,5 +368,10 @@
         finally:
             q.close()
 
-    def _db_commit  (self): self._db_connection.commit()
-    def _db_rollback(self): self._db_connection.rollback()
+
+    def _db_commit(self):
+        self._db_connection.commit()
+
+
+    def _db_rollback(self):
+        self._db_connection.rollback()

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/storebridge.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/storebridge.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -15,7 +15,7 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twext.python.log import Logger
 from twext.web2.dav.http import ErrorResponse, ResponseQueue, MultiStatusResponse
@@ -2506,12 +2506,6 @@
         self._initializeWithObject(newObject, newParent)
         returnValue(txn)
 
-
-    @inlineCallbacks
-    def iCalendarText(self):
-        data = yield self.iCalendar()
-        returnValue(str(data))
-
     iCalendar = _CommonObjectResource.component
 
 
@@ -2762,7 +2756,7 @@
             if rids is not None:
                 rids = rids[0].split(",")
                 try:
-                    rids = [PyCalendarDateTime.parseText(rid) if rid != "M" else None for rid in rids]
+                    rids = [DateTime.parseText(rid) if rid != "M" else None for rid in rids]
                 except ValueError:
                     raise HTTPError(ErrorResponse(
                         FORBIDDEN,

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_calendarquery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_calendarquery.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_calendarquery.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -32,7 +32,7 @@
 from twistedcaldav.test.util import StoreTestCase, SimpleStoreRequest
 from twisted.internet.defer import inlineCallbacks, returnValue
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from twistedcaldav.ical import Component
 from txdav.caldav.icalendarstore import ComponentUpdateState
 from twistedcaldav.directory.directory import DirectoryService
@@ -124,8 +124,8 @@
         )
 
         query_timerange = caldavxml.TimeRange(
-            start="%04d1001T000000Z" % (PyCalendarDateTime.getToday().getYear(),),
-            end="%04d1101T000000Z" % (PyCalendarDateTime.getToday().getYear(),),
+            start="%04d1001T000000Z" % (DateTime.getToday().getYear(),),
+            end="%04d1101T000000Z" % (DateTime.getToday().getYear(),),
         )
 
         query = caldavxml.CalendarQuery(

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_dateops.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_dateops.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_dateops.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,7 +16,7 @@
 
 import twistedcaldav.test.util
 from twisted.trial.unittest import SkipTest
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twistedcaldav.dateops import parseSQLTimestampToPyCalendar, \
     parseSQLDateToPyCalendar, pyCalendarTodatetime, \
@@ -24,7 +24,7 @@
 
 import datetime
 import dateutil
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.timezone import Timezone
 from twistedcaldav.timezones import TimezoneCache
 
 class Dateops(twistedcaldav.test.util.TestCase):
@@ -43,10 +43,10 @@
         """
 
         data = (
-            (PyCalendarDateTime(2012, 1, 1), PyCalendarDateTime(2012, 1, 1, 0, 0, 0)),
-            (PyCalendarDateTime(2012, 1, 1, 10, 0, 0), PyCalendarDateTime(2012, 1, 1, 10, 0, 0)),
-            (PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)), PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-            (PyCalendarDateTime(2012, 1, 1, 12, 0, 0, tzid=PyCalendarTimezone(tzid="America/New_York")), PyCalendarDateTime(2012, 1, 1, 17, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+            (DateTime(2012, 1, 1), DateTime(2012, 1, 1, 0, 0, 0)),
+            (DateTime(2012, 1, 1, 10, 0, 0), DateTime(2012, 1, 1, 10, 0, 0)),
+            (DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)), DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True))),
+            (DateTime(2012, 1, 1, 12, 0, 0, tzid=Timezone(tzid="America/New_York")), DateTime(2012, 1, 1, 17, 0, 0, tzid=Timezone(utc=True))),
         )
 
         for value, result in data:
@@ -59,10 +59,10 @@
         """
 
         data = (
-            (PyCalendarDateTime(2012, 1, 1), PyCalendarDateTime(2012, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-            (PyCalendarDateTime(2012, 1, 1, 10, 0, 0), PyCalendarDateTime(2012, 1, 1, 10, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-            (PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)), PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-            (PyCalendarDateTime(2012, 1, 1, 12, 0, 0, tzid=PyCalendarTimezone(tzid="America/New_York")), PyCalendarDateTime(2012, 1, 1, 17, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+            (DateTime(2012, 1, 1), DateTime(2012, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))),
+            (DateTime(2012, 1, 1, 10, 0, 0), DateTime(2012, 1, 1, 10, 0, 0, tzid=Timezone(utc=True))),
+            (DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)), DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True))),
+            (DateTime(2012, 1, 1, 12, 0, 0, tzid=Timezone(tzid="America/New_York")), DateTime(2012, 1, 1, 17, 0, 0, tzid=Timezone(utc=True))),
         )
 
         for value, result in data:
@@ -75,10 +75,10 @@
         """
 
         data = (
-            (PyCalendarDateTime(2012, 1, 1), PyCalendarDateTime(2012, 1, 1)),
-            (PyCalendarDateTime(2012, 1, 1, 10, 0, 0), PyCalendarDateTime(2012, 1, 1, 10, 0, 0)),
-            (PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)), PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-            (PyCalendarDateTime(2012, 1, 1, 12, 0, 0, tzid=PyCalendarTimezone(tzid="America/New_York")), PyCalendarDateTime(2012, 1, 1, 17, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+            (DateTime(2012, 1, 1), DateTime(2012, 1, 1)),
+            (DateTime(2012, 1, 1, 10, 0, 0), DateTime(2012, 1, 1, 10, 0, 0)),
+            (DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)), DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True))),
+            (DateTime(2012, 1, 1, 12, 0, 0, tzid=Timezone(tzid="America/New_York")), DateTime(2012, 1, 1, 17, 0, 0, tzid=Timezone(utc=True))),
         )
 
         for value, result in data:
@@ -107,132 +107,132 @@
             # Timed
             (
                 "Start within, end within - overlap",
-                PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 1, 12, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 1, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
             (
                 "Start before, end before - no overlap",
-                PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 3, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 1, 12, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 3, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "Start before, end right before - no overlap",
-                PyCalendarDateTime(2012, 1, 1, 23, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 3, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1, 23, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 3, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "Start before, end within - overlap",
-                PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 3, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 3, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
             (
                 "Start after, end after - no overlap",
-                PyCalendarDateTime(2012, 1, 2, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 2, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 1, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "Start right after, end after - no overlap",
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 1, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 1, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "Start within, end after - overlap",
-                PyCalendarDateTime(2012, 1, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1, 12, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 12, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 1, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
             (
                 "Start before, end after - overlap",
-                PyCalendarDateTime(2012, 1, 1, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 3, 11, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 2, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 3, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 3, 11, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 2, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 3, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
 
             # All day
             (
                 "All day: Start within, end within - overlap",
-                PyCalendarDateTime(2012, 1, 9),
-                PyCalendarDateTime(2012, 1, 10),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 9),
+                DateTime(2012, 1, 10),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
             (
                 "All day: Start before, end before - no overlap",
-                PyCalendarDateTime(2012, 1, 1),
-                PyCalendarDateTime(2012, 1, 2),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 1),
+                DateTime(2012, 1, 2),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "All day: Start before, end right before - no overlap",
-                PyCalendarDateTime(2012, 1, 7),
-                PyCalendarDateTime(2012, 1, 8),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 7),
+                DateTime(2012, 1, 8),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "All day: Start before, end within - overlap",
-                PyCalendarDateTime(2012, 1, 7),
-                PyCalendarDateTime(2012, 1, 9),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 7),
+                DateTime(2012, 1, 9),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
             (
                 "All day: Start after, end after - no overlap",
-                PyCalendarDateTime(2012, 1, 16),
-                PyCalendarDateTime(2012, 1, 17),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 16),
+                DateTime(2012, 1, 17),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "All day: Start right after, end after - no overlap",
-                PyCalendarDateTime(2012, 1, 15),
-                PyCalendarDateTime(2012, 1, 16),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 15),
+                DateTime(2012, 1, 16),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 False,
             ),
             (
                 "All day: Start within, end after - overlap",
-                PyCalendarDateTime(2012, 1, 14),
-                PyCalendarDateTime(2012, 1, 16),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 14),
+                DateTime(2012, 1, 16),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
             (
                 "All day: Start before, end after - overlap",
-                PyCalendarDateTime(2012, 1, 7),
-                PyCalendarDateTime(2012, 1, 16),
-                PyCalendarDateTime(2012, 1, 8, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                PyCalendarDateTime(2012, 1, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2012, 1, 7),
+                DateTime(2012, 1, 16),
+                DateTime(2012, 1, 8, 0, 0, 0, tzid=Timezone(utc=True)),
+                DateTime(2012, 1, 15, 0, 0, 0, tzid=Timezone(utc=True)),
                 True,
             ),
         )
@@ -254,8 +254,8 @@
         dateops.pyCalendarTodatetime
         """
         tests = (
-            (PyCalendarDateTime(2012, 4, 4, 12, 34, 56), datetime.datetime(2012, 4, 4, 12, 34, 56, tzinfo=dateutil.tz.tzutc())),
-            (PyCalendarDateTime(2012, 12, 31), datetime.date(2012, 12, 31)),
+            (DateTime(2012, 4, 4, 12, 34, 56), datetime.datetime(2012, 4, 4, 12, 34, 56, tzinfo=dateutil.tz.tzutc())),
+            (DateTime(2012, 12, 31), datetime.date(2012, 12, 31)),
         )
 
         for pycal, result in tests:
@@ -267,8 +267,8 @@
         dateops.parseSQLTimestampToPyCalendar
         """
         tests = (
-            ("2012-04-04 12:34:56", PyCalendarDateTime(2012, 4, 4, 12, 34, 56)),
-            ("2012-12-31 01:01:01", PyCalendarDateTime(2012, 12, 31, 1, 1, 1)),
+            ("2012-04-04 12:34:56", DateTime(2012, 4, 4, 12, 34, 56)),
+            ("2012-12-31 01:01:01", DateTime(2012, 12, 31, 1, 1, 1)),
         )
 
         for sqlStr, result in tests:
@@ -281,8 +281,8 @@
         """
 
         tests = (
-            ("2012-04-04", PyCalendarDateTime(2012, 4, 4)),
-            ("2012-12-31 00:00:00", PyCalendarDateTime(2012, 12, 31)),
+            ("2012-04-04", DateTime(2012, 4, 4)),
+            ("2012-12-31 00:00:00", DateTime(2012, 12, 31)),
         )
 
         for sqlStr, result in tests:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_icalendar.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_icalendar.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -25,12 +25,12 @@
 from twistedcaldav.instance import InvalidOverriddenInstanceError
 import twistedcaldav.test.util
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 from twistedcaldav.ical import iCalendarProductID
-from pycalendar.duration import PyCalendarDuration
+from pycalendar.duration import Duration
 from twistedcaldav.dateops import normalizeForExpand
-from pycalendar.value import PyCalendarValue
+from pycalendar.value import Value
 
 class iCalendar (twistedcaldav.test.util.TestCase):
     """
@@ -469,7 +469,7 @@
         calendar.validCalendarData(doFix=False, validateRecurrences=True)
 
         # Verify expansion works, even for an RDATE prior to master DTSTART:
-        calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        calendar.expandTimeRanges(DateTime(2100, 1, 1))
 
         # Test EXDATEs *prior* to master (as the result of client splitting a
         # a recurring event and copying *all* EXDATEs to new event):
@@ -568,13 +568,13 @@
 
         year = 2004
 
-        instances = calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        instances = calendar.expandTimeRanges(DateTime(2100, 1, 1))
         for key in instances:
             instance = instances[key]
             start = instance.start
             end = instance.end
-            self.assertEqual(start, PyCalendarDateTime(year, 7, 4))
-            self.assertEqual(end  , PyCalendarDateTime(year, 7, 5))
+            self.assertEqual(start, DateTime(year, 7, 4))
+            self.assertEqual(end  , DateTime(year, 7, 5))
             if year == 2050:
                 break
             year += 1
@@ -594,14 +594,14 @@
         }
         year = 2004
 
-        instances = calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        instances = calendar.expandTimeRanges(DateTime(2100, 1, 1))
         for key in instances:
             instance = instances[key]
             start = instance.start
             end = instance.end
             if year in results:
-                self.assertEqual(start, PyCalendarDateTime(year, results[year][0], results[year][1]))
-                self.assertEqual(end  , PyCalendarDateTime(year, results[year][0], results[year][2]))
+                self.assertEqual(start, DateTime(year, results[year][0], results[year][1]))
+                self.assertEqual(end  , DateTime(year, results[year][0], results[year][2]))
             if year == 2050:
                 break
             year += 1
@@ -621,14 +621,14 @@
         }
         year = 2002
 
-        instances = calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        instances = calendar.expandTimeRanges(DateTime(2100, 1, 1))
         for key in instances:
             instance = instances[key]
             start = instance.start
             end = instance.end
             if year in results:
-                self.assertEqual(start, PyCalendarDateTime(year, results[year][0], results[year][1]))
-                self.assertEqual(end  , PyCalendarDateTime(year, results[year][0], results[year][2]))
+                self.assertEqual(start, DateTime(year, results[year][0], results[year][1]))
+                self.assertEqual(end  , DateTime(year, results[year][0], results[year][2]))
             if year == 2050:
                 break
             year += 1
@@ -642,13 +642,13 @@
         """
         calendar = Component.fromStream(file(os.path.join(self.data_dir, "Holidays", "C318ABFE-1ED0-11D9-A5E0-000A958A3252.ics")))
 
-        instances = calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        instances = calendar.expandTimeRanges(DateTime(2100, 1, 1))
         for key in instances:
             instance = instances[key]
             start = instance.start
             end = instance.end
-            self.assertEqual(start, PyCalendarDateTime(2004, 11, 25))
-            self.assertEqual(end, PyCalendarDateTime(2004, 11, 27))
+            self.assertEqual(start, DateTime(2004, 11, 25))
+            self.assertEqual(end, DateTime(2004, 11, 27))
             break
 
     # test_component_timerange.todo = "recurrence expansion should give us no end date here"
@@ -658,44 +658,44 @@
         """
         parse_date()
         """
-        self.assertEqual(PyCalendarDateTime.parseText("19970714"), PyCalendarDateTime(1997, 7, 14))
+        self.assertEqual(DateTime.parseText("19970714"), DateTime(1997, 7, 14))
 
 
     def test_parse_datetime(self):
         """
         parse_datetime()
         """
-        dt = PyCalendarDateTime.parseText("19980118T230000")
-        self.assertEqual(dt, PyCalendarDateTime(1998, 1, 18, 23, 0, 0))
+        dt = DateTime.parseText("19980118T230000")
+        self.assertEqual(dt, DateTime(1998, 1, 18, 23, 0, 0))
         self.assertTrue(dt.floating())
 
-        dt = PyCalendarDateTime.parseText("19980119T070000Z")
-        self.assertEqual(dt, PyCalendarDateTime(1998, 1, 19, 7, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+        dt = DateTime.parseText("19980119T070000Z")
+        self.assertEqual(dt, DateTime(1998, 1, 19, 7, 0, 0, tzid=Timezone(utc=True)))
 
 
     def test_parse_date_or_datetime(self):
         """
         parse_date_or_datetime()
         """
-        self.assertEqual(PyCalendarDateTime.parseText("19970714"), PyCalendarDateTime(1997, 7, 14))
+        self.assertEqual(DateTime.parseText("19970714"), DateTime(1997, 7, 14))
 
-        dt = PyCalendarDateTime.parseText("19980118T230000")
-        self.assertEqual(dt, PyCalendarDateTime(1998, 1, 18, 23, 0, 0))
+        dt = DateTime.parseText("19980118T230000")
+        self.assertEqual(dt, DateTime(1998, 1, 18, 23, 0, 0))
         self.assertTrue(dt.floating())
 
-        dt = PyCalendarDateTime.parseText("19980119T070000Z")
-        self.assertEqual(dt, PyCalendarDateTime(1998, 1, 19, 7, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+        dt = DateTime.parseText("19980119T070000Z")
+        self.assertEqual(dt, DateTime(1998, 1, 19, 7, 0, 0, tzid=Timezone(utc=True)))
 
 
     def test_parse_duration(self):
         """
         parse_duration()
         """
-        self.assertEqual(PyCalendarDuration.parseText("P15DT5H0M20S"), PyCalendarDuration(days=15, hours=5, minutes=0, seconds=20))
-        self.assertEqual(PyCalendarDuration.parseText("+P15DT5H0M20S"), PyCalendarDuration(days=15, hours=5, minutes=0, seconds=20))
-        self.assertEqual(PyCalendarDuration.parseText("-P15DT5H0M20S"), PyCalendarDuration(days=15 * -1, hours=5 * -1, minutes=0, seconds=20 * -1))
+        self.assertEqual(Duration.parseText("P15DT5H0M20S"), Duration(days=15, hours=5, minutes=0, seconds=20))
+        self.assertEqual(Duration.parseText("+P15DT5H0M20S"), Duration(days=15, hours=5, minutes=0, seconds=20))
+        self.assertEqual(Duration.parseText("-P15DT5H0M20S"), Duration(days=15 * -1, hours=5 * -1, minutes=0, seconds=20 * -1))
 
-        self.assertEqual(PyCalendarDuration.parseText("P7W"), PyCalendarDuration(weeks=7))
+        self.assertEqual(Duration.parseText("P7W"), Duration(weeks=7))
 
 
     def test_correct_attendee_properties(self):
@@ -807,7 +807,7 @@
 """,
                 (
                     ("mailto:user1 at example.com", None),
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+                    ("mailto:user1 at example.com", DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)))
                 )
             ),
             (
@@ -833,7 +833,7 @@
 """,
                 (
                     ("mailto:user1 at example.com", None),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2009, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+                    ("mailto:user3 at example.com", DateTime(2009, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)))
                 )
             ),
             (
@@ -946,8 +946,8 @@
                 False,
                 (
                     ("mailto:user2 at example.com", None),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+                    ("mailto:user2 at example.com", DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)))
                 )
             ),
             (
@@ -1177,7 +1177,7 @@
 
         component = Component.fromString(data)
         vevent = component.mainComponent()
-        vevent.addProperty(Property("ATTACH", "foobar", valuetype=PyCalendarValue.VALUETYPE_BINARY))
+        vevent.addProperty(Property("ATTACH", "foobar", valuetype=Value.VALUETYPE_BINARY))
         self.assertEqual(str(component), result)
 
 
@@ -2277,8 +2277,8 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2299,12 +2299,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2326,16 +2326,16 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 16, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 16, 1, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 16, 2, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2357,12 +2357,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 16, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 16, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 16, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2384,12 +2384,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 16, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 16, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 16, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2417,12 +2417,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 2, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2474,12 +2474,12 @@
                 True,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2488,9 +2488,9 @@
         for description, original, ignoreInvalidInstances, results in data:
             component = Component.fromString(original)
             if results is None:
-                self.assertRaises(InvalidOverriddenInstanceError, component.expandTimeRanges, PyCalendarDateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances)
+                self.assertRaises(InvalidOverriddenInstanceError, component.expandTimeRanges, DateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances)
             else:
-                instances = component.expandTimeRanges(PyCalendarDateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances)
+                instances = component.expandTimeRanges(DateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances)
                 self.assertTrue(len(instances.instances) == len(results), "%s: wrong number of instances" % (description,))
                 periods = tuple([(instance.start, instance.end) for instance in sorted(instances.instances.values(), key=lambda x:x.start)])
                 self.assertEqual(periods, results)
@@ -2518,8 +2518,8 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2539,8 +2539,8 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 15),
-                        PyCalendarDateTime(2007, 11, 16),
+                        DateTime(2007, 11, 15),
+                        DateTime(2007, 11, 16),
                     ),
                 )
             ),
@@ -2561,12 +2561,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2587,12 +2587,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 15),
-                        PyCalendarDateTime(2007, 11, 16),
+                        DateTime(2007, 11, 15),
+                        DateTime(2007, 11, 16),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16),
-                        PyCalendarDateTime(2007, 11, 17),
+                        DateTime(2007, 11, 16),
+                        DateTime(2007, 11, 17),
                     ),
                 )
             ),
@@ -2614,16 +2614,16 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 16, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 16, 1, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 16, 2, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2645,16 +2645,16 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 15),
-                        PyCalendarDateTime(2007, 11, 16),
+                        DateTime(2007, 11, 15),
+                        DateTime(2007, 11, 16),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16),
-                        PyCalendarDateTime(2007, 11, 17),
+                        DateTime(2007, 11, 16),
+                        DateTime(2007, 11, 17),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 18),
-                        PyCalendarDateTime(2007, 11, 19),
+                        DateTime(2007, 11, 18),
+                        DateTime(2007, 11, 19),
                     ),
                 )
             ),
@@ -2676,12 +2676,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 16, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 16, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 16, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2703,12 +2703,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 15),
-                        PyCalendarDateTime(2007, 11, 16),
+                        DateTime(2007, 11, 15),
+                        DateTime(2007, 11, 16),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 17),
-                        PyCalendarDateTime(2007, 11, 18),
+                        DateTime(2007, 11, 17),
+                        DateTime(2007, 11, 18),
                     ),
                 )
             ),
@@ -2736,12 +2736,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 2, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -2769,12 +2769,12 @@
                 False,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 15),
-                        PyCalendarDateTime(2007, 11, 16),
+                        DateTime(2007, 11, 15),
+                        DateTime(2007, 11, 16),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 16),
-                        PyCalendarDateTime(2007, 11, 18),
+                        DateTime(2007, 11, 16),
+                        DateTime(2007, 11, 18),
                     ),
                 )
             ),
@@ -2831,9 +2831,9 @@
         for description, original, ignoreInvalidInstances, results in data:
             component = Component.fromString(original)
             if results is None:
-                self.assertRaises(InvalidOverriddenInstanceError, component.expandTimeRanges, PyCalendarDateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances)
+                self.assertRaises(InvalidOverriddenInstanceError, component.expandTimeRanges, DateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances)
             else:
-                instances = component.expandTimeRanges(PyCalendarDateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances, normalizeFunction=normalizeForExpand)
+                instances = component.expandTimeRanges(DateTime(2100, 1, 1), ignoreInvalidInstances=ignoreInvalidInstances, normalizeFunction=normalizeForExpand)
                 self.assertTrue(len(instances.instances) == len(results), "%s: wrong number of instances" % (description,))
                 periods = tuple([(instance.start, instance.end) for instance in sorted(instances.instances.values(), key=lambda x:x.start)])
                 self.assertEqual(periods, results)
@@ -2861,8 +2861,8 @@
                 None,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
                 None,
@@ -2880,11 +2880,11 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2007, 1, 1),
+                DateTime(2007, 1, 1),
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
                 None,
@@ -2902,9 +2902,9 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2010, 1, 1),
+                DateTime(2010, 1, 1),
                 (),
-                PyCalendarDateTime(2010, 1, 1),
+                DateTime(2010, 1, 1),
             ),
             (
                 "Simple recurring - no limit",
@@ -2923,20 +2923,20 @@
                 None,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2008, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2008, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2009, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2009, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2009, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2009, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2010, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2010, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2010, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2010, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
                 None,
@@ -2955,23 +2955,23 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2007, 1, 1),
+                DateTime(2007, 1, 1),
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2008, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2008, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2009, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2009, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2009, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2009, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2010, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2010, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2010, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2010, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
                 None,
@@ -2990,14 +2990,14 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2010, 1, 1),
+                DateTime(2010, 1, 1),
                 (
                     (
-                        PyCalendarDateTime(2010, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2010, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2010, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2010, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
-                PyCalendarDateTime(2010, 1, 1),
+                DateTime(2010, 1, 1),
             ),
             (
                 "Simple recurring - limit effective full",
@@ -3013,9 +3013,9 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2012, 1, 1),
+                DateTime(2012, 1, 1),
                 (),
-                PyCalendarDateTime(2012, 1, 1),
+                DateTime(2012, 1, 1),
             ),
             (
                 "Complex recurring - no limit",
@@ -3048,20 +3048,20 @@
                 None,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2008, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2008, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2008, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2008, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2009, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2009, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2009, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2009, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2010, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2010, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2010, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2010, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
                 None,
@@ -3094,23 +3094,23 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2007, 1, 1),
+                DateTime(2007, 1, 1),
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2008, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2008, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2008, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2008, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2009, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2009, 11, 14, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2009, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2009, 11, 14, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2010, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2010, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2010, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2010, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
                 None,
@@ -3143,14 +3143,14 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2010, 1, 1),
+                DateTime(2010, 1, 1),
                 (
                     (
-                        PyCalendarDateTime(2010, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2010, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2010, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2010, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 ),
-                PyCalendarDateTime(2010, 1, 1),
+                DateTime(2010, 1, 1),
             ),
             (
                 "Complex recurring - limit effective full",
@@ -3180,15 +3180,15 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2012, 1, 1),
+                DateTime(2012, 1, 1),
                 (),
-                PyCalendarDateTime(2012, 1, 1),
+                DateTime(2012, 1, 1),
             ),
         )
 
         for description, original, lowerLimit, results, limited in data:
             component = Component.fromString(original)
-            instances = component.expandTimeRanges(PyCalendarDateTime(2100, 1, 1), lowerLimit=lowerLimit)
+            instances = component.expandTimeRanges(DateTime(2100, 1, 1), lowerLimit=lowerLimit)
             self.assertTrue(len(instances.instances) == len(results), "%s: wrong number of instances" % (description,))
             periods = tuple([(instance.start, instance.end) for instance in sorted(instances.instances.values(), key=lambda x:x.start)])
             self.assertEqual(periods, results)
@@ -4040,7 +4040,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID:20090102T080000Z
@@ -4065,7 +4065,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 2, 18, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 2, 18, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID:20090102T180000Z
@@ -4091,7 +4091,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 3, 18, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 3, 18, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID:20090103T180000Z
@@ -4115,7 +4115,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 2, 9, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 2, 9, 0, 0, tzid=Timezone(utc=True)),
                 None,
             ),
             (
@@ -4133,7 +4133,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 2, 19, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 2, 19, 0, 0, tzid=Timezone(utc=True)),
                 None,
             ),
             (
@@ -4152,7 +4152,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 3, 19, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 3, 19, 0, 0, tzid=Timezone(utc=True)),
                 None,
             ),
             (
@@ -4169,7 +4169,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 8),
+                DateTime(2009, 1, 8),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID;VALUE=DATE:20090108
@@ -4194,7 +4194,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 3),
+                DateTime(2009, 1, 3),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID;VALUE=DATE:20090103
@@ -4220,7 +4220,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 10),
+                DateTime(2009, 1, 10),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID;VALUE=DATE:20090110
@@ -4244,7 +4244,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 3),
+                DateTime(2009, 1, 3),
                 None,
             ),
             (
@@ -4262,7 +4262,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 5),
+                DateTime(2009, 1, 5),
                 None,
             ),
             (
@@ -4281,7 +4281,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 19),
+                DateTime(2009, 1, 19),
                 None,
             ),
         )
@@ -4311,8 +4311,8 @@
 END:VCALENDAR
 """,
                 (
-                    PyCalendarDateTime(2009, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                    PyCalendarDateTime(2009, 1, 4, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                    DateTime(2009, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)),
+                    DateTime(2009, 1, 4, 8, 0, 0, tzid=Timezone(utc=True)),
                 ),
                 (
                     """BEGIN:VEVENT
@@ -4349,8 +4349,8 @@
 END:VCALENDAR
 """,
                 (
-                    PyCalendarDateTime(2009, 1, 2, 18, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                    PyCalendarDateTime(2009, 1, 4, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                    DateTime(2009, 1, 2, 18, 0, 0, tzid=Timezone(utc=True)),
+                    DateTime(2009, 1, 4, 8, 0, 0, tzid=Timezone(utc=True)),
                 ),
                 (
                     """BEGIN:VEVENT
@@ -4388,8 +4388,8 @@
 END:VCALENDAR
 """,
                 (
-                    PyCalendarDateTime(2009, 1, 3, 18, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                    PyCalendarDateTime(2009, 1, 5, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                    DateTime(2009, 1, 3, 18, 0, 0, tzid=Timezone(utc=True)),
+                    DateTime(2009, 1, 5, 8, 0, 0, tzid=Timezone(utc=True)),
                 ),
                 (
                     """BEGIN:VEVENT
@@ -4425,8 +4425,8 @@
 END:VCALENDAR
 """,
                 (
-                    PyCalendarDateTime(2009, 1, 2, 9, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                    PyCalendarDateTime(2009, 1, 3, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                    DateTime(2009, 1, 2, 9, 0, 0, tzid=Timezone(utc=True)),
+                    DateTime(2009, 1, 3, 8, 0, 0, tzid=Timezone(utc=True)),
                 ),
                 (
                     None,
@@ -4456,8 +4456,8 @@
 END:VCALENDAR
 """,
                 (
-                    PyCalendarDateTime(2009, 1, 2, 19, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                    PyCalendarDateTime(2009, 1, 3, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                    DateTime(2009, 1, 2, 19, 0, 0, tzid=Timezone(utc=True)),
+                    DateTime(2009, 1, 3, 8, 0, 0, tzid=Timezone(utc=True)),
                 ),
                 (
                     None,
@@ -4488,8 +4488,8 @@
 END:VCALENDAR
 """,
                 (
-                    PyCalendarDateTime(2009, 1, 3, 19, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                    PyCalendarDateTime(2009, 1, 3, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                    DateTime(2009, 1, 3, 19, 0, 0, tzid=Timezone(utc=True)),
+                    DateTime(2009, 1, 3, 8, 0, 0, tzid=Timezone(utc=True)),
                 ),
                 (
                     None,
@@ -4534,7 +4534,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID:20090102T080000Z
@@ -4561,7 +4561,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VEVENT
 UID:12345-67890-1
 RECURRENCE-ID:20090102T080000Z
@@ -4604,19 +4604,19 @@
         self.assertFalse(hasattr(ical, "cachedInstances"))
 
         # Derive one day apart - no re-cache
-        ical.deriveInstance(PyCalendarDateTime(2009, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+        ical.deriveInstance(DateTime(2009, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)))
         self.assertTrue(hasattr(ical, "cachedInstances"))
         oldLimit = ical.cachedInstances.limit
-        ical.deriveInstance(PyCalendarDateTime(2009, 1, 3, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+        ical.deriveInstance(DateTime(2009, 1, 3, 8, 0, 0, tzid=Timezone(utc=True)))
         self.assertEqual(ical.cachedInstances.limit, oldLimit)
 
         # Derive several years ahead - re-cached
-        ical.deriveInstance(PyCalendarDateTime(2011, 1, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+        ical.deriveInstance(DateTime(2011, 1, 1, 8, 0, 0, tzid=Timezone(utc=True)))
         self.assertNotEqual(ical.cachedInstances.limit, oldLimit)
         oldLimit = ical.cachedInstances.limit
 
         # Check one day ahead again - no re-cache
-        ical.deriveInstance(PyCalendarDateTime(2011, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)))
+        ical.deriveInstance(DateTime(2011, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)))
         self.assertEqual(ical.cachedInstances.limit, oldLimit)
 
 
@@ -4661,13 +4661,13 @@
         masterDerived = ical.masterDerived()
 
         # Derive one day apart - no re-cache
-        result = ical.deriveInstance(PyCalendarDateTime(2009, 1, 2, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)), newcomp=masterDerived)
+        result = ical.deriveInstance(DateTime(2009, 1, 2, 8, 0, 0, tzid=Timezone(utc=True)), newcomp=masterDerived)
         self.assertEqual(str(result), derived1)
 
-        result = ical.deriveInstance(PyCalendarDateTime(2009, 2, 3, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)), newcomp=masterDerived)
+        result = ical.deriveInstance(DateTime(2009, 2, 3, 8, 0, 0, tzid=Timezone(utc=True)), newcomp=masterDerived)
         self.assertEqual(str(result), derived2)
 
-        result = ical.deriveInstance(PyCalendarDateTime(2009, 3, 3, 9, 0, 0, tzid=PyCalendarTimezone(utc=True)), newcomp=masterDerived)
+        result = ical.deriveInstance(DateTime(2009, 3, 3, 9, 0, 0, tzid=Timezone(utc=True)), newcomp=masterDerived)
         self.assertEqual(result, None)
 
         self.assertEqual(str(ical), event)
@@ -4847,8 +4847,8 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -4866,9 +4866,9 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 5, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 5, 0, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -4886,10 +4886,10 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 1, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -4908,11 +4908,11 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 1, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 2, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -4932,12 +4932,12 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
-                    (PyCalendarDateTime(2009, 10, 3, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 1, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 2, 0, 0, tzid=Timezone(utc=True)), False),
+                    (DateTime(2009, 10, 3, 0, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -4960,11 +4960,11 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)), False),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 1, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -4989,12 +4989,12 @@
 """,
                 (
                     (None, True),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2007, 11, 15, 2, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 1, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 1, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2007, 11, 15, 2, 0, 0, tzid=Timezone(utc=True)), False),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 1, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -5012,9 +5012,9 @@
 """,
                 (
                     (None, False),
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
-                    (PyCalendarDateTime(2009, 10, 4, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), False),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), True),
+                    (DateTime(2009, 10, 4, 0, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -5046,7 +5046,7 @@
 END:VCALENDAR
 """,
                 (
-                    (PyCalendarDateTime(2007, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), True),
+                    (DateTime(2007, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)), True),
                 )
             ),
             (
@@ -5062,7 +5062,7 @@
 END:VCALENDAR
 """,
                 (
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
             (
@@ -5084,7 +5084,7 @@
 END:VCALENDAR
 """,
                 (
-                    (PyCalendarDateTime(2007, 11, 15, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)), False),
+                    (DateTime(2007, 11, 15, 0, 0, 0, tzid=Timezone(utc=True)), False),
                 )
             ),
         )
@@ -5396,12 +5396,12 @@
 """,
                 (
                     (
-                        PyCalendarDateTime(2007, 11, 14, 20, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 14, 21, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 14, 20, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 14, 21, 0, 0, tzid=Timezone(utc=True)),
                     ),
                     (
-                        PyCalendarDateTime(2007, 11, 15, 21, 0, 0, tzid=PyCalendarTimezone(utc=True)),
-                        PyCalendarDateTime(2007, 11, 15, 22, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                        DateTime(2007, 11, 15, 21, 0, 0, tzid=Timezone(utc=True)),
+                        DateTime(2007, 11, 15, 22, 0, 0, tzid=Timezone(utc=True)),
                     ),
                 )
             ),
@@ -5409,7 +5409,7 @@
 
         for description, original, fixed, results in data:
             component = Component.fromString(original)
-            instances = component.expandTimeRanges(PyCalendarDateTime(2100, 1, 1), ignoreInvalidInstances=False)
+            instances = component.expandTimeRanges(DateTime(2100, 1, 1), ignoreInvalidInstances=False)
             self.assertTrue(len(instances.instances) == len(results), "%s: wrong number of instances" % (description,))
             periods = tuple([(instance.start, instance.end) for instance in sorted(instances.instances.values(), key=lambda x:x.start)])
             self.assertEqual(periods, results)
@@ -5696,7 +5696,7 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                 ),
@@ -5741,7 +5741,7 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", False,),
@@ -5795,7 +5795,7 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", False,),
@@ -5841,19 +5841,19 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 3, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", True,),
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 4, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", True,),
                                 ),
@@ -5916,21 +5916,21 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", True,),
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 3, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", True,),
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 4, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", False,),
@@ -6015,7 +6015,7 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 2, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 2, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", True,),
@@ -6023,7 +6023,7 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 3, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 3, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", True,),
@@ -6031,7 +6031,7 @@
                                 ),
                             ),
                             (
-                                PyCalendarDateTime(2008, 6, 4, 12, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                                DateTime(2008, 6, 4, 12, 0, 0, tzid=Timezone(utc=True)),
                                 (
                                     ("", False,),
                                     ("user01", False,),
@@ -7415,7 +7415,7 @@
 """,
             ),
         )
-        cutoff = PyCalendarDateTime(2011, 11, 30, 0, 0, 0)
+        cutoff = DateTime(2011, 11, 30, 0, 0, 0)
         for _ignore_title, expected, body in data:
             ical = Component.fromString(body)
             self.assertEquals(expected, ical.hasInstancesAfter(cutoff))
@@ -9437,7 +9437,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 2, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 2, 1, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9505,7 +9505,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 2, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 2, 1, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9577,7 +9577,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 2, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 2, 1, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9626,7 +9626,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 2, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 2, 1, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9676,7 +9676,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 31, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 31, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9725,7 +9725,7 @@
 END:VEVENT
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 1, 31, 6, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 1, 31, 6, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9795,7 +9795,7 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 2, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 2, 1, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -9944,7 +9944,7 @@
 END:X-CALENDARSERVER-PERUSER
 END:VCALENDAR
 """,
-                PyCalendarDateTime(2009, 2, 1, 8, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+                DateTime(2009, 2, 1, 8, 0, 0, tzid=Timezone(utc=True)),
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_localization.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_localization.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_localization.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -20,7 +20,7 @@
 from twistedcaldav.ical import Component
 from twistedcaldav.test.util import TestCase
 from twistedcaldav.config import ConfigDict
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 import os
 
@@ -68,22 +68,22 @@
 
         with translationTo('en', localeDir=localeDir) as t:
 
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 0, 0, 0)), "12:00 AM")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 12, 0, 0)), "12:00 PM")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 23, 59, 0)), "11:59 PM")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 6, 5, 0)), "6:05 AM")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 16, 5, 0)), "4:05 PM")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 0, 0, 0)), "12:00 AM")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 12, 0, 0)), "12:00 PM")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 23, 59, 0)), "11:59 PM")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 6, 5, 0)), "6:05 AM")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 16, 5, 0)), "4:05 PM")
 
 
     def test_TimeFormatting24Hour(self):
 
         with translationTo('pig', localeDir=localeDir) as t:
 
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 0, 0, 0)), "00:00")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 12, 0, 0)), "12:00")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 23, 59, 0)), "23:59")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 6, 5, 0)), "06:05")
-            self.assertEquals(t.dtTime(PyCalendarDateTime(2000, 1, 1, 16, 5, 0)), "16:05")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 0, 0, 0)), "00:00")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 12, 0, 0)), "12:00")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 23, 59, 0)), "23:59")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 6, 5, 0)), "06:05")
+            self.assertEquals(t.dtTime(DateTime(2000, 1, 1, 16, 5, 0)), "16:05")
 
 
     def test_CalendarFormatting(self):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_timezones.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_timezones.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_timezones.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -19,8 +19,8 @@
 from twistedcaldav.ical import Component
 from twistedcaldav.timezones import TimezoneCache, TimezoneException
 from twistedcaldav.timezones import readTZ, listTZs
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 import os
 import threading
@@ -49,7 +49,7 @@
         if calendar.name() != "VCALENDAR":
             self.fail("Calendar is not a VCALENDAR")
 
-        instances = calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        instances = calendar.expandTimeRanges(DateTime(2100, 1, 1))
         for key in instances:
             instance = instances[key]
             start = instance.start
@@ -69,8 +69,8 @@
 
         self.doTest(
             "TruncatedApr01.ics",
-            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True))
+            DateTime(2007, 04, 01, 16, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 04, 01, 17, 0, 0, Timezone(utc=True))
         )
 
 
@@ -84,8 +84,8 @@
 
         self.doTest(
             "TruncatedDec10.ics",
-            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True))
+            DateTime(2007, 12, 10, 17, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 12, 10, 18, 0, 0, Timezone(utc=True))
         )
 
 
@@ -99,13 +99,13 @@
 
         self.doTest(
             "TruncatedApr01.ics",
-            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True)),
+            DateTime(2007, 04, 01, 16, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 04, 01, 17, 0, 0, Timezone(utc=True)),
         )
         self.doTest(
             "TruncatedDec10.ics",
-            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True)),
+            DateTime(2007, 12, 10, 17, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 12, 10, 18, 0, 0, Timezone(utc=True)),
             testEqual=False
         )
 
@@ -119,13 +119,13 @@
 
         self.doTest(
             "TruncatedApr01.ics",
-            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True)),
+            DateTime(2007, 04, 01, 16, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 04, 01, 17, 0, 0, Timezone(utc=True)),
         )
         self.doTest(
             "TruncatedDec10.ics",
-            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True)),
+            DateTime(2007, 12, 10, 17, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 12, 10, 18, 0, 0, Timezone(utc=True)),
         )
 
 
@@ -139,13 +139,13 @@
 
         self.doTest(
             "TruncatedDec10.ics",
-            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True))
+            DateTime(2007, 12, 10, 17, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 12, 10, 18, 0, 0, Timezone(utc=True))
         )
         self.doTest(
             "TruncatedApr01.ics",
-            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
-            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True))
+            DateTime(2007, 04, 01, 16, 0, 0, Timezone(utc=True)),
+            DateTime(2007, 04, 01, 17, 0, 0, Timezone(utc=True))
         )
 
 
@@ -201,13 +201,13 @@
         calendar = Component.fromString(data)
         if calendar.name() != "VCALENDAR":
             self.fail("Calendar is not a VCALENDAR")
-        instances = calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
+        instances = calendar.expandTimeRanges(DateTime(2100, 1, 1))
         for key in instances:
             instance = instances[key]
             start = instance.start
             end = instance.end
-            self.assertEqual(start, PyCalendarDateTime(2007, 12, 25, 05, 0, 0, PyCalendarTimezone(utc=True)))
-            self.assertEqual(end, PyCalendarDateTime(2007, 12, 25, 06, 0, 0, PyCalendarTimezone(utc=True)))
+            self.assertEqual(start, DateTime(2007, 12, 25, 05, 0, 0, Timezone(utc=True)))
+            self.assertEqual(end, DateTime(2007, 12, 25, 06, 0, 0, Timezone(utc=True)))
             break
 
 

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_upgrade.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/test/test_upgrade.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -1675,8 +1675,8 @@
 ATTENDEE;CN=Double 'quotey' Quotes;CUTYPE=INDIVIDUAL;EMAIL=doublequotes at ex
  ample.com;PARTSTAT=ACCEPTED:urn:uuid:8E04787E-336D-41ED-A70B-D233AD0DCE6F
 ATTENDEE;CN=Cyrus Daboo;CUTYPE=INDIVIDUAL;EMAIL=cdaboo at example.com;PARTSTA
- T=ACCEPTED;ROLE=REQ-PARTICIPANT:urn:uuid:5A985493-EE2C-4665-94CF-4DFEA3A89
- 500
+ T=ACCEPTED;ROLE=REQ-PARTICIPANT:urn:uuid:5A985493-EE2C-4665-94CF-4DFEA3A8
+ 9500
 CREATED:20090203T181910Z
 DESCRIPTION:This has " Bad Quotes " in it
 DTSTAMP:20090203T181924Z

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezones.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezones.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezones.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -22,7 +22,7 @@
 
 from twistedcaldav.config import config
 
-from pycalendar.timezonedb import PyCalendarTimezoneDatabase
+from pycalendar.timezonedb import TimezoneDatabase
 
 log = Logger()
 
@@ -95,7 +95,7 @@
             TimezoneCache.dirName = None
             TimezoneCache.validatePath()
         TimezoneCache.version = TimezoneCache.getTZVersion(TimezoneCache.getDBPath())
-        PyCalendarTimezoneDatabase.createTimezoneDatabase(TimezoneCache.getDBPath())
+        TimezoneDatabase.createTimezoneDatabase(TimezoneCache.getDBPath())
 
 
     @staticmethod
@@ -171,7 +171,7 @@
 
     @staticmethod
     def clear():
-        PyCalendarTimezoneDatabase.clearTimezoneDatabase()
+        TimezoneDatabase.clearTimezoneDatabase()
 
 # zoneinfo never changes in a running instance so cache all this data as we use it
 cachedTZs = {}
@@ -207,7 +207,7 @@
 
     if tzid not in cachedVTZs:
 
-        tzcal = PyCalendarTimezoneDatabase.getTimezoneInCalendar(tzid)
+        tzcal = TimezoneDatabase.getTimezoneInCalendar(tzid)
         if tzcal:
             cachedVTZs[tzid] = tzcal
         else:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezoneservice.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezoneservice.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezoneservice.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -46,7 +46,7 @@
 from twistedcaldav.timezones import listTZs
 from twistedcaldav.timezones import readTZ
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 class TimezoneServiceResource (ReadOnlyNoCopyResourceMixIn, DAVResourceWithoutChildrenMixin, DAVResource):
     """
@@ -66,20 +66,25 @@
         self.parent = parent
         self.cache = {}
 
+
     def deadProperties(self):
         if not hasattr(self, "_dead_properties"):
             self._dead_properties = NonePropertyStore(self)
         return self._dead_properties
 
+
     def etag(self):
         return succeed(None)
 
+
     def checkPreconditions(self, request):
         return None
 
+
     def checkPrivileges(self, request, privileges, recurse=False, principal=None, inherited_aces=None):
         return succeed(None)
 
+
     def defaultAccessControlList(self):
         return davxml.ACL(
             # DAV:Read for all principals (includes anonymous)
@@ -92,21 +97,27 @@
             ),
         )
 
+
     def contentType(self):
         return MimeType.fromString("text/xml")
 
+
     def resourceType(self):
         return davxml.ResourceType.timezones
 
+
     def isCollection(self):
         return False
 
+
     def isCalendarCollection(self):
         return False
 
+
     def isPseudoCalendarCollection(self):
         return False
 
+
     def render(self, request):
         output = """<html>
 <head>
@@ -127,10 +138,11 @@
         """
         The timezone service POST method.
         """
-        
+
         # GET and POST do the same thing
         return self.http_POST(request)
 
+
     def http_POST(self, request):
         """
         The timezone service POST method.
@@ -138,11 +150,11 @@
 
         # Check authentication and access controls
         def _gotResult(_):
-            
+
             if not request.args:
                 # Do normal GET behavior
                 return self.render(request)
-    
+
             method = request.args.get("method", ("",))
             if len(method) != 1:
                 raise HTTPError(ErrorResponse(
@@ -151,41 +163,43 @@
                     "Invalid method query parameter",
                 ))
             method = method[0]
-                
+
             action = {
                 "list"   : self.doPOSTList,
                 "get"    : self.doPOSTGet,
                 "expand" : self.doPOSTExpand,
             }.get(method, None)
-            
+
             if action is None:
                 raise HTTPError(ErrorResponse(
                     responsecode.BAD_REQUEST,
                     (calendarserver_namespace, "supported-method"),
                     "Unknown method query parameter",
                 ))
-    
+
             return action(request)
-            
+
         d = self.authorize(request, (davxml.Read(),))
         d.addCallback(_gotResult)
         return d
 
+
     def doPOSTList(self, request):
         """
         Return a list of all timezones known to the server.
         """
-        
+
         tzids = listTZs()
         tzids.sort()
         result = customxml.TZIDs(*[customxml.TZID(tzid) for tzid in tzids])
         return XMLResponse(responsecode.OK, result)
 
+
     def doPOSTGet(self, request):
         """
         Return the specified timezone data.
         """
-        
+
         tzid = request.args.get("tzid", ())
         if len(tzid) != 1:
             raise HTTPError(ErrorResponse(
@@ -209,6 +223,7 @@
         response.headers.setHeader("content-type", MimeType.fromString("text/calendar; charset=utf-8"))
         return response
 
+
     def doPOSTExpand(self, request):
         """
         Expand a timezone within specified start/end dates.
@@ -235,7 +250,7 @@
             start = request.args.get("start", ())
             if len(start) != 1:
                 raise ValueError()
-            start = PyCalendarDateTime.parseText(start[0])
+            start = DateTime.parseText(start[0])
         except ValueError:
             raise HTTPError(ErrorResponse(
                 responsecode.BAD_REQUEST,
@@ -247,7 +262,7 @@
             end = request.args.get("end", ())
             if len(end) != 1:
                 raise ValueError()
-            end = PyCalendarDateTime.parseText(end[0])
+            end = DateTime.parseText(end[0])
             if end <= start:
                 raise ValueError()
         except ValueError:

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezonestdservice.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezonestdservice.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/timezonestdservice.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -49,9 +49,9 @@
     addVTZ
 from twistedcaldav.xmlutil import addSubElement
 
-from pycalendar.calendar import PyCalendar
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.exceptions import PyCalendarInvalidData
+from pycalendar.icalendar.calendar import Calendar
+from pycalendar.datetime import DateTime
+from pycalendar.exceptions import InvalidData
 
 import hashlib
 import itertools
@@ -303,7 +303,7 @@
             # Validate a date-time stamp
             changedsince = changedsince[0]
             try:
-                dt = PyCalendarDateTime.parseText(changedsince)
+                dt = DateTime.parseText(changedsince)
             except ValueError:
                 raise HTTPError(JSONResponse(
                     responsecode.BAD_REQUEST,
@@ -396,9 +396,9 @@
             if len(start) > 1:
                 raise ValueError()
             elif len(start) == 1:
-                start = PyCalendarDateTime.parseText(start[0])
+                start = DateTime.parseText(start[0])
             else:
-                start = PyCalendarDateTime.getToday()
+                start = DateTime.getToday()
                 start.setDay(1)
                 start.setMonth(1)
         except ValueError:
@@ -415,9 +415,9 @@
             if len(end) > 1:
                 raise ValueError()
             elif len(end) == 1:
-                end = PyCalendarDateTime.parseText(end[0])
+                end = DateTime.parseText(end[0])
             else:
-                end = PyCalendarDateTime.getToday()
+                end = DateTime.getToday()
                 end.setDay(1)
                 end.setMonth(1)
                 end.offsetYear(10)
@@ -558,7 +558,7 @@
         Generate a PyCalendar containing the requested timezone.
         """
         # We will just use our existing TimezoneCache here
-        calendar = PyCalendar()
+        calendar = Calendar()
         try:
             vtz = readVTZ(tzid)
             calendar.addComponent(vtz.getComponents()[0].duplicate())
@@ -618,7 +618,7 @@
         Create a new DB xml file from scratch by scanning zoneinfo.
         """
 
-        self.dtstamp = PyCalendarDateTime.getNowUTC().getXMLText()
+        self.dtstamp = DateTime.getNowUTC().getXMLText()
         self._scanTZs("")
         self._dumpTZs()
 
@@ -672,7 +672,7 @@
         """
         Update existing DB info by comparing md5's.
         """
-        self.dtstamp = PyCalendarDateTime.getNowUTC().getXMLText()
+        self.dtstamp = DateTime.getNowUTC().getXMLText()
         self.changeCount = 0
         self.changed = set()
         self._scanTZs("", checkIfChanged=True)
@@ -847,8 +847,8 @@
 
         ical = response.data
         try:
-            calendar = PyCalendar.parseText(ical)
-        except PyCalendarInvalidData:
+            calendar = Calendar.parseText(ical)
+        except InvalidData:
             log.error("Invalid calendar data for tzid: %s" % (tzinfo.tzid,))
             returnValue(None)
         ical = calendar.getText()

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/upgrade.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/upgrade.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -1065,7 +1065,6 @@
             # Migrate mail tokens from sqlite to store
             yield migrateTokensToStore(self.config.DataRoot, self.store)
 
-            
 
     @inlineCallbacks
     def processInboxItems(self):

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/vcard.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/vcard.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/vcard.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -31,9 +31,9 @@
 from twext.web2.stream import IStream
 from twext.web2.dav.util import allDataFromStream
 
-from pycalendar.attribute import PyCalendarAttribute
-from pycalendar.componentbase import PyCalendarComponentBase
-from pycalendar.exceptions import PyCalendarError
+from pycalendar.parameter import Parameter
+from pycalendar.componentbase import ComponentBase
+from pycalendar.exceptions import ErrorBase
 from pycalendar.vcard.card import Card
 from pycalendar.vcard.property import Property as pyProperty
 
@@ -44,6 +44,8 @@
 class InvalidVCardDataError(ValueError):
     pass
 
+
+
 class Property (object):
     """
     vCard Property
@@ -73,31 +75,55 @@
             for attrname, attrvalue in params.items():
                 if isinstance(attrvalue, unicode):
                     attrvalue = attrvalue.encode("utf-8")
-                self._pycard.addAttribute(PyCalendarAttribute(attrname, attrvalue))
+                self._pycard.addParameter(Parameter(attrname, attrvalue))
 
-    def __str__ (self): return str(self._pycard)
-    def __repr__(self): return "<%s: %r: %r>" % (self.__class__.__name__, self.name(), self.value())
 
-    def __hash__(self): return hash(str(self))
+    def __str__(self):
+        return str(self._pycard)
 
-    def __ne__(self, other): return not self.__eq__(other)
+
+    def __repr__(self):
+        return "<%s: %r: %r>" % (self.__class__.__name__, self.name(), self.value())
+
+
+    def __hash__(self):
+        return hash(str(self))
+
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+
     def __eq__(self, other):
-        if not isinstance(other, Property): return False
+        if not isinstance(other, Property):
+            return False
         return self._pycard == other._pycard
 
-    def __gt__(self, other): return not (self.__eq__(other) or self.__lt__(other))
+
+    def __gt__(self, other):
+        return not (self.__eq__(other) or self.__lt__(other))
+
+
     def __lt__(self, other):
         my_name = self.name()
         other_name = other.name()
 
-        if my_name < other_name: return True
-        if my_name > other_name: return False
+        if my_name < other_name:
+            return True
+        if my_name > other_name:
+            return False
 
         return self.value() < other.value()
 
-    def __ge__(self, other): return self.__eq__(other) or self.__gt__(other)
-    def __le__(self, other): return self.__eq__(other) or self.__lt__(other)
 
+    def __ge__(self, other):
+        return self.__eq__(other) or self.__gt__(other)
+
+
+    def __le__(self, other):
+        return self.__eq__(other) or self.__lt__(other)
+
+
     def duplicate(self):
         """
         Duplicate this object and all its contents.
@@ -105,35 +131,45 @@
         """
         return Property(None, None, params=None, pycard=self._pycard.duplicate())
 
-    def name  (self): return self._pycard.getName()
 
-    def value (self): return self._pycard.getValue().getValue()
+    def name(self):
+        return self._pycard.getName()
 
-    def strvalue (self): return str(self._pycard.getValue())
 
+    def value(self):
+        return self._pycard.getValue().getValue()
+
+
+    def strvalue(self):
+        return str(self._pycard.getValue())
+
+
     def setValue(self, value):
         self._pycard.setValue(value)
 
+
     def parameterNames(self):
         """
         Returns a set containing parameter names for this property.
         """
         result = set()
-        for pyattrlist in self._pycard.getAttributes().values():
+        for pyattrlist in self._pycard.getParameters().values():
             for pyattr in pyattrlist:
                 result.add(pyattr.getName())
         return result
 
+
     def parameterValue(self, name, default=None):
         """
         Returns a single value for the given parameter.  Raises
         InvalidICalendarDataError if the parameter has more than one value.
         """
         try:
-            return self._pycard.getAttributeValue(name)
+            return self._pycard.getParameterValue(name)
         except KeyError:
             return default
 
+
     def parameterValues(self, name):
         """
         Returns a single value for the given parameter.  Raises
@@ -141,7 +177,7 @@
         """
         results = []
         try:
-            attrs = self._pycard.getAttributes()[name.upper()]
+            attrs = self._pycard.getParameters()[name.upper()]
         except KeyError:
             return []
 
@@ -149,28 +185,33 @@
             results.extend(attr.getValues())
         return results
 
+
     def hasParameter(self, paramname):
-        return self._pycard.hasAttribute(paramname)
+        return self._pycard.hasParameter(paramname)
 
+
     def setParameter(self, paramname, paramvalue):
-        self._pycard.replaceAttribute(PyCalendarAttribute(paramname, paramvalue))
+        self._pycard.replaceParameter(Parameter(paramname, paramvalue))
 
+
     def removeParameter(self, paramname):
-        self._pycard.removeAttributes(paramname)
+        self._pycard.removeParameters(paramname)
 
+
     def removeAllParameters(self):
-        self._pycard.setAttributes({})
+        self._pycard.setParameters({})
 
+
     def removeParameterValue(self, paramname, paramvalue):
 
         paramname = paramname.upper()
         for attrName in self.parameterNames():
             if attrName.upper() == paramname:
-                for attr in tuple(self._pycard.getAttributes()[attrName]):
+                for attr in tuple(self._pycard.getParameters()[attrName]):
                     for value in attr.getValues():
                         if value == paramvalue:
                             if not attr.removeValue(value):
-                                self._pycard.removeAttributes(paramname)
+                                self._pycard.removeParameters(paramname)
 
 
 
@@ -195,6 +236,7 @@
 
         return clazz.allFromStream(StringIO.StringIO(string))
 
+
     @classmethod
     def allFromStream(clazz, stream):
         """
@@ -202,13 +244,14 @@
         """
         try:
             results = Card.parseMultiple(stream)
-        except PyCalendarError:
+        except ErrorBase:
             results = None
         if not results:
             stream.seek(0)
             raise InvalidVCardDataError("%s" % (stream.read(),))
         return [clazz(None, pycard=result) for result in results]
 
+
     @classmethod
     def fromString(clazz, string):
         """
@@ -229,6 +272,7 @@
 
         return clazz.fromStream(StringIO.StringIO(string))
 
+
     @classmethod
     def fromStream(clazz, stream):
         """
@@ -240,13 +284,14 @@
         cal = Card()
         try:
             result = cal.parse(stream)
-        except PyCalendarError:
+        except ErrorBase:
             result = None
         if not result:
             stream.seek(0)
             raise InvalidVCardDataError("%s" % (stream.read(),))
         return clazz(None, pycard=cal)
 
+
     @classmethod
     def fromIStream(clazz, stream):
         """
@@ -261,9 +306,11 @@
         #   A better solution would parse directly and incrementally from the
         #   request stream.
         #
-        def parse(data): return clazz.fromString(data)
+        def parse(data):
+            return clazz.fromString(data)
         return allDataFromStream(IStream(stream), parse)
 
+
     def __init__(self, name, **kwargs):
         """
         Use this constructor to initialize an empty L{Component}.
@@ -277,8 +324,8 @@
                 pyobj = kwargs["pycard"]
 
                 if pyobj is not None:
-                    if not isinstance(pyobj, PyCalendarComponentBase):
-                        raise TypeError("Not a PyCalendarComponentBase: %r" % (pyobj,))
+                    if not isinstance(pyobj, ComponentBase):
+                        raise TypeError("Not a ComponentBase: %r" % (pyobj,))
 
                 self._pycard = pyobj
             else:
@@ -302,28 +349,41 @@
         else:
             raise ValueError("VCards have no child components")
 
-    def __str__ (self): return str(self._pycard)
-    def __repr__(self): return "<%s: %r>" % (self.__class__.__name__, str(self._pycard))
 
+    def __str__(self):
+        return str(self._pycard)
+
+
+    def __repr__(self):
+        return "<%s: %r>" % (self.__class__.__name__, str(self._pycard))
+
+
     def __hash__(self):
         return hash(str(self))
 
-    def __ne__(self, other): return not self.__eq__(other)
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+
     def __eq__(self, other):
         if not isinstance(other, Component):
             return False
         return self._pycard == other._pycard
 
+
     # FIXME: Should this not be in __eq__?
     def same(self, other):
         return self._pycard == other._pycard
 
+
     def name(self):
         """
         @return: the name of the iCalendar type of this component.
         """
         return self._pycard.getType()
 
+
     def duplicate(self):
         """
         Duplicate this object and all its contents.
@@ -331,6 +391,7 @@
         """
         return Component(None, pycard=self._pycard.duplicate())
 
+
     def hasProperty(self, name):
         """
         @param name: the name of the property whose existence is being tested.
@@ -338,6 +399,7 @@
         """
         return self._pycard.hasProperty(name)
 
+
     def getProperty(self, name):
         """
         Get one property from the property list.
@@ -346,10 +408,13 @@
         @raise: L{ValueError} if there is more than one property of the given name.
         """
         properties = tuple(self.properties(name))
-        if len(properties) == 1: return properties[0]
-        if len(properties) > 1: raise InvalidVCardDataError("More than one %s property in component %r" % (name, self))
+        if len(properties) == 1:
+            return properties[0]
+        if len(properties) > 1:
+            raise InvalidVCardDataError("More than one %s property in component %r" % (name, self))
         return None
 
+
     def properties(self, name=None):
         """
         @param name: if given and not C{None}, restricts the returned properties
@@ -368,6 +433,7 @@
             for p in properties
         )
 
+
     def propertyValue(self, name):
         properties = tuple(self.properties(name))
         if len(properties) == 1:
@@ -385,6 +451,7 @@
         self._pycard.addProperty(property._pycard)
         self._pycard.finalise()
 
+
     def removeProperty(self, property):
         """
         Remove a property from this component.
@@ -393,6 +460,7 @@
         self._pycard.removeProperty(property._pycard)
         self._pycard.finalise()
 
+
     def removeProperties(self, name):
         """
         remove all properties with name
@@ -400,6 +468,7 @@
         """
         self._pycard.removeProperties(name)
 
+
     def replaceProperty(self, property):
         """
         Add or replace a property in this component.
@@ -410,6 +479,7 @@
         self._pycard.removeProperties(property.name())
         self.addProperty(property)
 
+
     def resourceUID(self):
         """
         @return: the UID of the subcomponents in this component.
@@ -421,6 +491,7 @@
 
         return self._resource_uid
 
+
     def resourceKind(self):
         """
         @return: the kind of the subcomponents in this component.
@@ -432,6 +503,7 @@
 
         return self._resource_kind
 
+
     def resourceMemberAddresses(self):
         """
         @return: an iterable of X-ADDRESSBOOKSERVER-MEMBER property values
@@ -440,6 +512,7 @@
 
         return [prop.value() for prop in list(self.properties("X-ADDRESSBOOKSERVER-MEMBER"))]
 
+
     def validVCardData(self, doFix=True, doRaise=True):
         """
         @return: tuple of fixed, unfixed issues
@@ -460,11 +533,13 @@
 
         return fixed, unfixed
 
+
     def validForCardDAV(self):
         """
         @raise ValueError: if the given vcard data is not valid.
         """
-        if self.name() != "VCARD": raise InvalidVCardDataError("Not a vcard")
+        if self.name() != "VCARD":
+            raise InvalidVCardDataError("Not a vcard")
 
         version = self.propertyValue("VERSION")
         if version != "3.0":

Modified: CalendarServer/branches/users/cdaboo/json/twistedcaldav/xmlutil.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/twistedcaldav/xmlutil.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/twistedcaldav/xmlutil.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -24,17 +24,21 @@
 except ImportError:
     from xml.parsers.expat import ExpatError as XMLParseError
 
+
+
 # Utilities for working with ElementTree
 
 def readXMLString(xmldata, expectedRootTag=None):
     io = StringIO.StringIO(xmldata)
     return readXML(io, expectedRootTag)
 
+
+
 def readXML(xmlfile, expectedRootTag=None):
     """
     Read in XML data from a file and parse into ElementTree. Optionally verify
     the root node is what we expect.
-    
+
     @param xmlfile: file to read from
     @type xmlfile: C{File}
     @param expectedRootTag: root tag (qname) to test or C{None}
@@ -52,14 +56,18 @@
         root = etree.getroot()
         if root.tag != expectedRootTag:
             raise ValueError("Ignoring file '%s' because it is not a %s file" % (xmlfile, expectedRootTag,))
-    
+
     return etree, etree.getroot()
 
+
+
 def elementToXML(element):
     return XML.tostring(element, "utf-8")
 
+
+
 def writeXML(xmlfile, root):
-    
+
     data = """<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE %s SYSTEM "%s.dtd">
 
@@ -69,7 +77,7 @@
 
     # Generate indentation
     def _indentNode(node, level=0):
-        
+
         if node.text is not None and node.text.strip():
             return
         elif len(node):
@@ -87,27 +95,35 @@
     with open(xmlfile, "w") as f:
         f.write(data)
 
+
+
 def newElementTreeWithRoot(roottag):
 
     root = createElement(roottag)
     etree = XML.ElementTree(root)
-    
+
     return etree, root
 
+
+
 def createElement(tag, text=None, **attrs):
 
     child = XML.Element(tag, attrs)
     child.text = text
     return child
 
+
+
 def addSubElement(parent, tag, text=None):
 
     child = XML.SubElement(parent, tag)
     child.text = text
     return child
 
+
+
 def changeSubElementText(parent, tag, text):
-    
+
     child = parent.find(tag)
     if child is not None:
         child.text = text

Modified: CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/subpostgres.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/subpostgres.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -469,7 +469,7 @@
             log.failure("starting postgres", f)
             self.deactivateDelayedShutdown()
             self.reactor.stop()
-            
+
         self.monitor.completionDeferred.addCallback(
             gotReady).addErrback(reportit)
 
@@ -549,6 +549,7 @@
 #        d.addCallback(maybeStopSubprocess)
 #        return d
 
+
     def hardStop(self):
         """
         Stop postgres quickly by sending it SIGQUIT
@@ -556,5 +557,5 @@
         if self._postgresPid is not None:
             try:
                 os.kill(self._postgresPid, signal.SIGQUIT)
-            except OSError: 
+            except OSError:
                 pass

Modified: CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/test/test_subpostgres.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/test/test_subpostgres.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/base/datastore/test/test_subpostgres.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -189,5 +189,3 @@
         cursor.execute("select * from import_test_table")
         values = cursor.fetchall()
         self.assertEquals(values, [["value1"], ["value2"]])
-
-

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/index_file.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/index_file.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/index_file.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -55,9 +55,9 @@
 from twistedcaldav.config import config
 from twistedcaldav.memcachepool import CachePoolUserMixIn
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.timezone import Timezone
 
 log = Logger()
 
@@ -341,7 +341,7 @@
                     maxDate = maxDate.duplicate()
                     maxDate.setDateOnly(True)
                     if isStartDate:
-                        maxDate += PyCalendarDuration(days=365)
+                        maxDate += Duration(days=365)
                     self.testAndUpdateIndex(maxDate)
             else:
                 # We cannot handle this filter in an indexed search
@@ -671,7 +671,7 @@
         if master is None or not calendar.isRecurring():
             # When there is no master we have a set of overridden components - index them all.
             # When there is one instance - index it.
-            expand = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            expand = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
             doInstanceIndexing = True
         else:
             # If migrating or re-creating or config option for delayed indexing is off, always index
@@ -682,8 +682,8 @@
             # by default.  This is a caching parameter which affects the size of the index;
             # it does not affect search results beyond this period, but it may affect
             # performance of such a search.
-            expand = (PyCalendarDateTime.getToday() +
-                      PyCalendarDuration(days=config.FreeBusyIndexExpandAheadDays))
+            expand = (DateTime.getToday() +
+                      Duration(days=config.FreeBusyIndexExpandAheadDays))
 
             if expand_until and expand_until > expand:
                 expand = expand_until
@@ -700,8 +700,8 @@
             # occurrences into some obscenely far-in-the-future date, so we cap the caching
             # period.  Searches beyond this period will always be relatively expensive for
             # resources with occurrences beyond this period.
-            if expand > (PyCalendarDateTime.getToday() +
-                         PyCalendarDuration(days=config.FreeBusyIndexExpandMaxDays)):
+            if expand > (DateTime.getToday() +
+                         Duration(days=config.FreeBusyIndexExpandMaxDays)):
                 raise IndexedSearchException()
 
         # Always do recurrence expansion even if we do not intend to index - we need this to double-check the
@@ -716,7 +716,7 @@
         # Now coerce indexing to off if needed
         if not doInstanceIndexing:
             instances = None
-            recurrenceLimit = PyCalendarDateTime(1900, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            recurrenceLimit = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
 
         self._delete_from_db(name, uid, False)
 
@@ -782,8 +782,8 @@
             # Special - for unbounded recurrence we insert a value for "infinity"
             # that will allow an open-ended time-range to always match it.
             if calendar.isRecurringUnbounded():
-                start = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-                end = PyCalendarDateTime(2100, 1, 1, 1, 0, 0, tzid=PyCalendarTimezone(utc=True))
+                start = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+                end = DateTime(2100, 1, 1, 1, 0, 0, tzid=Timezone(utc=True))
                 float = 'N'
                 self._db_execute(
                     """

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/caldav/test/test_scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/caldav/test/test_scheduler.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/caldav/test/test_scheduler.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twext.python.clsprop import classproperty
 
@@ -45,7 +45,7 @@
         self._sqlCalendarStore = yield buildCalendarStore(self, self.notifierFactory)
         yield self.populate()
 
-        self.now = PyCalendarDateTime.getNowUTC()
+        self.now = DateTime.getNowUTC()
         self.now.setHHMMSS(0, 0, 0)
 
         self.now_12H = self.now.duplicate()

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/freebusy.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/freebusy.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/freebusy.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,10 +14,10 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.period import PyCalendarPeriod
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.period import Period
+from pycalendar.timezone import Timezone
 
 from twext.python.log import Logger
 
@@ -68,8 +68,8 @@
         if entry:
 
             # Offset one day at either end to account for floating
-            cached_start = entry.timerange.start + PyCalendarDuration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
-            cached_end = entry.timerange.end - PyCalendarDuration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
+            cached_start = entry.timerange.start + Duration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
+            cached_end = entry.timerange.end - Duration(days=FBCacheEntry.CACHE_DAYS_FLOATING_ADJUST)
 
             # Verify that the requested time range lies within the cache time range
             if compareDateTime(timerange.end, cached_end) <= 0 and compareDateTime(timerange.start, cached_start) >= 0:
@@ -187,8 +187,8 @@
                 logItems["fb-uncached"] = logItems.get("fb-uncached", 0) + 1
 
             # We want to cache a large range of time based on the current date
-            cache_start = normalizeToUTC(PyCalendarDateTime.getToday() + PyCalendarDuration(days=0 - config.FreeBusyCacheDaysBack))
-            cache_end = normalizeToUTC(PyCalendarDateTime.getToday() + PyCalendarDuration(days=config.FreeBusyCacheDaysForward))
+            cache_start = normalizeToUTC(DateTime.getToday() + Duration(days=0 - config.FreeBusyCacheDaysBack))
+            cache_end = normalizeToUTC(DateTime.getToday() + Duration(days=config.FreeBusyCacheDaysForward))
 
             # If the requested time range would fit in our allowed cache range, trigger the cache creation
             if compareDateTime(timerange.start, cache_start) >= 0 and compareDateTime(timerange.end, cache_end) <= 0:
@@ -227,7 +227,7 @@
             logItems["fb-cached"] = logItems.get("fb-cached", 0) + 1
 
         # Determine appropriate timezone (UTC is the default)
-        tzinfo = tz.gettimezone() if tz is not None else PyCalendarTimezone(utc=True)
+        tzinfo = tz.gettimezone() if tz is not None else Timezone(utc=True)
 
     # We care about separate instances for VEVENTs only
     aggregated_resources = {}
@@ -270,15 +270,15 @@
                 if float == 'Y':
                     fbstart.setTimezone(tzinfo)
                 else:
-                    fbstart.setTimezone(PyCalendarTimezone(utc=True))
+                    fbstart.setTimezone(Timezone(utc=True))
                 fbend = parseSQLTimestampToPyCalendar(end)
                 if float == 'Y':
                     fbend.setTimezone(tzinfo)
                 else:
-                    fbend.setTimezone(PyCalendarTimezone(utc=True))
+                    fbend.setTimezone(Timezone(utc=True))
 
                 # Clip instance to time range
-                clipped = clipPeriod(PyCalendarPeriod(fbstart, duration=fbend - fbstart), PyCalendarPeriod(timerange.start, timerange.end))
+                clipped = clipPeriod(Period(fbstart, duration=fbend - fbstart), Period(timerange.start, timerange.end))
 
                 # Double check for overlap
                 if clipped:
@@ -364,7 +364,7 @@
     @param timerange: the time-range in which to expand
     @type timerange: L{TimeRange}
     @param tzinfo: timezone for floating time calculations
-    @type tzinfo: L{PyCalendarTimezone}
+    @type tzinfo: L{Timezone}
     """
 
     # First expand the component
@@ -404,7 +404,7 @@
     @param calendar: the L{Component} that is the VCALENDAR containing the VEVENT's.
     @param fbinfo: the tuple used to store the three types of fb data.
     @param timerange: the time range to restrict free busy data to.
-    @param tzinfo: the L{PyCalendarTimezone} for the timezone to use for floating/all-day events.
+    @param tzinfo: the L{Timezone} for the timezone to use for floating/all-day events.
     """
 
     # Expand out the set of instances for the event with in the required range
@@ -449,10 +449,10 @@
         # Clip period for this instance - use duration for period end if that
         # is what original component used
         if instance.component.hasProperty("DURATION"):
-            period = PyCalendarPeriod(fbstart, duration=fbend - fbstart)
+            period = Period(fbstart, duration=fbend - fbstart)
         else:
-            period = PyCalendarPeriod(fbstart, fbend)
-        clipped = clipPeriod(period, PyCalendarPeriod(timerange.start, timerange.end))
+            period = Period(fbstart, fbend)
+        clipped = clipPeriod(period, Period(timerange.start, timerange.end))
 
         # Double check for overlap
         if clipped:
@@ -490,7 +490,7 @@
             assert isinstance(fb.value(), list), "FREEBUSY property does not contain a list of values: %r" % (fb,)
             for period in fb.value():
                 # Clip period for this instance
-                clipped = clipPeriod(period.getValue(), PyCalendarPeriod(timerange.start, timerange.end))
+                clipped = clipPeriod(period.getValue(), Period(timerange.start, timerange.end))
                 if clipped:
                     fbinfo[fbtype_mapper.get(fbtype, 0)].append(clipped)
 
@@ -509,12 +509,12 @@
         # Get overall start/end
         start = vav.getStartDateUTC()
         if start is None:
-            start = PyCalendarDateTime(1900, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            start = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         end = vav.getEndDateUTC()
         if end is None:
-            end = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-        period = PyCalendarPeriod(start, end)
-        overall = clipPeriod(period, PyCalendarPeriod(timerange.start, timerange.end))
+            end = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+        period = Period(start, end)
+        overall = clipPeriod(period, Period(timerange.start, timerange.end))
         if overall is None:
             continue
 
@@ -526,10 +526,10 @@
         last_end = timerange.start
         for period in periods:
             if last_end < period.getStart():
-                busyperiods.append(PyCalendarPeriod(last_end, period.getStart()))
+                busyperiods.append(Period(last_end, period.getStart()))
             last_end = period.getEnd()
         if last_end < timerange.end:
-            busyperiods.append(PyCalendarPeriod(last_end, timerange.end))
+            busyperiods.append(Period(last_end, timerange.end))
 
         # Add to actual results mapped by busy type
         fbtype = vav.propertyValue("BUSYTYPE")
@@ -576,10 +576,10 @@
             # Clip period for this instance - use duration for period end if that
             # is what original component used
             if instance.component.hasProperty("DURATION"):
-                period = PyCalendarPeriod(start, duration=end - start)
+                period = Period(start, duration=end - start)
             else:
-                period = PyCalendarPeriod(start, end)
-            clipped = clipPeriod(period, PyCalendarPeriod(timerange.start, timerange.end))
+                period = Period(start, end)
+            clipped = clipPeriod(period, Period(timerange.start, timerange.end))
             if clipped:
                 periods.append(clipped)
 
@@ -622,7 +622,7 @@
         fb.addProperty(attendee)
     fb.addProperty(Property("DTSTART", timerange.start))
     fb.addProperty(Property("DTEND", timerange.end))
-    fb.addProperty(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+    fb.addProperty(Property("DTSTAMP", DateTime.getNowUTC()))
     if len(fbinfo[0]) != 0:
         fb.addProperty(Property("FREEBUSY", fbinfo[0], {"FBTYPE": "BUSY"}))
     if len(fbinfo[1]) != 0:

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icaldiff.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icaldiff.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icaldiff.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,8 +16,8 @@
 
 from difflib import unified_diff
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.period import PyCalendarPeriod
+from pycalendar.datetime import DateTime
+from pycalendar.period import Period
 
 from twext.python.log import Logger
 
@@ -484,7 +484,7 @@
 
             # If PARTSTAT was changed by the attendee, add a timestamp if needed
             if config.Scheduling.Options.TimestampAttendeePartStatChanges:
-                serverAttendee.setParameter("X-CALENDARSERVER-DTSTAMP", PyCalendarDateTime.getNowUTC().getText())
+                serverAttendee.setParameter("X-CALENDARSERVER-DTSTAMP", DateTime.getNowUTC().getText())
 
             replyNeeded = True
 
@@ -590,7 +590,7 @@
             dtend = component.getProperty("DTEND")
             duration = component.getProperty("DURATION")
 
-            timeRange = PyCalendarPeriod(
+            timeRange = Period(
                 start=dtstart.value()  if dtstart  is not None else None,
                 end=dtend.value()    if dtend    is not None else None,
                 duration=duration.value() if duration is not None else None,
@@ -602,12 +602,12 @@
             duration = component.getProperty("DURATION")
 
             if dtstart or duration:
-                timeRange = PyCalendarPeriod(
+                timeRange = Period(
                     start=dtstart.value()  if dtstart  is not None else None,
                     duration=duration.value() if duration is not None else None,
                 )
             else:
-                timeRange = PyCalendarPeriod()
+                timeRange = Period()
 
             newdue = component.getProperty("DUE")
             if newdue is not None:
@@ -627,7 +627,7 @@
         rdates = component.properties("RDATE")
         for rdate in rdates:
             for value in rdate.value():
-                if isinstance(value, PyCalendarDateTime):
+                if isinstance(value, DateTime):
                     value = value.duplicate().adjustToUTC()
                 newrdates.add(value)
 

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icalsplitter.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icalsplitter.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/icalsplitter.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twistedcaldav.ical import Property
 
@@ -34,10 +34,10 @@
 
         """
         self.threshold = threshold
-        self.past = PyCalendarDateTime.getNowUTC()
+        self.past = DateTime.getNowUTC()
         self.past.setHHMMSS(0, 0, 0)
         self.past.offsetDay(-past)
-        self.now = PyCalendarDateTime.getNowUTC()
+        self.now = DateTime.getNowUTC()
         self.now.setHHMMSS(0, 0, 0)
         self.now.offsetDay(-1)
 
@@ -91,7 +91,7 @@
         @type ical: L{Component}
 
         @return: recurrence-id of the split
-        @rtype: L{PyCalendarDateTime}
+        @rtype: L{DateTime}
         """
 
         # Find the instance RECURRENCE-ID where a split is going to happen
@@ -124,7 +124,7 @@
         @type ical: L{Component}
 
         @param rid: recurrence-id where the split should occur, or C{None} to determine it here
-        @type rid: L{PyCalendarDateTime} or C{None}
+        @type rid: L{DateTime} or C{None}
 
         @param olderUID: UID to use for the split off component, or C{None} to generate one here
         @type olderUID: C{str} or C{None}

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/outbound.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/outbound.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/outbound.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -26,8 +26,8 @@
 from email.mime.multipart import MIMEMultipart
 from email.mime.text import MIMEText
 import email.utils
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
 from twext.enterprise.dal.record import fromTable
 from twext.enterprise.queue import WorkItem
 from twext.python.log import Logger
@@ -320,8 +320,8 @@
         """
 
         if onlyAfter is None:
-            duration = PyCalendarDuration(days=self.suppressionDays)
-            onlyAfter = PyCalendarDateTime.getNowUTC() - duration
+            duration = Duration(days=self.suppressionDays)
+            onlyAfter = DateTime.getNowUTC() - duration
 
         icaluid = calendar.resourceUID()
         method = calendar.propertyValue("METHOD")

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -17,7 +17,7 @@
 
 from cStringIO import StringIO
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twisted.internet.defer import inlineCallbacks, succeed
 from twisted.trial import unittest
@@ -275,7 +275,7 @@
                 inputOriginator,
                 inputRecipient,
                 Component.fromString(inputCalendar.replace("\n", "\r\n")),
-                onlyAfter=PyCalendarDateTime(2010, 1, 1, 0, 0, 0)
+                onlyAfter=DateTime(2010, 1, 1, 0, 0, 0)
             )
             yield txn.commit()
 
@@ -319,7 +319,7 @@
                 inputOriginator,
                 inputRecipient,
                 Component.fromString(inputCalendar.replace("\n", "\r\n")),
-                onlyAfter=PyCalendarDateTime(2021, 1, 1, 0, 0, 0)
+                onlyAfter=DateTime(2021, 1, 1, 0, 0, 0)
             )
             yield txn.commit()
             self.assertFalse(self.sender.smtpSender.sendMessageCalled)
@@ -381,7 +381,7 @@
         txn = self.store.newTransaction()
         yield self.sender.outbound(txn, inputOriginator, inputRecipient,
             Component.fromString(inputCalendar.replace("\n", "\r\n")),
-            onlyAfter=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
+            onlyAfter=DateTime(2010, 1, 1, 0, 0, 0))
 
         # Verify we didn't create a new token...
         txn = self.store.newTransaction()

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/ischedule/resource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/ischedule/resource.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/ischedule/resource.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,8 +14,8 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twext.web2 import responsecode
 from twext.web2.dav.http import ErrorResponse
@@ -157,10 +157,10 @@
         """
 
         # Determine min/max date-time for iSchedule
-        now = PyCalendarDateTime.getNowUTC()
-        minDateTime = PyCalendarDateTime(now.getYear(), 1, 1, 0, 0, 0, PyCalendarTimezone(utc=True))
+        now = DateTime.getNowUTC()
+        minDateTime = DateTime(now.getYear(), 1, 1, 0, 0, 0, Timezone(utc=True))
         minDateTime.offsetYear(-1)
-        maxDateTime = PyCalendarDateTime(now.getYear(), 1, 1, 0, 0, 0, PyCalendarTimezone(utc=True))
+        maxDateTime = DateTime(now.getYear(), 1, 1, 0, 0, 0, Timezone(utc=True))
         maxDateTime.offsetYear(10)
 
         result = ischedulexml.QueryResult(

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/itip.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/itip.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -33,7 +33,7 @@
 from twistedcaldav.ical import Property, iCalendarProductID, Component, \
     ignoredComponents
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 log = Logger()
 
@@ -476,7 +476,7 @@
 
                 # Add default parameters
                 private_comment.setParameter("X-CALENDARSERVER-ATTENDEE-REF", attendee.value())
-                private_comment.setParameter("X-CALENDARSERVER-DTSTAMP", PyCalendarDateTime.getNowUTC().getText())
+                private_comment.setParameter("X-CALENDARSERVER-DTSTAMP", DateTime.getNowUTC().getText())
 
                 # Set value empty
                 private_comment.setValue("")
@@ -491,7 +491,7 @@
                     attendee_comment.value(),
                     params={
                         "X-CALENDARSERVER-ATTENDEE-REF": attendee.value(),
-                        "X-CALENDARSERVER-DTSTAMP": PyCalendarDateTime.getNowUTC().getText(),
+                        "X-CALENDARSERVER-DTSTAMP": DateTime.getNowUTC().getText(),
                     }
                 )
                 to_component.addProperty(private_comment)
@@ -506,7 +506,7 @@
 
                     # Add default parameters
                     private_comment.setParameter("X-CALENDARSERVER-ATTENDEE-REF", attendee.value())
-                    private_comment.setParameter("X-CALENDARSERVER-DTSTAMP", PyCalendarDateTime.getNowUTC().getText())
+                    private_comment.setParameter("X-CALENDARSERVER-DTSTAMP", DateTime.getNowUTC().getText())
 
                     # Set new value
                     private_comment.setValue(attendee_comment.value())
@@ -854,7 +854,7 @@
         itip.filterComponents(changedRids)
 
         # Force update to DTSTAMP everywhere so reply sequencing will work
-        itip.replacePropertyInAllComponents(Property("DTSTAMP", PyCalendarDateTime.getNowUTC()))
+        itip.replacePropertyInAllComponents(Property("DTSTAMP", DateTime.getNowUTC()))
 
         # Remove all attendees except the one we want
         itip.removeAllButOneAttendee(attendee)

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/processing.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/processing.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,9 +14,9 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.timezone import Timezone
 
 from twext.python.log import Logger
 from twext.web2.dav.method.report import NumberOfMatchesWithinLimits
@@ -785,13 +785,13 @@
         cuas = self.recipient.principal.calendarUserAddresses
 
         # First expand current one to get instances (only go 1 year into the future)
-        default_future_expansion_duration = PyCalendarDuration(days=config.Scheduling.Options.AutoSchedule.FutureFreeBusyDays)
-        expand_max = PyCalendarDateTime.getToday() + default_future_expansion_duration
+        default_future_expansion_duration = Duration(days=config.Scheduling.Options.AutoSchedule.FutureFreeBusyDays)
+        expand_max = DateTime.getToday() + default_future_expansion_duration
         instances = calendar.expandTimeRanges(expand_max, ignoreInvalidInstances=True)
 
         # We are going to ignore auto-accept processing for anything more than a day old (actually use -2 days
         # to add some slop to account for possible timezone offsets)
-        min_date = PyCalendarDateTime.getToday()
+        min_date = DateTime.getToday()
         min_date.offsetDay(-2)
         allOld = True
 
@@ -824,7 +824,7 @@
             # Get the timezone property from the collection, and store in the query filter
             # for use during the query itself.
             tz = testcal.getTimezone()
-            tzinfo = tz.gettimezone() if tz is not None else PyCalendarTimezone(utc=True)
+            tzinfo = tz.gettimezone() if tz is not None else Timezone(utc=True)
 
             # Now do search for overlapping time-range and set instance.free based
             # on whether there is an overlap or not

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_freebusy.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_freebusy.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_freebusy.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,8 +14,8 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.period import PyCalendarPeriod
+from pycalendar.datetime import DateTime
+from pycalendar.period import Period
 
 from twext.python.clsprop import classproperty
 
@@ -94,7 +94,7 @@
             (
                 "#1.3 With single busy time",
                 [
-                    [PyCalendarPeriod.parseText("20080601T120000Z/20080601T130000Z"), ],
+                    [Period.parseText("20080601T120000Z/20080601T130000Z"), ],
                     [],
                     [],
                 ],
@@ -120,8 +120,8 @@
                 "#1.4 With multiple busy time",
                 [
                     [
-                        PyCalendarPeriod.parseText("20080601T120000Z/20080601T130000Z"),
-                        PyCalendarPeriod.parseText("20080601T140000Z/20080601T150000Z"),
+                        Period.parseText("20080601T120000Z/20080601T130000Z"),
+                        Period.parseText("20080601T140000Z/20080601T150000Z"),
                     ],
                     [],
                     [],
@@ -148,10 +148,10 @@
                 "#1.5 With multiple busy time, some overlap",
                 [
                     [
-                        PyCalendarPeriod.parseText("20080601T120000Z/20080601T130000Z"),
-                        PyCalendarPeriod.parseText("20080601T123000Z/20080601T133000Z"),
-                        PyCalendarPeriod.parseText("20080601T140000Z/20080601T150000Z"),
-                        PyCalendarPeriod.parseText("20080601T150000Z/20080601T160000Z"),
+                        Period.parseText("20080601T120000Z/20080601T130000Z"),
+                        Period.parseText("20080601T123000Z/20080601T133000Z"),
+                        Period.parseText("20080601T140000Z/20080601T150000Z"),
+                        Period.parseText("20080601T150000Z/20080601T160000Z"),
                     ],
                     [],
                     [],
@@ -178,14 +178,14 @@
                 "#1.6 With all busy time types",
                 [
                     [
-                        PyCalendarPeriod.parseText("20080601T120000Z/20080601T130000Z"),
-                        PyCalendarPeriod.parseText("20080601T140000Z/20080601T150000Z"),
+                        Period.parseText("20080601T120000Z/20080601T130000Z"),
+                        Period.parseText("20080601T140000Z/20080601T150000Z"),
                     ],
                     [
-                        PyCalendarPeriod.parseText("20080601T140000Z/20080601T150000Z"),
+                        Period.parseText("20080601T140000Z/20080601T150000Z"),
                     ],
                     [
-                        PyCalendarPeriod.parseText("20080601T160000Z/20080601T170000Z"),
+                        Period.parseText("20080601T160000Z/20080601T170000Z"),
                     ],
                 ],
                 "20080601T000000Z",
@@ -211,7 +211,7 @@
             (
                 "#1.7 With single busy time and event details",
                 [
-                    [PyCalendarPeriod.parseText("20080601T120000Z/20080601T130000Z"), ],
+                    [Period.parseText("20080601T120000Z/20080601T130000Z"), ],
                     [],
                     [],
                 ],
@@ -269,7 +269,7 @@
         self._sqlCalendarStore = yield buildCalendarStore(self, self.notifierFactory)
         yield self.populate()
 
-        self.now = PyCalendarDateTime.getNowUTC()
+        self.now = DateTime.getNowUTC()
         self.now.setHHMMSS(0, 0, 0)
 
         self.now_12H = self.now.duplicate()
@@ -368,7 +368,7 @@
         timerange = caldavxml.TimeRange(start=self.now.getText(), end=self.now_1D.getText())
         result = (yield generateFreeBusyInfo(calendar, fbinfo, timerange, matchtotal))
         self.assertEqual(result, 1)
-        self.assertEqual(fbinfo[0], [PyCalendarPeriod.parseText("%s/%s" % (self.now_12H.getText(), self.now_13H.getText(),)), ])
+        self.assertEqual(fbinfo[0], [Period.parseText("%s/%s" % (self.now_12H.getText(), self.now_13H.getText(),)), ])
         self.assertEqual(len(fbinfo[1]), 0)
         self.assertEqual(len(fbinfo[2]), 0)
 
@@ -406,7 +406,7 @@
             event_details=event_details
         ))
         self.assertEqual(result, 1)
-        self.assertEqual(fbinfo[0], [PyCalendarPeriod.parseText("%s/%s" % (self.now_12H.getText(), self.now_13H.getText(),)), ])
+        self.assertEqual(fbinfo[0], [Period.parseText("%s/%s" % (self.now_12H.getText(), self.now_13H.getText(),)), ])
         self.assertEqual(len(fbinfo[1]), 0)
         self.assertEqual(len(fbinfo[2]), 0)
         self.assertEqual(len(event_details), 1)

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 from twisted.trial import unittest
 from twistedcaldav.stdconfig import config
 from twistedcaldav.ical import Component
@@ -31,7 +31,7 @@
 
         self.subs = {}
 
-        self.now = PyCalendarDateTime.getNowUTC()
+        self.now = DateTime.getNowUTC()
         self.now.setHHMMSS(0, 0, 0)
 
         self.subs["now"] = self.now

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_implicit.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_implicit.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_implicit.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -14,8 +14,8 @@
 # limitations under the License.
 ##
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twext.python.clsprop import classproperty
 from twext.web2 import responsecode
@@ -246,9 +246,9 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -285,12 +285,12 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 9, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 9, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 9, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 9, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 9, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 9, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -328,15 +328,15 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 9, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 9, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 9, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 12, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 12, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 12, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 9, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 9, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 9, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 12, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 12, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 12, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -445,7 +445,7 @@
 """,
                 (
                     ("mailto:user3 at example.com", None),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -500,7 +500,7 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -646,9 +646,9 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user3 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user3 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -703,7 +703,7 @@
 """,
                 (
                     ("mailto:user3 at example.com", None),
-                    ("mailto:user4 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user4 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -749,7 +749,7 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user4 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user4 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
             (
@@ -796,9 +796,9 @@
 END:VCALENDAR
 """,
                 (
-                    ("mailto:user1 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user2 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
-                    ("mailto:user4 at example.com", PyCalendarDateTime(2008, 8, 1, 12, 0, 0, tzid=PyCalendarTimezone(utc=True))),
+                    ("mailto:user1 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user2 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
+                    ("mailto:user4 at example.com", DateTime(2008, 8, 1, 12, 0, 0, tzid=Timezone(utc=True))),
                 ),
             ),
         )

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_itip.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_itip.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -15,8 +15,8 @@
 ##
 from __future__ import print_function
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twisted.trial import unittest
 
@@ -2025,7 +2025,7 @@
 END:VCALENDAR
 """,
                 ("mailto:user2 at example.com",),
-                (PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),),
+                (DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),),
             ),
 
             # Recurring component with one instance, each with one attendee - cancel instance
@@ -2066,7 +2066,7 @@
 END:VCALENDAR
 """,
                 ("mailto:user2 at example.com",),
-                (PyCalendarDateTime(2008, 11, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),),
+                (DateTime(2008, 11, 14, 0, 0, 0, tzid=Timezone(utc=True)),),
             ),
 
             # Recurring component with one instance, each with one attendee - cancel master
@@ -2127,7 +2127,7 @@
 """,
                 "",
                 ("mailto:user2 at example.com",),
-                (PyCalendarDateTime(2008, 12, 14, 0, 0, 0, tzid=PyCalendarTimezone(utc=True)),),
+                (DateTime(2008, 12, 14, 0, 0, 0, tzid=Timezone(utc=True)),),
             ),
 
         )
@@ -2229,7 +2229,8 @@
 DTSTART;TZID=America/Los_Angeles:20101007T113000
 DTEND;TZID=America/Los_Angeles:20101007T120000
 ATTENDEE;CN=Missing Attendee;CUTYPE=INDIVIDUAL;EMAIL=missing at example.com;P
- ARTSTAT=DECLINED;ROLE=OPT-PARTICIPANT;RSVP=TRUE:mailto:missing at example.com
+ ARTSTAT=DECLINED;ROLE=OPT-PARTICIPANT;RSVP=TRUE:mailto:missing at example.co
+ m
 ORGANIZER;CN=The Organizer:mailto:organizer at example.com
 REQUEST-STATUS:2.0;Success
 SEQUENCE:24

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_utils.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_utils.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/scheduling/test/test_utils.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -18,7 +18,7 @@
 Tests for calendarserver.tools.purge
 """
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twisted.internet.defer import inlineCallbacks
 from twisted.trial import unittest
@@ -30,7 +30,7 @@
 from txdav.common.datastore.test.util import populateCalendarsFrom, CommonCommonTests
 
 
-now = PyCalendarDateTime.getToday().getYear()
+now = DateTime.getToday().getYear()
 
 ORGANIZER_ICS = """BEGIN:VCALENDAR
 VERSION:2.0

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/sql.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/sql.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -89,10 +89,10 @@
     InvalidUIDError, UIDExistsError, UIDExistsElsewhereError, \
     InvalidResourceMove, InvalidComponentForStoreError
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
-from pycalendar.timezone import PyCalendarTimezone
-from pycalendar.value import PyCalendarValue
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
+from pycalendar.timezone import Timezone
+from pycalendar.value import Value
 
 from zope.interface.declarations import implements
 
@@ -2243,7 +2243,7 @@
                 # When there is no master we have a set of overridden components -
                 #   index them all.
                 # When there is one instance - index it.
-                expand = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+                expand = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
                 doInstanceIndexing = True
             else:
 
@@ -2255,8 +2255,8 @@
                 # by default.  This is a caching parameter which affects the size of the index;
                 # it does not affect search results beyond this period, but it may affect
                 # performance of such a search.
-                expand = (PyCalendarDateTime.getToday() +
-                          PyCalendarDuration(days=config.FreeBusyIndexExpandAheadDays))
+                expand = (DateTime.getToday() +
+                          Duration(days=config.FreeBusyIndexExpandAheadDays))
 
                 if expand_until and expand_until > expand:
                     expand = expand_until
@@ -2273,12 +2273,12 @@
                 # occurrences into some obscenely far-in-the-future date, so we cap the caching
                 # period.  Searches beyond this period will always be relatively expensive for
                 # resources with occurrences beyond this period.
-                if expand > (PyCalendarDateTime.getToday() +
-                             PyCalendarDuration(days=config.FreeBusyIndexExpandMaxDays)):
+                if expand > (DateTime.getToday() +
+                             Duration(days=config.FreeBusyIndexExpandMaxDays)):
                     raise IndexedSearchException
 
             if config.FreeBusyIndexLowerLimitDays:
-                truncateLowerLimit = PyCalendarDateTime.getToday()
+                truncateLowerLimit = DateTime.getToday()
                 truncateLowerLimit.offsetDay(-config.FreeBusyIndexLowerLimitDays)
             else:
                 truncateLowerLimit = None
@@ -2305,7 +2305,7 @@
             if not doInstanceIndexing:
                 instances = None
                 recurrenceLowerLimit = None
-                recurrenceLimit = PyCalendarDateTime(1900, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+                recurrenceLimit = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
 
         co = schema.CALENDAR_OBJECT
         tr = schema.TIME_RANGE
@@ -2424,7 +2424,7 @@
         @param instances: the set of instances to add
         @type instances: L{InstanceList}
         @param truncateLowerLimit: the lower limit for instances
-        @type truncateLowerLimit: L{PyCalendarDateTime}
+        @type truncateLowerLimit: L{DateTime}
         @param isInboxItem: indicates if an inbox item
         @type isInboxItem: C{bool}
         @param txn: transaction to use
@@ -2453,8 +2453,8 @@
         # For truncated items we insert a tomb stone lower bound so that a time-range
         # query with just an end bound will match
         if lowerLimitApplied or instances.lowerLimit and len(instances.instances) == 0:
-            start = PyCalendarDateTime(1901, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-            end = PyCalendarDateTime(1901, 1, 1, 1, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            start = DateTime(1901, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+            end = DateTime(1901, 1, 1, 1, 0, 0, tzid=Timezone(utc=True))
             yield self._addInstanceDetails(component, None, start, end, False, True, "UNKNOWN", isInboxItem, txn)
 
         # Special - for unbounded recurrence we insert a value for "infinity"
@@ -2462,8 +2462,8 @@
         # We also need to add the "infinity" value if the event was bounded but
         # starts after the future expansion cut-off limit.
         if component.isRecurringUnbounded() or instances.limit and len(instances.instances) == 0:
-            start = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-            end = PyCalendarDateTime(2100, 1, 1, 1, 0, 0, tzid=PyCalendarTimezone(utc=True))
+            start = DateTime(2100, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+            end = DateTime(2100, 1, 1, 1, 0, 0, tzid=Timezone(utc=True))
             yield self._addInstanceDetails(component, None, start, end, False, True, "UNKNOWN", isInboxItem, txn)
 
 
@@ -2650,7 +2650,7 @@
         Get the RECURRANCE_MIN, RECURRANCE_MAX value from the database. Occasionally we might need to do an
         update to time-range data via a separate transaction, so we allow that to be passed in.
 
-        @return: L{PyCalendarDateTime} result
+        @return: L{DateTime} result
         """
         # Setup appropriate txn
         txn = txn if txn is not None else self._txn
@@ -4272,7 +4272,7 @@
         """
         Return an iCalendar ATTACH property for this attachment.
         """
-        attach = Property("ATTACH", "", valuetype=PyCalendarValue.VALUETYPE_URI)
+        attach = Property("ATTACH", "", valuetype=Value.VALUETYPE_URI)
         location = (yield self.updateProperty(attach))
         returnValue((attach, location,))
 

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/common.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/common.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -1338,7 +1338,7 @@
     @inlineCallbacks
     def test_iCalendarText(self):
         """
-        L{ICalendarObject.iCalendarText} returns a C{str} describing the same
+        L{ICalendarObject._text} returns a C{str} describing the same
         data provided by L{ICalendarObject.component}.
         """
         text = yield (yield self.calendarObjectUnderTest())._text()

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_attachments.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_attachments.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_attachments.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -16,8 +16,8 @@
 
 from calendarserver.tap.util import directoryFromConfig
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.value import PyCalendarValue
+from pycalendar.datetime import DateTime
+from pycalendar.value import Value
 
 from twext.enterprise.dal.syntax import Delete
 from twext.python.clsprop import classproperty
@@ -1249,7 +1249,7 @@
 
 
 
-now = PyCalendarDateTime.getToday().getYear()
+now = DateTime.getToday().getYear()
 
 PLAIN_ICS = """BEGIN:VCALENDAR
 VERSION:2.0
@@ -1454,7 +1454,7 @@
         cal.mainComponent().addProperty(Property(
             "ATTACH",
             "http://localhost/calendars/users/%s/dropbox/%s.dropbox/%s" % (home.name(), dropboxid, name,),
-            valuetype=PyCalendarValue.VALUETYPE_URI
+            valuetype=Value.VALUETYPE_URI
         ))
         yield event.setComponent(cal)
         yield txn.commit()
@@ -1477,7 +1477,7 @@
         cal.mainComponent().addProperty(Property(
             "ATTACH",
             "http://localhost/calendars/users/%s/dropbox/%s.dropbox/%s" % (owner_home, dropboxid, name,),
-            valuetype=PyCalendarValue.VALUETYPE_URI
+            valuetype=Value.VALUETYPE_URI
         ))
         yield event.setComponent(cal)
         yield txn.commit()

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_file.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_file.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_file.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -42,7 +42,7 @@
 from txdav.caldav.datastore.test.common import (
     CommonTests, test_event_text, event1modified_text)
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 storePath = FilePath(__file__).parent().child("calendar_store")
 
@@ -68,7 +68,7 @@
     storePath.copyTo(calendarPath)
 
     # Set year values to current year
-    nowYear = PyCalendarDateTime.getToday().getYear()
+    nowYear = DateTime.getToday().getYear()
     for home in calendarPath.child("ho").child("me").children():
         if not home.basename().startswith("."):
             for calendar in home.children():

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_index_file.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_index_file.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_index_file.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -30,7 +30,7 @@
 from twistedcaldav.test.util import InMemoryMemcacheProtocol
 import twistedcaldav.test.util
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 import os
 
@@ -311,7 +311,7 @@
             else:
                 self.assertFalse(self.db.resourceExists(name), msg=description)
 
-        self.db.testAndUpdateIndex(PyCalendarDateTime(2020, 1, 1))
+        self.db.testAndUpdateIndex(DateTime(2020, 1, 1))
         for description, name, calendar_txt, reCreate, ok in data:
             if ok:
                 self.assertTrue(self.db.resourceExists(name), msg=description)

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_sql.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/datastore/test/test_sql.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -27,8 +27,8 @@
 L{txdav.caldav.datastore.test.common}.
 """
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.timezone import PyCalendarTimezone
+from pycalendar.datetime import DateTime
+from pycalendar.timezone import Timezone
 
 from twext.enterprise.dal.syntax import Select, Parameter, Insert, Delete, \
     Update
@@ -78,7 +78,7 @@
         self._sqlCalendarStore = yield buildCalendarStore(self, self.notifierFactory)
         yield self.populate()
 
-        self.nowYear = {"now": PyCalendarDateTime.getToday().getYear()}
+        self.nowYear = {"now": DateTime.getToday().getYear()}
 
 
     @inlineCallbacks
@@ -1377,38 +1377,38 @@
         self.assertEqual(rmax.getYear(), nowYear + 1)
 
         # Fully within range
-        testMin = PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-        testMax = PyCalendarDateTime(nowYear + 1, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+        testMin = DateTime(nowYear, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+        testMax = DateTime(nowYear + 1, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         result = yield index.notExpandedWithin(testMin, testMax)
         self.assertEqual(result, [])
 
         # Upper bound exceeded
-        testMin = PyCalendarDateTime(nowYear, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-        testMax = PyCalendarDateTime(nowYear + 5, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+        testMin = DateTime(nowYear, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+        testMax = DateTime(nowYear + 5, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         result = yield index.notExpandedWithin(testMin, testMax)
         self.assertEqual(result, ["indexing.ics"])
 
         # Lower bound exceeded
-        testMin = PyCalendarDateTime(nowYear - 5, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-        testMax = PyCalendarDateTime(nowYear + 1, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+        testMin = DateTime(nowYear - 5, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+        testMax = DateTime(nowYear + 1, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         result = yield index.notExpandedWithin(testMin, testMax)
         self.assertEqual(result, ["indexing.ics"])
 
         # Lower and upper bounds exceeded
-        testMin = PyCalendarDateTime(nowYear - 5, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
-        testMax = PyCalendarDateTime(nowYear + 5, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+        testMin = DateTime(nowYear - 5, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
+        testMax = DateTime(nowYear + 5, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         result = yield index.notExpandedWithin(testMin, testMax)
         self.assertEqual(result, ["indexing.ics"])
 
         # Lower none within range
         testMin = None
-        testMax = PyCalendarDateTime(nowYear + 1, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+        testMax = DateTime(nowYear + 1, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         result = yield index.notExpandedWithin(testMin, testMax)
         self.assertEqual(result, [])
 
         # Lower none and upper bounds exceeded
         testMin = None
-        testMax = PyCalendarDateTime(nowYear + 5, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
+        testMax = DateTime(nowYear + 5, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
         result = yield index.notExpandedWithin(testMin, testMax)
         self.assertEqual(result, ["indexing.ics"])
 
@@ -2154,7 +2154,7 @@
 
         self.subs = {}
 
-        self.now = PyCalendarDateTime.getNowUTC()
+        self.now = DateTime.getNowUTC()
         self.now.setHHMMSS(0, 0, 0)
 
         self.subs["now"] = self.now

Modified: CalendarServer/branches/users/cdaboo/json/txdav/caldav/icalendarstore.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/caldav/icalendarstore.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/caldav/icalendarstore.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -363,9 +363,9 @@
         instances that occur within the time range that begins at
         C{start} and ends at C{end}.
 
-        @param start: a L{PyCalendarDateTime}.
-        @param end: a L{PyCalendarDateTime}.
-        @param timeZone: a L{PyCalendarTimezone}.
+        @param start: a L{DateTime}.
+        @param end: a L{DateTime}.
+        @param timeZone: a L{Timezone}.
         @return: an iterable of L{ICalendarObject}s.
         """
 

Modified: CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -27,7 +27,7 @@
 
 from cStringIO import StringIO
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from twext.enterprise.dal.syntax import \
     Delete, utcNowSQL, Union, Insert, Len, Max, Parameter, SavepointAction, \
@@ -1077,7 +1077,7 @@
     def eventsOlderThan(self, cutoff, batchSize=None):
         """
         Return up to the oldest batchSize events which exist completely earlier
-        than "cutoff" (PyCalendarDateTime)
+        than "cutoff" (DateTime)
 
         Returns a deferred to a list of (uid, calendarName, eventName, maxDate)
         tuples.
@@ -1085,7 +1085,7 @@
 
         # Make sure cut off is after any lower limit truncation in the DB
         if config.FreeBusyIndexLowerLimitDays:
-            truncateLowerLimit = PyCalendarDateTime.getToday()
+            truncateLowerLimit = DateTime.getToday()
             truncateLowerLimit.offsetDay(-config.FreeBusyIndexLowerLimitDays)
             if cutoff < truncateLowerLimit:
                 raise ValueError("Cannot query events older than %s" % (truncateLowerLimit.getText(),))
@@ -1103,7 +1103,7 @@
 
         # Make sure cut off is after any lower limit truncation in the DB
         if config.FreeBusyIndexLowerLimitDays:
-            truncateLowerLimit = PyCalendarDateTime.getToday()
+            truncateLowerLimit = DateTime.getToday()
             truncateLowerLimit.offsetDay(-config.FreeBusyIndexLowerLimitDays)
             if cutoff < truncateLowerLimit:
                 raise ValueError("Cannot query events older than %s" % (truncateLowerLimit.getText(),))

Modified: CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql_legacy.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql_legacy.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/sql_legacy.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -43,8 +43,8 @@
 from twext.python.clsprop import classproperty
 from twext.python.log import Logger
 
-from pycalendar.datetime import PyCalendarDateTime
-from pycalendar.duration import PyCalendarDuration
+from pycalendar.datetime import DateTime
+from pycalendar.duration import Duration
 
 log = Logger()
 
@@ -566,7 +566,7 @@
             )
             if qualifiers is not None:
 
-                today = PyCalendarDateTime.getToday()
+                today = DateTime.getToday()
 
                 # Determine how far we need to extend the current expansion of
                 # events. If we have an open-ended time-range we will expand
@@ -578,11 +578,11 @@
                     maxDate = maxDate.duplicate()
                     maxDate.offsetDay(1)
                     maxDate.setDateOnly(True)
-                    upperLimit = today + PyCalendarDuration(days=config.FreeBusyIndexExpandMaxDays)
+                    upperLimit = today + Duration(days=config.FreeBusyIndexExpandMaxDays)
                     if maxDate > upperLimit:
                         raise TimeRangeUpperLimit(upperLimit)
                     if isStartDate:
-                        maxDate += PyCalendarDuration(days=365)
+                        maxDate += Duration(days=365)
 
                 # Determine if the start date is too early for the restricted range we
                 # are applying. If it is today or later we don't need to worry about truncation
@@ -591,7 +591,7 @@
                 if minDate >= today:
                     minDate = None
                 if minDate is not None and config.FreeBusyIndexLowerLimitDays:
-                    truncateLowerLimit = today - PyCalendarDuration(days=config.FreeBusyIndexLowerLimitDays)
+                    truncateLowerLimit = today - Duration(days=config.FreeBusyIndexLowerLimitDays)
                     if minDate < truncateLowerLimit:
                         raise TimeRangeLowerLimit(truncateLowerLimit)
 

Modified: CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/test/util.py
===================================================================
--- CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/test/util.py	2013-08-21 15:35:00 UTC (rev 11624)
+++ CalendarServer/branches/users/cdaboo/json/txdav/common/datastore/test/util.py	2013-08-21 15:40:05 UTC (rev 11625)
@@ -32,7 +32,7 @@
 
 from hashlib import md5
 
-from pycalendar.datetime import PyCalendarDateTime
+from pycalendar.datetime import DateTime
 
 from random import Random
 
@@ -480,7 +480,7 @@
     Update the supplied iCalendar data so that all dates are updated to the current year.
     """
 
-    nowYear = PyCalendarDateTime.getToday().getYear()
+    nowYear = DateTime.getToday().getYear()
     return data % {"now": nowYear}
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130821/59ed3418/attachment-0001.html>


More information about the calendarserver-changes mailing list