Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Make sure users/groups/resources/locations/stats commands run properl…

…y and generate output. Tweak some output formatting for stats.

git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk@1546 e27351fd-9f3e-4f54-a53b-843176b1656c
  • Loading branch information
cyrusdaboo committed May 22, 2007
1 parent 2f5ba95 commit 97b0cdaa0b8b0f69116c3d62b17719ede6bf2b75
Showing with 22 additions and 12 deletions.
  1. +12 −9 twistedcaldav/admin/formatters.py
  2. +10 −3 twistedcaldav/admin/stats.py
@@ -133,19 +133,22 @@ def report_principals(self, report):

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 @@ def report_principals(self, report):
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 @@ def report_principals(self, report):

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()
@@ -43,6 +43,7 @@ def __init__(self, config):
self.getAccountCount,
self.getGroupCount,
self.getResourceCount,
self.getLocationCount,
self.getDiskUsage]

def getDiskUsage(self):
@@ -53,19 +54,25 @@ def getAccountCount(self):
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()

0 comments on commit 97b0cda

Please sign in to comment.
You can’t perform that action at this time.