[CalendarServer-changes] [15471] CalendarServer/trunk/calendarserver/tools

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 7 07:13:49 PST 2016


Revision: 15471
          http://trac.calendarserver.org//changeset/15471
Author:   cdaboo at apple.com
Date:     2016-03-07 07:13:49 -0800 (Mon, 07 Mar 2016)
Log Message:
-----------
Logger fix. PyDev warning suppression.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/config.py
    CalendarServer/trunk/calendarserver/tools/delegatesmigration.py
    CalendarServer/trunk/calendarserver/tools/gateway.py
    CalendarServer/trunk/calendarserver/tools/managetimezones.py
    CalendarServer/trunk/calendarserver/tools/test/test_gateway.py

Modified: CalendarServer/trunk/calendarserver/tools/config.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/config.py	2016-03-07 15:12:40 UTC (rev 15470)
+++ CalendarServer/trunk/calendarserver/tools/config.py	2016-03-07 15:13:49 UTC (rev 15471)
@@ -340,7 +340,7 @@
         try:
             plist = readPlistFromString(rawInput)
             # Note: values in plist will already be unicode
-        except xml.parsers.expat.ExpatError, e:
+        except xml.parsers.expat.ExpatError, e: #@UndefinedVariable
             respondWithError(str(e))
             return
 

Modified: CalendarServer/trunk/calendarserver/tools/delegatesmigration.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/delegatesmigration.py	2016-03-07 15:12:40 UTC (rev 15470)
+++ CalendarServer/trunk/calendarserver/tools/delegatesmigration.py	2016-03-07 15:13:49 UTC (rev 15471)
@@ -280,10 +280,10 @@
     print("Migrating from server {}".format(server))
     try:
         calendaruserproxy.ProxyDBService = calendaruserproxy.ProxyPostgreSQLDB(server, database, user, password, dbtype)
-        calendaruserproxy.ProxyDBService.open()
+        calendaruserproxy.ProxyDBService.open() #@UndefinedVariable
         assignments = yield getAssignments(calendaruserproxy.ProxyDBService)
         yield copyAssignments(assignments, pod, store.directoryService(), store)
-        calendaruserproxy.ProxyDBService.close()
+        calendaruserproxy.ProxyDBService.close() #@UndefinedVariable
 
     except IOError:
         log.error("Could not start proxydb service")

Modified: CalendarServer/trunk/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/gateway.py	2016-03-07 15:12:40 UTC (rev 15470)
+++ CalendarServer/trunk/calendarserver/tools/gateway.py	2016-03-07 15:13:49 UTC (rev 15471)
@@ -161,7 +161,7 @@
     rawInput = sys.stdin.read()
     try:
         plist = readPlistFromString(rawInput)
-    except xml.parsers.expat.ExpatError, e:
+    except xml.parsers.expat.ExpatError, e: #@UndefinedVariable
         respondWithError(str(e))
         return
 

Modified: CalendarServer/trunk/calendarserver/tools/managetimezones.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/managetimezones.py	2016-03-07 15:12:40 UTC (rev 15470)
+++ CalendarServer/trunk/calendarserver/tools/managetimezones.py	2016-03-07 15:13:49 UTC (rev 15471)
@@ -16,17 +16,20 @@
 ##
 from __future__ import print_function
 
+from calendarserver.tools.util import loadConfig
+
+from pycalendar.datetime import DateTime
 from pycalendar.icalendar.calendar import Calendar
-from pycalendar.datetime import DateTime
 
+from twext.python.log import Logger
 
-from twext.python.log import StandardIOObserver
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
+from twisted.logger import FileLogObserver, formatEventAsClassicLogText
 from twisted.python.filepath import FilePath
 
-from calendarserver.tools.util import loadConfig
 from twistedcaldav.config import ConfigurationError
+from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
 from twistedcaldav.timezones import TimezoneCache
 from twistedcaldav.timezonestdservice import PrimaryTimezoneDatabase, \
     SecondaryTimezoneDatabase
@@ -39,7 +42,6 @@
 import tarfile
 import tempfile
 import urllib
-from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
 
 
 def _doPrimaryActions(action, tzpath, xmlfile, changed, tzvers):
@@ -222,8 +224,9 @@
     if action == "cache":
         print("Caching from secondary server: %s" % (url,))
 
-        observer = StandardIOObserver()
-        observer.start()
+        observer = FileLogObserver(sys.stdout, lambda event: formatEventAsClassicLogText(event))
+        Logger.beginLoggingTo([observer], redirectStandardIO=False)
+
         reactor.callLater(0, _runInReactor, tzdb)
         reactor.run()
     else:

Modified: CalendarServer/trunk/calendarserver/tools/test/test_gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_gateway.py	2016-03-07 15:12:40 UTC (rev 15470)
+++ CalendarServer/trunk/calendarserver/tools/test/test_gateway.py	2016-03-07 15:13:49 UTC (rev 15471)
@@ -175,7 +175,7 @@
             try:
                 plist = readPlistFromString(output)
                 returnValue(plist)
-            except xml.parsers.expat.ExpatError, e:
+            except xml.parsers.expat.ExpatError, e: #@UndefinedVariable
                 print("Error (%s) parsing (%s)" % (e, output))
                 raise
         else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160307/5db4a4a3/attachment.html>


More information about the calendarserver-changes mailing list