[CalendarServer-changes] [10697] CalendarServer/trunk/calendarserver/tools
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 12 10:19:18 PST 2013
Revision: 10697
http://trac.calendarserver.org//changeset/10697
Author: cdaboo at apple.com
Date: 2013-02-12 10:19:18 -0800 (Tue, 12 Feb 2013)
Log Message:
-----------
Add --debug option to all command line tools using utilityMain to ensure python logs go to stdout/stderr.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/ampnotifications.py
CalendarServer/trunk/calendarserver/tools/calverify.py
CalendarServer/trunk/calendarserver/tools/cmdline.py
CalendarServer/trunk/calendarserver/tools/dbinspect.py
CalendarServer/trunk/calendarserver/tools/export.py
CalendarServer/trunk/calendarserver/tools/gateway.py
CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py
CalendarServer/trunk/calendarserver/tools/managetimezones.py
CalendarServer/trunk/calendarserver/tools/migrate_verify.py
CalendarServer/trunk/calendarserver/tools/obliterate.py
CalendarServer/trunk/calendarserver/tools/purge.py
CalendarServer/trunk/calendarserver/tools/push.py
CalendarServer/trunk/calendarserver/tools/test/test_export.py
CalendarServer/trunk/calendarserver/tools/upgrade.py
CalendarServer/trunk/calendarserver/tools/validcalendardata.py
Modified: CalendarServer/trunk/calendarserver/tools/ampnotifications.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/ampnotifications.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/ampnotifications.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -15,19 +15,20 @@
# limitations under the License.
##
+from calendarserver.push.amppush import subscribeToIDs
from calendarserver.tools.cmdline import utilityMain
+
from getopt import getopt, GetoptError
+
from twext.python.log import Logger
+
from twisted.application.service import Service
from twisted.internet.defer import inlineCallbacks, succeed
from twistedcaldav.config import ConfigurationError
+
import os
import sys
-from twisted.internet.defer import inlineCallbacks, succeed
-
-from calendarserver.push.amppush import subscribeToIDs
-
log = Logger()
def usage(e=None):
@@ -42,6 +43,7 @@
print " -f --config <path>: Specify caldavd.plist configuration path"
print " -p --port <port>: AMP port to connect to"
print " -s --server <hostname>: AMP server to connect to"
+ print " --debug: verbose logging"
print ""
if e:
@@ -51,11 +53,13 @@
sys.exit(0)
+
class WorkerService(Service):
def __init__(self, store):
self._store = store
+
@inlineCallbacks
def startService(self):
try:
@@ -67,6 +71,7 @@
raise
+
class MonitorAMPNotifications(WorkerService):
ids = []
@@ -77,12 +82,14 @@
return monitorAMPNotifications(self.hostname, self.port, self.ids)
+
def main():
try:
(optargs, args) = getopt(
- sys.argv[1:], "f:hp:s:", [
+ sys.argv[1:], "f:hp:s:v", [
"config=",
+ "debug",
"help",
"port=",
"server=",
@@ -97,6 +104,7 @@
configFileName = None
hostname = "localhost"
port = 62311
+ debug = False
for opt, arg in optargs:
if opt in ("-h", "--help"):
@@ -111,13 +119,15 @@
elif opt in ("-s", "--server"):
hostname = arg
+ elif opt in ("--debug"):
+ debug = True
+
else:
raise NotImplementedError(opt)
if not args:
usage("Not enough arguments")
-
MonitorAMPNotifications.ids = args
MonitorAMPNotifications.hostname = hostname
MonitorAMPNotifications.port = port
@@ -125,12 +135,17 @@
utilityMain(
configFileName,
MonitorAMPNotifications,
+ verbose=debug
)
+
+
def notificationCallback(id, dataChangedTimestamp):
print "Received notification for:", id
return succeed(True)
+
+
@inlineCallbacks
def monitorAMPNotifications(hostname, port, ids):
print "Subscribing to notifications..."
Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -272,6 +272,7 @@
optFlags = [
['ical', 'i', "Calendar data check."],
['badcua', 'b', "Calendar data check for bad CALENDARSERVER-OLD-CUA only."],
+ ['debug', 'D', "Debug logging."],
['nobase64', 'n', "Do not apply CALENDARSERVER-OLD-CUA base64 transform when fixing."],
['mismatch', 's', "Detect organizer/attendee mismatches."],
['missing', 'm', "Show 'orphaned' homes."],
@@ -1927,7 +1928,7 @@
config.TransactionTimeoutSeconds = 0
return CalVerifyService(store, options, output, reactor, config)
- utilityMain(options['config'], makeService, reactor)
+ utilityMain(options['config'], makeService, reactor, verbose=options['debug'])
if __name__ == '__main__':
main()
Modified: CalendarServer/trunk/calendarserver/tools/cmdline.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/cmdline.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/cmdline.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -18,15 +18,19 @@
Shared main-point between utilities.
"""
-import os, sys
-
from calendarserver.tap.caldav import CalDAVServiceMaker, CalDAVOptions
from calendarserver.tools.util import loadConfig, autoDisableMemcached
+
+from twext.python.log import StandardIOObserver
+
from twistedcaldav.config import ConfigurationError
-# TODO: direct unit tests for this function.
+import os
+import sys
-def utilityMain(configFileName, serviceClass, reactor=None, serviceMaker=CalDAVServiceMaker):
+# TODO: direct unit tests for these functions.
+
+def utilityMain(configFileName, serviceClass, reactor=None, serviceMaker=CalDAVServiceMaker, verbose=False):
"""
Shared main-point for utilities.
@@ -52,6 +56,12 @@
L{IReactorTCP} (etc) provider to use. If C{None}, the default reactor
will be imported and used.
"""
+
+ # Install std i/o observer
+ if verbose:
+ observer = StandardIOObserver()
+ observer.start()
+
if reactor is None:
from twisted.internet import reactor
try:
Modified: CalendarServer/trunk/calendarserver/tools/dbinspect.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dbinspect.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/dbinspect.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -79,6 +79,7 @@
optFlags = [
['verbose', 'v', "Verbose logging."],
+ ['debug', 'D', "Debug logging."],
['purging', 'p', "Enable Purge command."],
]
@@ -90,10 +91,14 @@
super(DBInspectOptions, self).__init__()
self.outputName = '-'
+
+
def UserNameFromUID(txn, uid):
record = txn._directory.recordWithGUID(uid)
return record.shortNames[0] if record else "(%s)" % (uid,)
+
+
def UIDFromInput(txn, value):
try:
return str(UUID(value)).upper()
@@ -109,6 +114,8 @@
record = txn._directory.recordWithShortName(recordType_groups, value)
return record.guid if record else None
+
+
class Cmd(object):
_name = None
@@ -117,10 +124,12 @@
def name(cls):
return cls._name
+
def doIt(self, txn):
raise NotImplementedError
+
class TableSizes(Cmd):
_name = "Show Size of each Table"
@@ -147,6 +156,7 @@
print "Database Tables (total=%d):\n" % (len(results),)
table.printTable()
+
@inlineCallbacks
def getTableSize(self, txn, dbtable):
rows = (yield Select(
@@ -156,6 +166,7 @@
returnValue(rows[0][0])
+
class CalendarHomes(Cmd):
_name = "List Calendar Homes"
@@ -182,6 +193,7 @@
print "Calendar Homes (total=%d, missing=%d):\n" % (len(uids), missing,)
table.printTable()
+
@inlineCallbacks
def getAllHomeUIDs(self, txn):
ch = schema.CALENDAR_HOME
@@ -192,6 +204,7 @@
returnValue(tuple([row[0] for row in rows]))
+
class CalendarHomesSummary(Cmd):
_name = "List Calendar Homes with summary information"
@@ -202,7 +215,7 @@
uids = yield self.getCalendars(txn)
results = {}
- for uid, calname, count in sorted(uids, key=lambda x:x[0]):
+ for uid, calname, count in sorted(uids, key=lambda x: x[0]):
totalname, totalcount = results.get(uid, (0, 0,))
if calname != "inbox":
totalname += 1
@@ -236,6 +249,7 @@
print "Calendars with resource count (total=%d):\n" % (len(results),)
table.printTable()
+
@inlineCallbacks
def getCalendars(self, txn):
ch = schema.CALENDAR_HOME
@@ -256,6 +270,7 @@
returnValue(tuple(rows))
+
class Calendars(Cmd):
_name = "List Calendars"
@@ -268,7 +283,7 @@
# Print table of results
table = tables.Table()
table.addHeader(("Owner UID", "Short Name", "Calendar", "Resources"))
- for uid, calname, count in sorted(uids, key=lambda x:(x[0], x[1])):
+ for uid, calname, count in sorted(uids, key=lambda x: (x[0], x[1])):
shortname = UserNameFromUID(txn, uid)
table.addRow((
uid,
@@ -281,6 +296,7 @@
print "Calendars with resource count (total=%d):\n" % (len(uids),)
table.printTable()
+
@inlineCallbacks
def getCalendars(self, txn):
ch = schema.CALENDAR_HOME
@@ -301,6 +317,7 @@
returnValue(tuple(rows))
+
class CalendarsByOwner(Cmd):
_name = "List Calendars for Owner UID/Short Name"
@@ -316,7 +333,7 @@
table = tables.Table()
table.addHeader(("Owner UID", "Short Name", "Calendars", "ID", "Resources"))
totals = [0, 0, ]
- for uid, calname, resid, count in sorted(uids, key=lambda x:x[1]):
+ for uid, calname, resid, count in sorted(uids, key=lambda x: x[1]):
shortname = UserNameFromUID(txn, uid)
table.addRow((
uid if totals[0] == 0 else "",
@@ -333,6 +350,7 @@
print "Calendars with resource count (total=%d):\n" % (len(uids),)
table.printTable()
+
@inlineCallbacks
def getCalendars(self, txn, uid):
ch = schema.CALENDAR_HOME
@@ -351,10 +369,11 @@
co, type="left", on=(cb.CALENDAR_RESOURCE_ID == co.CALENDAR_RESOURCE_ID)),
Where=(ch.OWNER_UID == Parameter("UID")),
GroupBy=(ch.OWNER_UID, cb.CALENDAR_RESOURCE_NAME, co.CALENDAR_RESOURCE_ID)
- ).on(txn, **{"UID":uid}))
+ ).on(txn, **{"UID": uid}))
returnValue(tuple(rows))
+
class Events(Cmd):
_name = "List Events"
@@ -367,7 +386,7 @@
# Print table of results
table = tables.Table()
table.addHeader(("Owner UID", "Short Name", "Calendar", "ID", "Type", "UID"))
- for uid, calname, id, caltype, caluid in sorted(uids, key=lambda x:(x[0], x[1])):
+ for uid, calname, id, caltype, caluid in sorted(uids, key=lambda x: (x[0], x[1])):
shortname = UserNameFromUID(txn, uid)
table.addRow((
uid,
@@ -382,6 +401,7 @@
print "Calendar events (total=%d):\n" % (len(uids),)
table.printTable()
+
@inlineCallbacks
def getEvents(self, txn):
ch = schema.CALENDAR_HOME
@@ -402,6 +422,8 @@
).on(txn))
returnValue(tuple(rows))
+
+
class EventsByCalendar(Cmd):
_name = "List Events for a specific calendar"
@@ -420,7 +442,7 @@
# Print table of results
table = tables.Table()
table.addHeader(("Type", "UID", "Resource Name", "Resource ID",))
- for caltype, caluid, rname, rid in sorted(uids, key=lambda x:x[1]):
+ for caltype, caluid, rname, rid in sorted(uids, key=lambda x: x[1]):
table.addRow((
caltype,
caluid,
@@ -432,6 +454,7 @@
print "Calendar events (total=%d):\n" % (len(uids),)
table.printTable()
+
@inlineCallbacks
def getEvents(self, txn, rid):
ch = schema.CALENDAR_HOME
@@ -449,9 +472,11 @@
cb.BIND_MODE == _BIND_MODE_OWN)).join(
co, type="inner", on=(cb.CALENDAR_RESOURCE_ID == co.CALENDAR_RESOURCE_ID)),
Where=(co.CALENDAR_RESOURCE_ID == Parameter("RID")),
- ).on(txn, **{"RID":rid}))
+ ).on(txn, **{"RID": rid}))
returnValue(tuple(rows))
+
+
class EventDetails(Cmd):
"""
Base class for common event details commands.
@@ -471,6 +496,7 @@
table.printTable()
print data
+
@inlineCallbacks
def getEventData(self, txn, whereClause, whereParams):
ch = schema.CALENDAR_HOME
@@ -494,6 +520,8 @@
).on(txn, **whereParams))
returnValue(tuple(rows))
+
+
class Event(EventDetails):
_name = "Get Event Data by Resource-ID"
@@ -501,7 +529,6 @@
@inlineCallbacks
def doIt(self, txn):
-
rid = raw_input("Resource-ID: ")
try:
int(rid)
@@ -514,11 +541,13 @@
else:
print "Could not find resource"
+
def getData(self, txn, rid):
co = schema.CALENDAR_OBJECT
- return self.getEventData(txn, (co.RESOURCE_ID == Parameter("RID")), {"RID":rid})
+ return self.getEventData(txn, (co.RESOURCE_ID == Parameter("RID")), {"RID": rid})
+
class EventsByUID(EventDetails):
_name = "Get Event Data by iCalendar UID"
@@ -526,7 +555,6 @@
@inlineCallbacks
def doIt(self, txn):
-
uid = raw_input("UID: ")
rows = yield self.getData(txn, uid)
if rows:
@@ -535,11 +563,13 @@
else:
print "Could not find icalendar data"
+
def getData(self, txn, uid):
co = schema.CALENDAR_OBJECT
- return self.getEventData(txn, (co.ICALENDAR_UID == Parameter("UID")), {"UID":uid})
+ return self.getEventData(txn, (co.ICALENDAR_UID == Parameter("UID")), {"UID": uid})
+
class EventsByName(EventDetails):
_name = "Get Event Data by resource name"
@@ -547,7 +577,6 @@
@inlineCallbacks
def doIt(self, txn):
-
name = raw_input("Resource Name: ")
rows = yield self.getData(txn, name)
if rows:
@@ -556,11 +585,13 @@
else:
print "Could not find icalendar data"
+
def getData(self, txn, name):
co = schema.CALENDAR_OBJECT
- return self.getEventData(txn, (co.RESOURCE_NAME == Parameter("NAME")), {"NAME":name})
+ return self.getEventData(txn, (co.RESOURCE_NAME == Parameter("NAME")), {"NAME": name})
+
class EventsByOwner(EventDetails):
_name = "Get Event Data by Owner UID/Short Name"
@@ -568,7 +599,6 @@
@inlineCallbacks
def doIt(self, txn):
-
uid = raw_input("Owner UID/Name: ")
uid = UIDFromInput(txn, uid)
rows = yield self.getData(txn, uid)
@@ -578,11 +608,13 @@
else:
print "Could not find icalendar data"
+
def getData(self, txn, uid):
ch = schema.CALENDAR_HOME
- return self.getEventData(txn, (ch.OWNER_UID == Parameter("UID")), {"UID":uid})
+ return self.getEventData(txn, (ch.OWNER_UID == Parameter("UID")), {"UID": uid})
+
class EventsByOwnerCalendar(EventDetails):
_name = "Get Event Data by Owner UID/Short Name and calendar name"
@@ -590,7 +622,6 @@
@inlineCallbacks
def doIt(self, txn):
-
uid = raw_input("Owner UID/Name: ")
uid = UIDFromInput(txn, uid)
name = raw_input("Calendar resource name: ")
@@ -601,12 +632,14 @@
else:
print "Could not find icalendar data"
+
def getData(self, txn, uid, name):
ch = schema.CALENDAR_HOME
cb = schema.CALENDAR_BIND
return self.getEventData(txn, (ch.OWNER_UID == Parameter("UID")).And(cb.CALENDAR_RESOURCE_NAME == Parameter("NAME")), {"UID": uid, "NAME": name})
+
class EventsByPath(EventDetails):
_name = "Get Event Data by HTTP Path"
@@ -614,7 +647,6 @@
@inlineCallbacks
def doIt(self, txn):
-
path = raw_input("Path: ")
pathbits = path.split("/")
if len(pathbits) != 6:
@@ -630,6 +662,7 @@
else:
print "Could not find icalendar data"
+
def getData(self, txn, homeName, calendarName, resourceName):
ch = schema.CALENDAR_HOME
cb = schema.CALENDAR_BIND
@@ -645,6 +678,7 @@
)
+
class EventsByContent(EventDetails):
_name = "Get Event Data by Searching its Text Data"
@@ -652,7 +686,6 @@
@inlineCallbacks
def doIt(self, txn):
-
uid = raw_input("Search for: ")
rows = yield self.getData(txn, uid)
if rows:
@@ -661,11 +694,13 @@
else:
print "Could not find icalendar data"
+
def getData(self, txn, text):
co = schema.CALENDAR_OBJECT
- return self.getEventData(txn, (co.ICALENDAR_TEXT.Contains(Parameter("TEXT"))), {"TEXT":text})
+ return self.getEventData(txn, (co.ICALENDAR_TEXT.Contains(Parameter("TEXT"))), {"TEXT": text})
+
class EventsInTimerange(Cmd):
_name = "Get Event Data within a specified time range"
@@ -673,7 +708,6 @@
@inlineCallbacks
def doIt(self, txn):
-
uid = raw_input("Owner UID/Name: ")
start = raw_input("Start Time (UTC YYYYMMDDTHHMMSSZ or YYYYMMDD): ")
if len(start) == 8:
@@ -701,6 +735,7 @@
yield self.eventsForEachCalendar(home, uid, timerange)
+
@inlineCallbacks
def eventsForEachCalendar(self, home, uid, timerange):
@@ -710,6 +745,7 @@
continue
yield self.eventsInTimeRange(calendar, uid, timerange)
+
@inlineCallbacks
def eventsInTimeRange(self, calendar, uid, timerange):
@@ -746,6 +782,7 @@
print ical_data.getTextWithTimezones(includeTimezones=False)
+
class Purge(Cmd):
_name = "Purge all data from tables"
@@ -753,13 +790,12 @@
@inlineCallbacks
def doIt(self, txn):
-
if raw_input("Do you really want to remove all data [y/n]: ")[0].lower() != 'y':
print "No data removed"
returnValue(None)
wipeout = (
- # These are ordered in such a way as to ensure key constraints are not
+ # These are ordered in such a way as to ensure key constraints are not
# violated as data is removed
schema.RESOURCE_PROPERTY,
@@ -809,6 +845,7 @@
else:
print "No attachments path to delete."
+
@inlineCallbacks
def removeTableData(self, txn, tableschema):
yield Delete(
@@ -817,6 +854,7 @@
).on(txn)
+
class DBInspectService(Service, object):
"""
Service which runs, exports the appropriate records, then stops the reactor.
@@ -862,6 +900,7 @@
self.commands.append(cmd.name())
self.commandMap[cmd.name()] = cmd
+
@inlineCallbacks
def runCommandByPosition(self, position):
try:
@@ -870,6 +909,7 @@
print "Position %d not available" % (position,)
returnValue(None)
+
@inlineCallbacks
def runCommandByName(self, name):
try:
@@ -877,6 +917,7 @@
except IndexError:
print "Unknown command: '%s'" % (name,)
+
@inlineCallbacks
def runCommand(self, cmd):
txn = self.store.newTransaction()
@@ -889,6 +930,7 @@
print "Command '%s' failed because of: %s" % (cmd.name(), e,)
yield txn.abort()
+
def printCommands(self):
print "\n<---- Commands ---->"
@@ -898,6 +940,7 @@
print "P. Purge\n"
print "Q. Quit\n"
+
@inlineCallbacks
def doDBInspect(self):
"""
@@ -949,6 +992,7 @@
# anyway).
+
def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
"""
Do the export.
@@ -959,7 +1003,7 @@
options.parseOptions(argv[1:])
def makeService(store):
return DBInspectService(store, options, reactor, config)
- utilityMain(options['config'], makeService, reactor)
+ utilityMain(options['config'], makeService, reactor, verbose=options['debug'])
if __name__ == '__main__':
main()
Modified: CalendarServer/trunk/calendarserver/tools/export.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/export.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/export.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -84,9 +84,14 @@
synopsis = description
- optParameters = [['config', 'f', DEFAULT_CONFIG_FILE,
- "Specify caldavd.plist configuration path."]]
+ optFlags = [
+ ['debug', 'D', "Debug logging."],
+ ]
+ optParameters = [
+ ['config', 'f', DEFAULT_CONFIG_FILE, "Specify caldavd.plist configuration path."],
+ ]
+
def __init__(self):
super(ExportOptions, self).__init__()
self.exporters = []
@@ -284,9 +289,9 @@
def __init__(self, store, options, output, reactor, config):
super(ExporterService, self).__init__()
- self.store = store
+ self.store = store
self.options = options
- self.output = output
+ self.output = output
self.reactor = reactor
self.config = config
self._directory = None
@@ -365,8 +370,9 @@
(e))
sys.exit(1)
+
def makeService(store):
from twistedcaldav.config import config
return ExporterService(store, options, output, reactor, config)
- utilityMain(options["config"], makeService, reactor)
+ utilityMain(options["config"], makeService, reactor, verbose=options["debug"])
Modified: CalendarServer/trunk/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/gateway.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/gateway.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -34,7 +34,6 @@
from calendarserver.tools.purge import WorkerService, PurgeOldEventsService, DEFAULT_BATCH_SIZE, DEFAULT_RETAIN_DAYS
from calendarserver.tools.cmdline import utilityMain
-from twext.python.log import StandardIOObserver
from pycalendar.datetime import PyCalendarDateTime
@@ -95,14 +94,14 @@
# Get configuration
#
configFileName = None
+ debug = False
for opt, arg in optargs:
if opt in ("-h", "--help"):
usage()
if opt in ("-e", "--error"):
- observer = StandardIOObserver()
- observer.start()
+ debug = True
elif opt in ("-f", "--config"):
configFileName = arg
@@ -128,7 +127,7 @@
commands = [plist]
RunnerService.commands = commands
- utilityMain(configFileName, RunnerService)
+ utilityMain(configFileName, RunnerService, verbose=debug)
attrMap = {
Modified: CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -15,56 +15,32 @@
# limitations under the License.
##
-import os
-import sys
+from calendarserver.tools.managetimezones import StandardIOObserver
+from calendarserver.tools.util import loadConfig, getDirectory, \
+ autoDisableMemcached
from getopt import getopt, GetoptError
from grp import getgrnam
from pwd import getpwnam
-from sys import stdout, stderr
from twext.python.log import setLogLevelForNamespace
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
-from twisted.python.log import addObserver, removeObserver
from twisted.python.util import switchUID
+
from twistedcaldav.config import config, ConfigurationError
from twistedcaldav.directory import augment
from twistedcaldav.directory.augment import AugmentXMLDB
-from calendarserver.tools.util import loadConfig, getDirectory,\
- autoDisableMemcached
+import os
+import sys
class UsageError (StandardError):
pass
-class StandardIOObserver (object):
- """
- Log observer that writes to standard I/O.
- """
- def emit(self, eventDict):
- text = None
- if eventDict["isError"]:
- output = stderr
- if "failure" in eventDict:
- text = eventDict["failure"].getTraceback()
- else:
- output = stdout
- if not text:
- text = " ".join([str(m) for m in eventDict["message"]]) + "\n"
-
- output.write(text)
- output.flush()
-
- def start(self):
- addObserver(self.emit)
-
- def stop(self):
- removeObserver(self.emit)
-
def usage(e=None):
if e:
print e
@@ -87,6 +63,8 @@
else:
sys.exit(0)
+
+
def main():
try:
(optargs, args) = getopt(
@@ -156,16 +134,18 @@
reactor.callLater(0, run, dbxml)
reactor.run()
+
+
@inlineCallbacks
def run(dbxml):
-
+
try:
uids = set((yield augment.AugmentService.getAllUIDs()))
added = 0
updated = 0
removed = 0
if dbxml:
- yield augment.AugmentService.addAugmentRecords(dbxml.db.values(), )
+ yield augment.AugmentService.addAugmentRecords(dbxml.db.values(),)
add_records = list()
modify_records = list()
for record in dbxml.db.values():
@@ -179,7 +159,7 @@
remove_uids = uids.difference(dbxml.db.keys())
yield augment.AugmentService.removeAugmentRecords(remove_uids)
removed = len(remove_uids)
-
+
print "Changes:"
print " Added: %d" % (added,)
print " Changed: %d" % (updated,)
Modified: CalendarServer/trunk/calendarserver/tools/managetimezones.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/managetimezones.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/managetimezones.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -15,22 +15,26 @@
# limitations under the License.
##
+from pycalendar.calendar import PyCalendar
+from pycalendar.datetime import PyCalendarDateTime
+
+
+from twext.python.log import StandardIOObserver
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks
+from twisted.python.filepath import FilePath
+
from twistedcaldav.timezonestdservice import PrimaryTimezoneDatabase, \
SecondaryTimezoneDatabase
-from sys import stdout, stderr
+
+from zonal.tzconvert import tzconvert
+
import getopt
-from twisted.internet import reactor
-from twisted.internet.defer import inlineCallbacks
-from twisted.python.log import addObserver, removeObserver
-import sys
import os
-import urllib
+import sys
import tarfile
import tempfile
-from pycalendar.calendar import PyCalendar
-from zonal.tzconvert import tzconvert
-from twisted.python.filepath import FilePath
-from pycalendar.datetime import PyCalendarDateTime
+import urllib
def _doPrimaryActions(action, tzpath, xmlfile, changed, tzvers):
@@ -165,36 +169,6 @@
-class StandardIOObserver (object):
- """
- Log observer that writes to standard I/O.
- """
- def emit(self, eventDict):
- text = None
-
- if eventDict["isError"]:
- output = stderr
- if "failure" in eventDict:
- text = eventDict["failure"].getTraceback()
- else:
- output = stdout
-
- if not text:
- text = " ".join([str(m) for m in eventDict["message"]]) + "\n"
-
- output.write(text)
- output.flush()
-
-
- def start(self):
- addObserver(self.emit)
-
-
- def stop(self):
- removeObserver(self.emit)
-
-
-
@inlineCallbacks
def _runInReactor(tzdb):
Modified: CalendarServer/trunk/calendarserver/tools/migrate_verify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/migrate_verify.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/migrate_verify.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -75,6 +75,7 @@
synopsis = description
optFlags = [
+ ['debug', 'D', "Debug logging."],
]
optParameters = [
@@ -107,6 +108,7 @@
return open(self.outputName, 'wb')
+
class MigrateVerifyService(Service, object):
"""
Service which runs, does its stuff, then stops the reactor.
@@ -129,6 +131,7 @@
self.missingCalendars = []
self.missingResources = []
+
def startService(self):
"""
Start the service.
@@ -157,7 +160,7 @@
def readPaths(self):
-
+
self.output.write("-- Reading data file: %s\n" % (self.options["data"]))
datafile = open(os.path.expanduser(self.options["data"]))
@@ -183,7 +186,7 @@
elif len(segments) > 6:
self.badPaths.append(line)
invalidGUIDs.add(guid)
- else:
+ else:
self.pathsByGUID.setdefault(guid, {}).setdefault(calendar, set()).add(resource)
self.validPaths += 1
else:
@@ -210,27 +213,27 @@
for invalidGUID in sorted(invalidGUIDs):
self.output.write("Invalid GUID: %s\n" % (invalidGUID,))
-
self.output.write("\n-- Bad paths\n")
for badPath in sorted(self.badPaths):
self.output.write("Bad path: %s\n" % (badPath,))
+
@inlineCallbacks
def doCheck(self):
"""
Check path data against the SQL store.
"""
-
+
self.output.write("\n-- Scanning database for missed migrations\n")
# Get list of distinct resource_property resource_ids to delete
self.txn = self.store.newTransaction()
-
+
total = len(self.pathsByGUID)
totalMissingCalendarResources = 0
count = 0
for guid in self.pathsByGUID:
-
+
if divmod(count, 10)[1] == 0:
self.output.write(("\r%d of %d (%d%%)" % (
count,
@@ -244,7 +247,7 @@
if homeID is None:
self.missingGUIDs.append(guid)
continue
-
+
# Now get the list of calendar names and calendar resource IDs
results = (yield self.calendarsForUser(homeID))
if results is None:
@@ -261,7 +264,7 @@
results = []
results = [result[0] for result in results]
db_resources = set(results)
-
+
# Also check for split calendar
if "%s-vtodo" % (calendar,) in calendars:
results = (yield self.resourcesForCalendar(calendars["%s-vtodo" % (calendar,)]))
@@ -269,7 +272,7 @@
results = []
results = [result[0] for result in results]
db_resources.update(results)
-
+
# Also check for split calendar
if "%s-vevent" % (calendar,) in calendars:
results = (yield self.resourcesForCalendar(calendars["%s-vevent" % (calendar,)]))
@@ -277,7 +280,7 @@
results = []
results = [result[0] for result in results]
db_resources.update(results)
-
+
old_resources = set(self.pathsByGUID[guid][calendar])
self.missingResources.extend(["%s/%s/%s" % (guid, calendar, resource,) for resource in old_resources.difference(db_resources)])
@@ -285,7 +288,7 @@
if divmod(count + 1, 10)[1] == 0:
yield self.txn.commit()
self.txn = self.store.newTransaction()
-
+
count += 1
yield self.txn.commit()
@@ -302,12 +305,12 @@
self.output.write("\nTotal missing Resources: %d\n" % (len(self.missingResources),))
for resource in sorted(self.missingResources):
self.output.write("%s\n" % (resource,))
-
+
@inlineCallbacks
def guid2ResourceID(self, guid):
ch = schema.CALENDAR_HOME
- kwds = { "GUID" : guid }
+ kwds = {"GUID" : guid}
rows = (yield Select(
[
ch.RESOURCE_ID,
@@ -324,7 +327,7 @@
@inlineCallbacks
def calendarsForUser(self, rid):
cb = schema.CALENDAR_BIND
- kwds = { "RID" : rid }
+ kwds = {"RID" : rid}
rows = (yield Select(
[
cb.CALENDAR_RESOURCE_NAME,
@@ -338,11 +341,11 @@
returnValue(rows)
-
+
@inlineCallbacks
def resourcesForCalendar(self, rid):
co = schema.CALENDAR_OBJECT
- kwds = { "RID" : rid }
+ kwds = {"RID" : rid}
rows = (yield Select(
[
co.RESOURCE_NAME,
@@ -355,7 +358,7 @@
returnValue(rows)
-
+
def stopService(self):
"""
Stop the service. Nothing to do; everything should be finished by this
@@ -378,12 +381,13 @@
stderr.write("Unable to open output file for writing: %s\n" % (e))
sys.exit(1)
+
def makeService(store):
from twistedcaldav.config import config
config.TransactionTimeoutSeconds = 0
return MigrateVerifyService(store, options, output, reactor, config)
- utilityMain(options['config'], makeService, reactor)
+ utilityMain(options['config'], makeService, reactor, verbose=options["debug"])
if __name__ == '__main__':
main()
Modified: CalendarServer/trunk/calendarserver/tools/obliterate.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/obliterate.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/obliterate.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -26,7 +26,7 @@
"""
from calendarserver.tools.cmdline import utilityMain
-from twext.enterprise.dal.syntax import Parameter, Delete, Select, Union,\
+from twext.enterprise.dal.syntax import Parameter, Delete, Select, Union, \
CompoundComparison, ExpressionSyntax, Count
from twisted.application.service import Service
from twisted.internet.defer import inlineCallbacks, returnValue
@@ -81,6 +81,7 @@
optFlags = [
['verbose', 'v', "Verbose logging."],
+ ['debug', 'D', "Debug logging."],
['fix-props', 'p', "Fix orphaned resource properties only."],
['dry-run', 'n', "Do not make any changes."],
]
@@ -116,6 +117,7 @@
return open(self.outputName, 'wb')
+
# Need to patch this in if not present in actual server code
def NotIn(self, subselect):
# Can't be Select.__contains__ because __contains__ gets __nonzero__
@@ -126,6 +128,7 @@
ExpressionSyntax.NotIn = NotIn
+
class ObliterateService(Service, object):
"""
Service which runs, does its stuff, then stops the reactor.
@@ -184,10 +187,10 @@
"""
Obliterate orphaned data in RESOURCE_PROPERTIES table.
"""
-
+
# Get list of distinct resource_property resource_ids to delete
self.txn = self.store.newTransaction()
-
+
ch = schema.CALENDAR_HOME
ca = schema.CALENDAR
co = schema.CALENDAR_OBJECT
@@ -313,7 +316,7 @@
# Get the resource-id for the home
ch = schema.CALENDAR_HOME
- kwds = { "UUID" : uuid }
+ kwds = {"UUID" : uuid}
rows = (yield Select(
[ch.RESOURCE_ID, ],
From=ch,
@@ -363,7 +366,7 @@
ch = schema.CALENDAR_HOME
cb = schema.CALENDAR_BIND
co = schema.CALENDAR_OBJECT
- kwds = { "UUID" : uuid }
+ kwds = {"UUID" : uuid}
rows = (yield Select(
[
Count(co.RESOURCE_ID),
@@ -385,7 +388,7 @@
# Get list of binds and bind mode
cb = schema.CALENDAR_BIND
- kwds = { "resourceID" : homeID }
+ kwds = {"resourceID" : homeID}
rows = (yield Select(
[cb.CALENDAR_RESOURCE_ID, cb.BIND_MODE, ],
From=cb,
@@ -449,7 +452,7 @@
def removeRevisionsForHomeResourceID(self, resourceID):
if not self.options["dry-run"]:
rev = schema.CALENDAR_OBJECT_REVISIONS
- kwds = { "ResourceID" : resourceID }
+ kwds = {"ResourceID" : resourceID}
yield Delete(
From=rev,
Where=(
@@ -462,7 +465,7 @@
def removeRevisionsForCalendarResourceID(self, resourceID):
if not self.options["dry-run"]:
rev = schema.CALENDAR_OBJECT_REVISIONS
- kwds = { "ResourceID" : resourceID }
+ kwds = {"ResourceID" : resourceID}
yield Delete(
From=rev,
Where=(
@@ -475,7 +478,7 @@
def removePropertiesForResourceID(self, resourceID):
if not self.options["dry-run"]:
props = schema.RESOURCE_PROPERTY
- kwds = { "ResourceID" : resourceID }
+ kwds = {"ResourceID" : resourceID}
yield Delete(
From=props,
Where=(
@@ -489,7 +492,7 @@
# Get NOTIFICATION_HOME.RESOURCE_ID
nh = schema.NOTIFICATION_HOME
- kwds = { "UUID" : uuid }
+ kwds = {"UUID" : uuid}
rows = (yield Select(
[nh.RESOURCE_ID, ],
From=nh,
@@ -504,7 +507,7 @@
# Delete NOTIFICATION rows
if not self.options["dry-run"]:
no = schema.NOTIFICATION
- kwds = { "ResourceID" : resourceID }
+ kwds = {"ResourceID" : resourceID}
yield Delete(
From=no,
Where=(
@@ -514,7 +517,7 @@
# Delete NOTIFICATION_HOME (will cascade to NOTIFICATION_OBJECT_REVISIONS)
if not self.options["dry-run"]:
- kwds = { "UUID" : uuid }
+ kwds = {"UUID" : uuid}
yield Delete(
From=nh,
Where=(
@@ -528,7 +531,7 @@
# Get ATTACHMENT paths
at = schema.ATTACHMENT
- kwds = { "resourceID" : resourceID }
+ kwds = {"resourceID" : resourceID}
rows = (yield Select(
[at.PATH, ],
From=at,
@@ -543,14 +546,14 @@
# Delete ATTACHMENT rows
if not self.options["dry-run"]:
at = schema.ATTACHMENT
- kwds = { "resourceID" : resourceID }
+ kwds = {"resourceID" : resourceID}
yield Delete(
From=at,
Where=(
at.CALENDAR_HOME_RESOURCE_ID == Parameter("resourceID")
),
).on(self.txn, **kwds)
-
+
returnValue(len(rows) if rows else 0)
@@ -558,7 +561,7 @@
def removeHomeForResourceID(self, resourceID):
if not self.options["dry-run"]:
ch = schema.CALENDAR_HOME
- kwds = { "ResourceID" : resourceID }
+ kwds = {"ResourceID" : resourceID}
yield Delete(
From=ch,
Where=(
@@ -589,12 +592,13 @@
stderr.write("Unable to open output file for writing: %s\n" % (e))
sys.exit(1)
+
def makeService(store):
from twistedcaldav.config import config
config.TransactionTimeoutSeconds = 0
return ObliterateService(store, options, output, reactor, config)
- utilityMain(options['config'], makeService, reactor)
+ utilityMain(options['config'], makeService, reactor, verbose=options["debug"])
if __name__ == '__main__':
main()
Modified: CalendarServer/trunk/calendarserver/tools/purge.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/purge.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/purge.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -118,6 +118,7 @@
#print " -b --batch <number>: number of events to remove in each transaction (default=%d)" % (DEFAULT_BATCH_SIZE,)
print " -n --dry-run: calculate how many events to purge, but do not purge data"
print " -v --verbose: print progress information"
+ print " -D --debug: debug logging"
print ""
if e:
@@ -132,13 +133,14 @@
try:
(optargs, args) = getopt(
- sys.argv[1:], "d:b:f:hnv", [
+ sys.argv[1:], "Dd:b:f:hnv", [
"days=",
"batch=",
"dry-run",
"config=",
"help",
"verbose",
+ "debug",
],
)
except GetoptError, e:
@@ -152,6 +154,7 @@
batchSize = DEFAULT_BATCH_SIZE
dryrun = False
verbose = False
+ debug = False
for opt, arg in optargs:
if opt in ("-h", "--help"):
@@ -174,6 +177,9 @@
elif opt in ("-v", "--verbose"):
verbose = True
+ elif opt in ("-D", "--debug"):
+ debug = True
+
elif opt in ("-n", "--dry-run"):
dryrun = True
@@ -200,6 +206,7 @@
utilityMain(
configFileName,
cls,
+ verbose=debug,
)
@@ -285,6 +292,7 @@
print " -d --days <number>: specify how many days in the past to retain (default=%d) zero means no removal of old attachments" % (DEFAULT_RETAIN_DAYS,)
print " -n --dry-run: calculate how many attachments to purge, but do not purge data"
print " -v --verbose: print progress information"
+ print " -D --debug: debug logging"
print ""
if e:
@@ -299,7 +307,7 @@
try:
(optargs, args) = getopt(
- sys.argv[1:], "d:b:f:hnu:v", [
+ sys.argv[1:], "Dd:b:f:hnu:v", [
"uuid=",
"days=",
"batch=",
@@ -307,6 +315,7 @@
"config=",
"help",
"verbose",
+ "debug",
],
)
except GetoptError, e:
@@ -321,6 +330,7 @@
batchSize = DEFAULT_BATCH_SIZE
dryrun = False
verbose = False
+ debug = False
for opt, arg in optargs:
if opt in ("-h", "--help"):
@@ -346,6 +356,9 @@
elif opt in ("-v", "--verbose"):
verbose = True
+ elif opt in ("-D", "--debug"):
+ debug = True
+
elif opt in ("-n", "--dry-run"):
dryrun = True
@@ -376,6 +389,7 @@
utilityMain(
configFileName,
cls,
+ verbose=debug,
)
@@ -640,6 +654,7 @@
print " -f --config <path>: Specify caldavd.plist configuration path"
print " -n --dry-run: calculate how many events and contacts to purge, but do not purge data"
print " -v --verbose: print progress information"
+ print " -D --debug: debug logging"
print ""
if e:
@@ -654,12 +669,13 @@
try:
(optargs, args) = getopt(
- sys.argv[1:], "cf:hnv", [
+ sys.argv[1:], "cDf:hnv", [
"completely",
"dry-run",
"config=",
"help",
"verbose",
+ "debug",
"noimplicit",
],
)
@@ -672,6 +688,7 @@
configFileName = None
dryrun = False
verbose = False
+ debug = False
completely = False
doimplicit = True
@@ -685,6 +702,9 @@
elif opt in ("-v", "--verbose"):
verbose = True
+ elif opt in ("-D", "--debug"):
+ debug = True
+
elif opt in ("-n", "--dry-run"):
dryrun = True
@@ -706,7 +726,8 @@
utilityMain(
configFileName,
- cls
+ cls,
+ verbose=debug,
)
Modified: CalendarServer/trunk/calendarserver/tools/push.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/push.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/push.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -40,6 +40,7 @@
print "options:"
print " -h --help: print this help and exit"
print " -f --config <path>: Specify caldavd.plist configuration path"
+ print " -D --debug: debug logging"
print ""
if e:
@@ -49,11 +50,13 @@
sys.exit(0)
+
class WorkerService(Service):
def __init__(self, store):
self._store = store
+
def rootResource(self):
try:
rootResource = getRootResource(config, self._store)
@@ -90,6 +93,7 @@
reactor.stop()
+
class DisplayAPNSubscriptions(WorkerService):
users = []
@@ -101,13 +105,15 @@
self.users)
+
def main():
try:
(optargs, args) = getopt(
- sys.argv[1:], "f:h", [
+ sys.argv[1:], "Df:h", [
"config=",
"help",
+ "debug",
],
)
except GetoptError, e:
@@ -117,6 +123,7 @@
# Get configuration
#
configFileName = None
+ debug = False
for opt, arg in optargs:
if opt in ("-h", "--help"):
@@ -125,23 +132,25 @@
elif opt in ("-f", "--config"):
configFileName = arg
+ if opt in ("-d", "--debug"):
+ debug = True
+
else:
raise NotImplementedError(opt)
if not args:
usage("Not enough arguments")
-
DisplayAPNSubscriptions.users = args
utilityMain(
configFileName,
DisplayAPNSubscriptions,
+ verbose=debug,
)
-
@inlineCallbacks
def displayAPNSubscriptions(store, directory, root, users):
for user in users:
@@ -153,12 +162,12 @@
subscriptions = (yield txn.apnSubscriptionsBySubscriber(record.uid))
(yield txn.commit())
if subscriptions:
- byKey = { }
+ byKey = {}
for token, key, timestamp, userAgent, ipAddr in subscriptions:
byKey.setdefault(key, []).append((token, timestamp, userAgent, ipAddr))
for key, tokens in byKey.iteritems():
print
- protocol, host, path = key.strip("/").split("/", 2)
+ protocol, _ignore_host, path = key.strip("/").split("/", 2)
resource = {
"CalDAV" : "calendar",
"CardDAV" : "addressbook",
Modified: CalendarServer/trunk/calendarserver/tools/test/test_export.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_export.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/test/test_export.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -53,6 +53,8 @@
.getContent()
)
+
+
def sample(name):
return (
getModule("twistedcaldav.test").filePath
@@ -195,7 +197,6 @@
self.mainCalled = False
self.patch(export, "utilityMain", self.fakeUtilityMain)
-
self.store = yield buildStore(self, None)
self.waitToStop = Deferred()
@@ -208,7 +209,7 @@
self.waitToStop.callback(None)
- def fakeUtilityMain(self, configFileName, serviceClass, reactor=None):
+ def fakeUtilityMain(self, configFileName, serviceClass, reactor=None, verbose=False):
"""
Verify a few basic things.
"""
@@ -484,5 +485,3 @@
Component.fromString(resultForUser2),
Component.fromString(output.getContent())
)
-
-
Modified: CalendarServer/trunk/calendarserver/tools/upgrade.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/upgrade.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/upgrade.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -70,10 +70,14 @@
synopsis = description
- optParameters = [['config', 'f', DEFAULT_CONFIG_FILE,
- "Specify caldavd.plist configuration path."]]
+ optFlags = [
+ ['postprocess', 'p', "Perform post-database-import processing."],
+ ['debug', 'D', "Debug logging."],
+ ]
- optFlags = [['postprocess', 'p', "Perform post-database-import processing."]]
+ optParameters = [
+ ['config', 'f', DEFAULT_CONFIG_FILE, "Specify caldavd.plist configuration path."],
+ ]
def __init__(self):
super(UpgradeOptions, self).__init__()
@@ -119,9 +123,9 @@
def __init__(self, store, options, output, reactor, config):
super(UpgraderService, self).__init__()
- self.store = store
+ self.store = store
self.options = options
- self.output = output
+ self.output = output
self.reactor = reactor
self.config = config
self._directory = None
@@ -148,6 +152,7 @@
"""
+
def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
"""
Do the export.
@@ -174,11 +179,13 @@
data.MergeUpgrades = True
config.addPostUpdateHooks([setMerge])
+
def makeService(store):
return UpgraderService(store, options, output, reactor, config)
+
def onlyUpgradeEvents(event):
- output.write(logDateString()+' '+log.textFromEventDict(event)+"\n")
+ output.write(logDateString() + ' ' + log.textFromEventDict(event) + "\n")
output.flush()
setLogLevelForNamespace(None, "debug")
@@ -187,8 +194,10 @@
customService = CalDAVServiceMaker()
customService.doPostImport = options["postprocess"]
return customService
- utilityMain(options["config"], makeService, reactor, customServiceMaker)
+ utilityMain(options["config"], makeService, reactor, customServiceMaker, verbose=options["debug"])
+
+
def logDateString():
logtime = time.localtime()
Y, M, D, h, m, s = logtime[:6]
@@ -196,6 +205,8 @@
return '%02d-%02d-%02d %02d:%02d:%02d%s' % (Y, M, D, h, m, s, tz)
+
+
def computeTimezoneForLog(tz):
if tz > 0:
neg = 1
Modified: CalendarServer/trunk/calendarserver/tools/validcalendardata.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/validcalendardata.py 2013-02-12 15:46:33 UTC (rev 10696)
+++ CalendarServer/trunk/calendarserver/tools/validcalendardata.py 2013-02-12 18:19:18 UTC (rev 10697)
@@ -62,6 +62,7 @@
optFlags = [
['verbose', 'v', "Verbose logging."],
+ ['debug', 'D', "Debug logging."],
['parse-only', 'p', "Only validate parsing of the data."],
]
@@ -227,7 +228,7 @@
def makeService(store):
return ValidService(store, options, output, input, reactor, config)
- utilityMain(options["config"], makeService, reactor)
+ utilityMain(options["config"], makeService, reactor, verbose=options["debug"])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130212/233812e2/attachment-0001.html>
More information about the calendarserver-changes
mailing list