<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[15034] CalendarServer/trunk/calendarserver/tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/15034">15034</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2015-08-06 14:04:52 -0700 (Thu, 06 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>calendarserver_config now has --logging and --accounting options</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcalendarservertoolsconfigpy">CalendarServer/trunk/calendarserver/tools/config.py</a></li>
<li><a href="#CalendarServertrunkcalendarservertoolstesttest_configpy">CalendarServer/trunk/calendarserver/tools/test/test_config.py</a></li>
<li><a href="#CalendarServertrunkcalendarservertoolstesttest_gatewaypy">CalendarServer/trunk/calendarserver/tools/test/test_gateway.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcalendarservertoolsconfigpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/calendarserver/tools/config.py (15033 => 15034)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/calendarserver/tools/config.py        2015-08-05 22:37:53 UTC (rev 15033)
+++ CalendarServer/trunk/calendarserver/tools/config.py        2015-08-06 21:04:52 UTC (rev 15034)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> WRITABLE_CONFIG_KEYS = [
</span><ins>+    &quot;AccountingCategories&quot;,
</ins><span class="cx">     &quot;Authentication.Basic.AllowedOverWireUnencrypted&quot;,
</span><span class="cx">     &quot;Authentication.Basic.Enabled&quot;,
</span><span class="cx">     &quot;Authentication.Digest.AllowedOverWireUnencrypted&quot;,
</span><span class="lines">@@ -83,8 +84,21 @@
</span><span class="cx">     &quot;ServerRoot&quot;,
</span><span class="cx"> ]
</span><span class="cx"> 
</span><ins>+ACCOUNTING_CATEGORIES = {
+    &quot;http&quot;: (&quot;HTTP&quot;,),
+    &quot;itip&quot;: (&quot;iTIP&quot;, &quot;iTIP-VFREEBUSY&quot;,),
+    &quot;implicit&quot;: (&quot;Implicit Errors&quot;,),
+    &quot;autoscheduling&quot;: (&quot;AutoScheduling&quot;,),
+    &quot;ischedule&quot;: (&quot;iSchedule&quot;,),
+    &quot;migration&quot;: (&quot;migration&quot;,),
+}
</ins><span class="cx"> 
</span><ins>+LOGGING_CATEGORIES = {
+    &quot;directory&quot;: (&quot;twext^who&quot;, &quot;txdav^who&quot;,),
+    &quot;imip&quot;: (&quot;txdav^caldav^datastore^scheduling^imip&quot;,),
+}
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def usage(e=None):
</span><span class="cx">     if e:
</span><span class="cx">         print(e)
</span><span class="lines">@@ -95,8 +109,10 @@
</span><span class="cx">     print(&quot;&quot;)
</span><span class="cx">     print(&quot;Print the value of the given config key.&quot;)
</span><span class="cx">     print(&quot;options:&quot;)
</span><ins>+    print(&quot;  -a --accounting: Specify accounting categories (combinations of http, itip, implicit, autoscheduling, ischedule, migration, or off)&quot;)
</ins><span class="cx">     print(&quot;  -h --help: print this help and exit&quot;)
</span><span class="cx">     print(&quot;  -f --config: Specify caldavd.plist configuration path&quot;)
</span><ins>+    print(&quot;  -l --logging: Specify logging categories (combinations of directory, imip, or default)&quot;)
</ins><span class="cx">     print(&quot;  -r --restart: Restart the calendar service&quot;)
</span><span class="cx">     print(&quot;  --start: Start the calendar service and agent&quot;)
</span><span class="cx">     print(&quot;  --stop: Stop the calendar service and agent&quot;)
</span><span class="lines">@@ -125,13 +141,15 @@
</span><span class="cx"> 
</span><span class="cx">     try:
</span><span class="cx">         (optargs, args) = getopt(
</span><del>-            sys.argv[1:], &quot;hf:rw:&quot;, [
</del><ins>+            sys.argv[1:], &quot;hf:rw:a:l:&quot;, [
</ins><span class="cx">                 &quot;help&quot;,
</span><span class="cx">                 &quot;config=&quot;,
</span><span class="cx">                 &quot;writeconfig=&quot;,
</span><span class="cx">                 &quot;restart&quot;,
</span><span class="cx">                 &quot;start&quot;,
</span><span class="cx">                 &quot;stop&quot;,
</span><ins>+                &quot;accounting=&quot;,
+                &quot;logging=&quot;,
</ins><span class="cx">             ],
</span><span class="cx">         )
</span><span class="cx">     except GetoptError, e:
</span><span class="lines">@@ -139,6 +157,8 @@
</span><span class="cx"> 
</span><span class="cx">     configFileName = DEFAULT_CONFIG_FILE
</span><span class="cx">     writeConfigFileName = &quot;&quot;
</span><ins>+    accountingCategories = None
+    loggingCategories = None
</ins><span class="cx">     doStop = False
</span><span class="cx">     doStart = False
</span><span class="cx">     doRestart = False
</span><span class="lines">@@ -153,6 +173,12 @@
</span><span class="cx">         elif opt in (&quot;-w&quot;, &quot;--writeconfig&quot;):
</span><span class="cx">             writeConfigFileName = arg
</span><span class="cx"> 
</span><ins>+        elif opt in (&quot;-a&quot;, &quot;--accounting&quot;):
+            accountingCategories = arg.split(&quot;,&quot;)
+
+        elif opt in (&quot;-l&quot;, &quot;--logging&quot;):
+            loggingCategories = arg.split(&quot;,&quot;)
+
</ins><span class="cx">         if opt == &quot;--stop&quot;:
</span><span class="cx">             doStop = True
</span><span class="cx"> 
</span><span class="lines">@@ -198,6 +224,24 @@
</span><span class="cx">     writable = WritableConfig(config, writeConfigFileName)
</span><span class="cx">     writable.read()
</span><span class="cx"> 
</span><ins>+    # Convert logging categories to actual config key changes
+    if loggingCategories is not None:
+        args = [&quot;LogLevels=&quot;]
+        if loggingCategories != [&quot;default&quot;]:
+            for cat in loggingCategories:
+                if cat in LOGGING_CATEGORIES:
+                    for moduleName in LOGGING_CATEGORIES[cat]:
+                        args.append(&quot;LogLevels.{}=debug&quot;.format(moduleName))
+
+    # Convert accounting categories to actual config key changes
+    if accountingCategories is not None:
+        args = [&quot;AccountingCategories=&quot;]
+        if accountingCategories != [&quot;off&quot;]:
+            for cat in accountingCategories:
+                if cat in ACCOUNTING_CATEGORIES:
+                    for key in ACCOUNTING_CATEGORIES[cat]:
+                        args.append(&quot;AccountingCategories.{}=True&quot;.format(key))
+
</ins><span class="cx">     processArgs(writable, args)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -265,8 +309,12 @@
</span><span class="cx">             if &quot;=&quot; in configKey:
</span><span class="cx">                 # This is an assignment
</span><span class="cx">                 configKey, stringValue = configKey.split(&quot;=&quot;)
</span><del>-                value = writable.convertToValue(stringValue)
-                writable.set({configKey: value})
</del><ins>+                if stringValue:
+                    value = writable.convertToValue(stringValue)
+                    valueDict = setKeyPath({}, configKey, value)
+                    writable.set(valueDict)
+                else:
+                    writable.delete(configKey)
</ins><span class="cx">             else:
</span><span class="cx">                 # This is a read
</span><span class="cx">                 c = config
</span><span class="lines">@@ -416,7 +464,14 @@
</span><span class="cx">     @return: parent
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     original = parent
</span><del>-    parts = keyPath.split(&quot;.&quot;)
</del><ins>+
+    # Embedded ^ should be replaced by .
+    # That way, we can still use . as key path separator even though sometimes
+    # a key part wants to have a . in it (such as a LogLevels module).
+    # For example:  LogLevels.twext^who, will get converted to a &quot;LogLevels&quot;
+    # dict containing a the key &quot;twext.who&quot;
+    parts = [p.replace(&quot;^&quot;, &quot;.&quot;) for p in keyPath.split(&quot;.&quot;)]
+
</ins><span class="cx">     for part in parts[:-1]:
</span><span class="cx">         child = parent.get(part, None)
</span><span class="cx">         if child is None:
</span><span class="lines">@@ -531,6 +586,20 @@
</span><span class="cx">         self.dirty = True
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def delete(self, key):
+        &quot;&quot;&quot;
+        Deletes the specified key
+
+        @param key: the key to delete
+        @type key: C{str}
+        &quot;&quot;&quot;
+        try:
+            del self.currentConfigSubset[key]
+            self.dirty = True
+        except:
+            pass
+
+
</ins><span class="cx">     def read(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Reads in the data contained in the writable plist file.
</span><span class="lines">@@ -568,7 +637,7 @@
</span><span class="cx">     def convertToValue(cls, string):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Inspect string and convert the value into an appropriate Python data type
</span><del>-        TODO: change this to look at actual types definied within stdconfig
</del><ins>+        TODO: change this to look at actual types defined within stdconfig
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         if &quot;.&quot; in string:
</span><span class="cx">             try:
</span></span></pre></div>
<a id="CalendarServertrunkcalendarservertoolstesttest_configpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/calendarserver/tools/test/test_config.py (15033 => 15034)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/calendarserver/tools/test/test_config.py        2015-08-05 22:37:53 UTC (rev 15033)
+++ CalendarServer/trunk/calendarserver/tools/test/test_config.py        2015-08-06 21:04:52 UTC (rev 15034)
</span><span class="lines">@@ -171,6 +171,247 @@
</span><span class="cx">         self.assertEquals(results[&quot;error&quot;], &quot;Unknown command 'bogus'&quot;)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
+    def test_commandLineArgs(self):
+        &quot;&quot;&quot;
+        Verify commandline assignments works
+        &quot;&quot;&quot;
+
+        # Check current values
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(results[&quot;result&quot;][&quot;DefaultLogLevel&quot;], &quot;warn&quot;)
+        self.assertEquals(results[&quot;result&quot;][&quot;Scheduling&quot;][&quot;iMIP&quot;][&quot;Enabled&quot;], False)
+
+        # Set a single-level key and a multi-level key
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;DefaultLogLevel=debug&quot;, &quot;Scheduling.iMIP.Enabled=True&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(results[&quot;result&quot;][&quot;DefaultLogLevel&quot;], &quot;debug&quot;)
+        self.assertEquals(results[&quot;result&quot;][&quot;Scheduling&quot;][&quot;iMIP&quot;][&quot;Enabled&quot;], True)
+        self.assertEquals(results[&quot;result&quot;][&quot;LogLevels&quot;], {})
+
+        # Directly set some LogLevels sub-keys
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;LogLevels.testing=debug&quot;, &quot;LogLevels.testing2=warn&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;LogLevels&quot;],
+            {&quot;testing&quot;: &quot;debug&quot;, &quot;testing2&quot; : &quot;warn&quot;}
+        )
+
+        # Test that setting additional sub-keys retains previous sub-keys
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;LogLevels.testing3=info&quot;, &quot;LogLevels.testing4=warn&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;LogLevels&quot;],
+            {&quot;testing&quot;: &quot;debug&quot;, &quot;testing2&quot; : &quot;warn&quot;, &quot;testing3&quot;: &quot;info&quot;, &quot;testing4&quot; : &quot;warn&quot;}
+        )
+
+        # Test that an empty value deletes the key
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;LogLevels=&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;LogLevels&quot;], # now an empty dict
+            {}
+        )
+
+
+    @inlineCallbacks
+    def test_loggingCategories(self):
+        &quot;&quot;&quot;
+        Verify logging categories get mapped to the correct python module names
+        &quot;&quot;&quot;
+
+
+        # Check existing values
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(results[&quot;result&quot;][&quot;LogLevels&quot;], {})
+
+        # Set to directory and imip
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;--logging=directory,imip&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;LogLevels&quot;],
+            {
+                &quot;twext.who&quot;: &quot;debug&quot;,
+                &quot;txdav.who&quot;: &quot;debug&quot;,
+                &quot;txdav.caldav.datastore.scheduling.imip&quot;: &quot;debug&quot;,
+            }
+        )
+
+        # Set up to imip, and the directory modules should go away
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;--logging=imip&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;LogLevels&quot;],
+            {
+                &quot;txdav.caldav.datastore.scheduling.imip&quot;: &quot;debug&quot;,
+            }
+        )
+
+        # Set to default, and all modules should go away
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;--logging=default&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;LogLevels&quot;], {}
+        )
+
+
+    @inlineCallbacks
+    def test_accountingCategories(self):
+        &quot;&quot;&quot;
+        Verify accounting categories get mapped to the correct keys
+        &quot;&quot;&quot;
+        # Check existing values
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;AccountingCategories&quot;],
+            {
+                'AutoScheduling': False,
+                'HTTP': False,
+                'Implicit Errors': False,
+                'iSchedule': False,
+                'iTIP': False,
+                'iTIP-VFREEBUSY': False,
+                'migration': False,
+            }
+        )
+
+        # Set to http and itip
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;--accounting=http,itip&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;AccountingCategories&quot;],
+            {
+                'AutoScheduling': False,
+                'HTTP': True,
+                'Implicit Errors': False,
+                'iSchedule': False,
+                'iTIP': True,
+                'iTIP-VFREEBUSY': True,
+                'migration': False,
+            }
+        )
+
+        # Set to off, so all are off
+
+        results = yield self.runCommand(
+            None,
+            script=&quot;calendarserver_config&quot;,
+            additionalArgs=[&quot;--accounting=off&quot;],
+            parseOutput=False
+        )
+
+        results = yield self.runCommand(
+            command_readConfig,
+            script=&quot;calendarserver_config&quot;)
+
+        self.assertEquals(
+            results[&quot;result&quot;][&quot;AccountingCategories&quot;],
+            {
+                'AutoScheduling': False,
+                'HTTP': False,
+                'Implicit Errors': False,
+                'iSchedule': False,
+                'iTIP': False,
+                'iTIP-VFREEBUSY': False,
+                'migration': False,
+            }
+        )
+
+
+
+
</ins><span class="cx">     def test_keyPath(self):
</span><span class="cx">         d = ConfigDict()
</span><span class="cx">         setKeyPath(d, &quot;one&quot;, &quot;A&quot;)
</span></span></pre></div>
<a id="CalendarServertrunkcalendarservertoolstesttest_gatewaypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/calendarserver/tools/test/test_gateway.py (15033 => 15034)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/calendarserver/tools/test/test_gateway.py        2015-08-05 22:37:53 UTC (rev 15033)
+++ CalendarServer/trunk/calendarserver/tools/test/test_gateway.py        2015-08-06 21:04:52 UTC (rev 15034)
</span><span class="lines">@@ -144,7 +144,8 @@
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def runCommand(
</span><del>-        self, command, error=False, script=&quot;calendarserver_command_gateway&quot;
</del><ins>+        self, command, error=False, script=&quot;calendarserver_command_gateway&quot;,
+        additionalArgs=None, parseOutput=True
</ins><span class="cx">     ):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Run the given command by feeding it as standard input to
</span><span class="lines">@@ -163,18 +164,24 @@
</span><span class="cx">         if error:
</span><span class="cx">             args.append(&quot;--error&quot;)
</span><span class="cx"> 
</span><ins>+        if additionalArgs:
+            args.extend(additionalArgs)
+
</ins><span class="cx">         cwd = sourceRoot
</span><span class="cx"> 
</span><span class="cx">         deferred = Deferred()
</span><span class="cx">         reactor.spawnProcess(CapturingProcessProtocol(deferred, command), cmd, args, env=os.environ, path=cwd)
</span><span class="cx">         output = yield deferred
</span><del>-        try:
-            plist = readPlistFromString(output)
-        except xml.parsers.expat.ExpatError, e:
-            print(&quot;Error (%s) parsing (%s)&quot; % (e, output))
-            raise
</del><ins>+        if parseOutput:
+            try:
+                plist = readPlistFromString(output)
+                returnValue(plist)
+            except xml.parsers.expat.ExpatError, e:
+                print(&quot;Error (%s) parsing (%s)&quot; % (e, output))
+                raise
+        else:
+            returnValue(output)
</ins><span class="cx"> 
</span><del>-        returnValue(plist)
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>