[CalendarServer-changes] [7948] CalendarServer/branches/users/glyph/imip-and-admin-html/ calendarserver/webadmin

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 11 21:49:04 PDT 2011


Revision: 7948
          http://trac.macosforge.org/projects/calendarserver/changeset/7948
Author:   glyph at apple.com
Date:     2011-08-11 21:49:04 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
Test for dav property parsing, and fix for old implementation so it actually does what it was trying to do.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py
    CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py

Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py	2011-08-12 04:48:53 UTC (rev 7947)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py	2011-08-12 04:49:04 UTC (rev 7948)
@@ -486,13 +486,13 @@
                 namespace, name = davPropertyName.split("#")
             except Exception:
                 propertyHtml += "<div>Unable to parse property to read: <b>%s</b></div>" % davPropertyName
+            else:
+                result = (yield resource.readProperty((namespace, name), None))
+                propertyHtml += "<div style=\"margin-top:7px\">Value of property <b>%(name)s</b>:</div><pre style=\"margin-top:5px; padding-top:0\">%(value)s</pre>" % { 
+                    "name": davPropertyName, 
+                    "value": cgi.escape(result.toxml())
+                }
 
-            result = (yield resource.readProperty((namespace, name), None))
-            propertyHtml += "<div style=\"margin-top:7px\">Value of property <b>%(name)s</b>:</div><pre style=\"margin-top:5px; padding-top:0\">%(value)s</pre>" % { 
-                "name": davPropertyName, 
-                "value": cgi.escape(result.toxml())
-            }
-
         ###
         # Auto-schedule
         ###

Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py	2011-08-12 04:48:53 UTC (rev 7947)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py	2011-08-12 04:49:04 UTC (rev 7948)
@@ -197,6 +197,27 @@
                       gatherTextNodes(document))
 
 
+    @inlineCallbacks
+    def test_notADavProperty(self):
+        """
+        When a DAV property is selected without the proper syntax (i.e. no "#"
+        to separate namespace and name), an error will be displayed.
+        """
+        self.resource.getResourceById = partial(FakePrincipalResource, self)
+        document = yield self.renderPage(
+            dict(resourceId=["qux"],
+                 davPropertyName=["blub"])
+        )
+        propertyName = document.getElementById('txt_davPropertyName')
+        self.assertEquals(propertyName.getAttribute("value"),
+                          "blub")
+        propertyValue = "Unable to parse property to read: blub"
+        self.assertIn(cgi.escape(propertyValue),
+                      gatherTextNodes(document))
+
+
+    # Properties for being a fake directory service as far as the implementation
+    # of DirectoryRecord is concerned.
     realmName = 'Fake'
     guid = '28c57671-2bf8-4ebd-bc45-fda5ffcee1e8'
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110811/b65e5162/attachment.html>


More information about the calendarserver-changes mailing list