[CalendarServer-changes] [1767] CalendarServer/trunk/twistedcaldav/admin

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 8 06:42:42 PDT 2007


Revision: 1767
          http://trac.macosforge.org/projects/calendarserver/changeset/1767
Author:   cdaboo at apple.com
Date:     2007-08-08 06:42:41 -0700 (Wed, 08 Aug 2007)

Log Message:
-----------
By default we now do not use the existing stats.plist data - it will be overwritten. A new -a command line option
will revert to the old behavior of reading that in and appending new stats to it and writing out.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/admin/logs.py
    CalendarServer/trunk/twistedcaldav/admin/options.py

Modified: CalendarServer/trunk/twistedcaldav/admin/logs.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/logs.py	2007-08-07 21:12:43 UTC (rev 1766)
+++ CalendarServer/trunk/twistedcaldav/admin/logs.py	2007-08-08 13:42:41 UTC (rev 1767)
@@ -55,11 +55,11 @@
     return str(long(value) + add)
 
 class Stats(object):
-    def __init__(self, fp, days):
+    def __init__(self, fp, append, days):
         self.fp = fp
         self._data = None
 
-        if self.fp.exists():
+        if self.fp.exists() and append:
             self._data = plistlib.readPlist(self.fp.path)
             if self._data.version != PLIST_VERSION:
                 self._data = None
@@ -249,10 +249,9 @@
 
         self.noOutput = self.config['nooutput']
         self.readOnly = self.config['readonly']
-        self.days = self.config['days']
 
         self.logfile = self.config['logfile']
-        self.stats = Stats(self.config['statsfile'], self.days)
+        self.stats = Stats(self.config['statsfile'], self.config['append'], self.config['days'])
 
     def run(self):
 

Modified: CalendarServer/trunk/twistedcaldav/admin/options.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/options.py	2007-08-07 21:12:43 UTC (rev 1766)
+++ CalendarServer/trunk/twistedcaldav/admin/options.py	2007-08-08 13:42:41 UTC (rev 1767)
@@ -101,6 +101,7 @@
     optFlags = [
         ['nooutput', 'n', 'Do not output anything to stdout'],
         ['readonly', 'r', 'Just read the current stats in the statistics file'],
+        ['append',   'a', 'Append to current stats in the statistics file'],
         PARAM_HUMAN,
         PARAM_KILO,
         PARAM_MEGA,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070808/02eeef56/attachment.html


More information about the calendarserver-changes mailing list