[CalendarServer-changes] [14710] CalendarServer/branches/release/CalendarServer-5.4-dev
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 24 13:56:47 PDT 2015
Revision: 14710
http://trac.calendarserver.org//changeset/14710
Author: cdaboo at apple.com
Date: 2015-04-24 13:56:47 -0700 (Fri, 24 Apr 2015)
Log Message:
-----------
Fix purge events logging.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/purge.py
CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_purge_old_events.py
CalendarServer/branches/release/CalendarServer-5.4-dev/twext/python/log.py
Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/purge.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/purge.py 2015-04-24 19:29:05 UTC (rev 14709)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/purge.py 2015-04-24 20:56:47 UTC (rev 14710)
@@ -58,7 +58,7 @@
cutoff = None
batchSize = None
dryrun = False
- verbose = False
+ debug = False
@classmethod
def usage(cls, e=None):
@@ -167,25 +167,25 @@
cls.cutoff = cutoff
cls.batchSize = batchSize
cls.dryrun = dryrun
- cls.verbose = verbose
+ cls.debug = debug
utilityMain(
configFileName,
cls,
- verbose=debug,
+ verbose=verbose,
)
@classmethod
@inlineCallbacks
- def purgeOldEvents(cls, store, uuid, cutoff, batchSize, verbose=False, dryrun=False):
+ def purgeOldEvents(cls, store, uuid, cutoff, batchSize, debug=False, dryrun=False):
service = cls(store)
service.uuid = uuid
service.cutoff = cutoff
service.batchSize = batchSize
service.dryrun = dryrun
- service.verbose = verbose
+ service.debug = debug
result = (yield service.doWork())
returnValue(result)
@@ -195,7 +195,7 @@
"""
Find all the calendar homes that match the uuid cli argument.
"""
- log.debug("Searching for calendar homes matching: {}".format(self.uuid))
+ log.debug("Searching for calendar homes matching: '{}'".format(self.uuid))
txn = self.store.newTransaction(label="Find matching homes")
ch = schema.CALENDAR_HOME
if self.uuid:
@@ -226,7 +226,7 @@
@param owner_uid: owner UUID of home to check
@type owner_uid: L{str}
"""
- log.debug("Checking calendar home: {} {}".format(home_id, owner_uid))
+ log.debug("Checking calendar home: {} '{}'".format(home_id, owner_uid))
txn = self.store.newTransaction(label="Find matching calendars")
cb = schema.CALENDAR_BIND
kwds = {"home_id": home_id}
@@ -258,7 +258,7 @@
@type calendar_name: L{str}
"""
- log.debug(" Checking calendar: {} {}".format(calendar_id, calendar_name))
+ log.debug(" Checking calendar: {} '{}'".format(calendar_id, calendar_name))
purge = set()
txn = self.store.newTransaction(label="Find matching resources")
co = schema.CALENDAR_OBJECT
@@ -414,6 +414,13 @@
last_calendar = event.calendar
resource = (yield calendar.objectResourceWithID(event.resource))
yield resource.remove(implicitly=False)
+ log.debug("Removed resource {} '{}' from calendar {} '{}' of calendar home '{}'".format(
+ resource.id(),
+ resource.name(),
+ resource.parentCollection().id(),
+ resource.parentCollection().name(),
+ resource.parentCollection().ownerHome().uid()
+ ))
count += 1
yield txn.commit()
returnValue(count)
@@ -422,7 +429,7 @@
@inlineCallbacks
def doWork(self):
- if self.verbose:
+ if self.debug:
# Turn on debug logging for this module
config.LogLevels[__name__] = "debug"
else:
Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_purge_old_events.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_purge_old_events.py 2015-04-24 19:29:05 UTC (rev 14709)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_purge_old_events.py 2015-04-24 20:56:47 UTC (rev 14710)
@@ -640,7 +640,7 @@
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 13)
@@ -650,7 +650,7 @@
None,
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
- verbose=False
+ debug=False
))
self.assertEquals(total, 13)
@@ -660,7 +660,7 @@
None,
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
- verbose=False
+ debug=False
))
self.assertEquals(total, 0)
@@ -675,7 +675,7 @@
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 13)
@@ -686,7 +686,7 @@
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 13)
@@ -697,7 +697,7 @@
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 5)
@@ -708,7 +708,7 @@
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 8)
@@ -727,7 +727,7 @@
cutoff,
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 12)
@@ -737,7 +737,7 @@
None,
cutoff,
2,
- verbose=True
+ debug=True
))
self.assertEquals(total, 12)
@@ -747,7 +747,7 @@
cutoff,
2,
dryrun=True,
- verbose=True
+ debug=True
))
self.assertEquals(total, 0)
@@ -872,7 +872,7 @@
None,
PyCalendarDateTime(now, 4, 1, 0, 0, 0),
2,
- verbose=False
+ debug=False
))
self.assertEquals(total, 13)
Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/twext/python/log.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/twext/python/log.py 2015-04-24 19:29:05 UTC (rev 14709)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/twext/python/log.py 2015-04-24 20:56:47 UTC (rev 14710)
@@ -970,7 +970,7 @@
output = stdout
if not text:
- text = " ".join([str(m) for m in eventDict["message"]]) + "\n"
+ text = formatEvent(eventDict) + "\n"
output.write(text)
output.flush()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150424/1501ead3/attachment.html>
More information about the calendarserver-changes
mailing list