[CalendarServer-changes] [11228] CalDAVTester/trunk/src/serverinfo.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue May 21 10:43:34 PDT 2013
Revision: 11228
http://trac.calendarserver.org//changeset/11228
Author: cdaboo at apple.com
Date: 2013-05-21 10:43:34 -0700 (Tue, 21 May 2013)
Log Message:
-----------
Grabbed values can now be "processed" using function-like syntax. Currently we have basename() which returns
just the last path segment of a URI - useful when a relative URI might be needed.
Modified Paths:
--------------
CalDAVTester/trunk/src/serverinfo.py
Modified: CalDAVTester/trunk/src/serverinfo.py
===================================================================
--- CalDAVTester/trunk/src/serverinfo.py 2013-05-21 17:42:13 UTC (rev 11227)
+++ CalDAVTester/trunk/src/serverinfo.py 2013-05-21 17:43:34 UTC (rev 11228)
@@ -104,9 +104,21 @@
def addextrasubs(self, items):
- self.addsubs(items, self.extrasubsdict)
+ processed = {}
+ # Various "functions" might be applied to a variable name to cause the value to
+ # be changed in various ways
+ for variable, value in items.items():
+ # basename() - extract just the URL last path segment from the value
+ if variable.startswith("basename("):
+ variable = variable[len("basename("):-1]
+ value = value.rstrip("/").split("/")[-1]
+ processed[variable] = value
+
+ self.addsubs(processed, self.extrasubsdict)
+
+
def parseXML(self, node):
for child in node.getchildren():
if child.tag == src.xmlDefs.ELEMENT_HOST:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130521/f2d4a9df/attachment.html>
More information about the calendarserver-changes
mailing list