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

source_changes at macosforge.org source_changes at macosforge.org
Tue May 22 07:54:39 PDT 2007


Revision: 1546
          http://trac.macosforge.org/projects/calendarserver/changeset/1546
Author:   cdaboo at apple.com
Date:     2007-05-22 07:54:38 -0700 (Tue, 22 May 2007)

Log Message:
-----------
Make sure users/groups/resources/locations/stats commands run properly and generate output. Tweak some output formatting for stats.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/admin/formatters.py
    CalendarServer/trunk/twistedcaldav/admin/stats.py

Modified: CalendarServer/trunk/twistedcaldav/admin/formatters.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/formatters.py	2007-05-21 22:14:21 UTC (rev 1545)
+++ CalendarServer/trunk/twistedcaldav/admin/formatters.py	2007-05-22 14:54:38 UTC (rev 1546)
@@ -133,19 +133,22 @@
 
         self.writeTable(report, fields, headings)
 
-    report_user = report_group = report_resource = report_principals
+    report_users = report_groups = report_resources = report_locations = report_principals
 
     def report_stats(self, report):
-        fields = ('accountCount', 'groupCount', 'calendarCount', 'eventCount', 
+        fields = ('accountCount', 'groupCount', 'resourceCount', 'locationCount',
+                  'calendarCount', 'eventCount', 
                   'todoCount', 'diskUsage')
 
         headings = {
-            'accountCount': '# Accounts',
-            'groupCount': '# Groups',
+            'accountCount':  '# Accounts ',
+            'groupCount':    '# Groups   ',
+            'resourceCount': '# Resources',
+            'locationCount': '# Locations',
             'calendarCount': '# Calendars',
-            'eventCount': '# Events',
-            'todoCount': '# Todos',
-            'diskUsage': 'Disk Usage',
+            'eventCount':    '# Events   ',
+            'todoCount':     '# Todos    ',
+            'diskUsage':     'Disk Usage ',
             }
 
         self.writeReport(report, 'Statistics', fields, headings)
@@ -199,7 +202,7 @@
         self.writeDict(self.options['fieldnames'],
                        report['records'])
         
-    report_user = report_group = report_resource = report_principals
+    report_users = report_groups = report_resources = report_locations = report_principals
 
     def report_stats(self, report):
         if 'fieldnames' not in self.options:
@@ -224,7 +227,7 @@
 
         plistlib.writePlist(plist, self.dest)
 
-    report_user = report_group = report_resource = report_principals
+    report_users = report_groups = report_resources = report_locations = report_principals
 
     def report_stats(self, report):
         plist = plistlib.Dict()

Modified: CalendarServer/trunk/twistedcaldav/admin/stats.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/stats.py	2007-05-21 22:14:21 UTC (rev 1545)
+++ CalendarServer/trunk/twistedcaldav/admin/stats.py	2007-05-22 14:54:38 UTC (rev 1546)
@@ -43,6 +43,7 @@
             self.getAccountCount,
             self.getGroupCount,
             self.getResourceCount,
+            self.getLocationCount,
             self.getDiskUsage]
 
     def getDiskUsage(self):
@@ -53,20 +54,26 @@
         return ("accountCount", 
                 len(util.getPrincipalList(
                     self.principalCollection,
-                    'user')))
+                    'users')))
 
     def getGroupCount(self):
         return ("groupCount", 
                 len(util.getPrincipalList(
                     self.principalCollection,
-                    'group')))
+                    'groups')))
 
     def getResourceCount(self):
         return ("resourceCount", 
                 len(util.getPrincipalList(
                     self.principalCollection,
-                    'resource')))
+                    'resources')))
 
+    def getLocationCount(self):
+        return ("locationCount", 
+                len(util.getPrincipalList(
+                    self.principalCollection,
+                    'locations')))
+
     def run(self):
         assert self.root.exists()
         stats = []

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


More information about the calendarserver-changes mailing list