[CalendarServer-changes] [11505] CalendarServer/trunk/txdav/xml/base.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 12 11:38:19 PDT 2013


Revision: 11505
          http://trac.calendarserver.org//changeset/11505
Author:   wsanchez at apple.com
Date:     2013-07-12 11:38:19 -0700 (Fri, 12 Jul 2013)
Log Message:
-----------
DateTimeHeaderElement should inherrit from WebDAVDateTimeElement.
Clean up __eq__ methods.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/xml/base.py

Modified: CalendarServer/trunk/txdav/xml/base.py
===================================================================
--- CalendarServer/trunk/txdav/xml/base.py	2013-07-11 02:45:10 UTC (rev 11504)
+++ CalendarServer/trunk/txdav/xml/base.py	2013-07-12 18:38:19 UTC (rev 11505)
@@ -616,7 +616,7 @@
             return "<%s>" % (self.sname(),)
 
     def __eq__(self, other):
-        if isinstance(other, WebDAVTextElement):
+        if isinstance(other, self.__class__):
             return str(self) == str(other)
         elif type(other) in (str, unicode):
             return str(self) == other
@@ -659,7 +659,7 @@
         self.datetime() # Raise ValueError if the format is wrong
 
     def __eq__(self, other):
-        if isinstance(other, WebDAVDateTimeElement):
+        if isinstance(other, self.__class__):
             return self.datetime() == other.datetime()
         else:
             return NotImplemented
@@ -672,7 +672,7 @@
             return parse_date(s)
 
 
-class DateTimeHeaderElement (WebDAVTextElement):
+class DateTimeHeaderElement (WebDAVDateTimeElement):
     """
     WebDAV date-time element for elements that substitute for HTTP
     headers. (RFC 2068, section 3.3.1)
@@ -707,16 +707,6 @@
 
         return clazz(PCDATAElement(date))
 
-    def __init__(self, *children, **attributes):
-        super(DateTimeHeaderElement, self).__init__(*children, **attributes)
-        self.datetime() # Raise ValueError if the format is wrong
-
-    def __eq__(self, other):
-        if isinstance(other, WebDAVDateTimeElement):
-            return self.datetime() == other.datetime()
-        else:
-            return NotImplemented
-
     def datetime(self):
         s = str(self)
         if not s:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130712/f57f22dd/attachment.html>


More information about the calendarserver-changes mailing list