[CalendarServer-changes] [6178] CalendarServer/trunk/contrib/performance

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 25 12:12:48 PDT 2010


Revision: 6178
          http://trac.macosforge.org/projects/calendarserver/changeset/6178
Author:   exarkun at twistedmatrix.com
Date:     2010-08-25 12:12:46 -0700 (Wed, 25 Aug 2010)
Log Message:
-----------
plist rewriter for switching between backends

Added Paths:
-----------
    CalendarServer/trunk/contrib/performance/setbackend
    CalendarServer/trunk/contrib/performance/setbackend.py

Added: CalendarServer/trunk/contrib/performance/setbackend
===================================================================
--- CalendarServer/trunk/contrib/performance/setbackend	                        (rev 0)
+++ CalendarServer/trunk/contrib/performance/setbackend	2010-08-25 19:12:46 UTC (rev 6178)
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+
+from setbackend import main
+raise SystemExit(main())


Property changes on: CalendarServer/trunk/contrib/performance/setbackend
___________________________________________________________________
Added: svn:executable
   + *

Added: CalendarServer/trunk/contrib/performance/setbackend.py
===================================================================
--- CalendarServer/trunk/contrib/performance/setbackend.py	                        (rev 0)
+++ CalendarServer/trunk/contrib/performance/setbackend.py	2010-08-25 19:12:46 UTC (rev 6178)
@@ -0,0 +1,23 @@
+import sys
+from xml.etree import ElementTree
+from xml.etree import ElementPath
+
+def main():
+    conf = ElementTree.parse(file(sys.argv[1]))
+    if sys.argv[2] == 'database':
+        value = 'true'
+    else:
+        value = 'false'
+    replace(conf.getiterator(), value)
+    conf.write(sys.stdout)
+
+
+def replace(elements, value):
+    found = False
+    for ele in elements:
+        if found:
+            ele.tag = value
+            return
+        if ele.tag == 'key' and ele.text == 'UseDatabase':
+            found = True
+    raise RuntimeError("Failed to find <key>UseDatabase</key>")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100825/37c9779c/attachment.html>


More information about the calendarserver-changes mailing list