Explorar o código

Use % instead of format for consistency (and Python 2.6 support)

Guillaume Ayoub %!s(int64=14) %!d(string=hai) anos
pai
achega
e9935ae1a6
Modificáronse 2 ficheiros con 5 adicións e 6 borrados
  1. 2 2
      radicale/ical.py
  2. 3 4
      radicale/xmlutils.py

+ 2 - 2
radicale/ical.py

@@ -411,11 +411,11 @@ class Calendar(object):
     def owner_url(self):
         """Get the calendar URL according to its owner."""
         if self.owner:
-            return '/{}/'.format(self.owner).replace('//', '/')
+            return ('/%s/' % self.owner).replace('//', '/')
         else:
             return None
 
     @property
     def url(self):
         """Get the standard calendar URL."""
-        return '/{}/'.format(self.local_path).replace('//', '/')
+        return ('/%s/' % self.local_path).replace('//', '/')

+ 3 - 4
radicale/xmlutils.py

@@ -224,7 +224,7 @@ def _propfind_response(path, item, props, user):
             if item.owner_url:
                 tag.text = item.owner_url
             elif user:
-                tag.text = '/{}/'.format(user)
+                tag.text = '/%s/' % user
             else:
                 tag.text = path
             element.append(tag)
@@ -245,7 +245,7 @@ def _propfind_response(path, item, props, user):
             # pylint: enable=W0511
         elif tag == _tag("D", "current-user-principal") and user:
             tag = ET.Element(_tag("D", "href"))
-            tag.text = '/{}/'.format(user)
+            tag.text = '/%s/' % user
             element.append(tag)
         elif tag == _tag("D", "current-user-privilege-set"):
             privilege = ET.Element(_tag("D", "privilege"))
@@ -283,8 +283,7 @@ def _propfind_response(path, item, props, user):
                     is404 = True
         # Not for calendars
         elif tag == _tag("D", "getcontenttype"):
-            element.text = \
-                "text/calendar; component={}".format(item.tag.lower())
+            element.text = "text/calendar; component=%s" % item.tag.lower()
         else:
             is404 = True