1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 from caldavclientlibrary.browser.command import Command
18 from caldavclientlibrary.browser.command import WrongOptions
19 from caldavclientlibrary.protocol.url import URL
20 from caldavclientlibrary.browser import utils
21 import getopt
22 import shlex
23
25
29
31 refresh = False
32 resolve = True
33 principal = None
34 print_proxies = False
35
36 opts, args = getopt.getopt(shlex.split(options), 'fnp:x')
37
38 for name, value in opts:
39
40 if name == "-f":
41 refresh = True
42 elif name == "-n":
43 resolve = False
44 elif name == "-p":
45 principal = self.shell.account.getPrincipal(URL(url=value), refresh=refresh)
46 elif name == "-x":
47 print_proxies = True
48 else:
49 print "Unknown option: %s" % (name,)
50 print self.usage(name)
51 raise WrongOptions
52
53 if len(args) > 0:
54 print "Wrong number of arguments: %d" % (len(args),)
55 print self.usage(name)
56 raise WrongOptions
57
58 if not principal:
59 principal = self.shell.account.getPrincipal(refresh=refresh)
60
61 print """
62 Principal Path : %s
63 Display Name : %s
64 Principal URL : %s
65 Alternate URLs : %s
66 Group Members : %s
67 Memberships : %s
68 Calendar Homes : %s
69 Outbox URL : %s
70 Inbox URL : %s
71 Calendar Addresses: %s
72 """ % (
73 principal.principalPath,
74 principal.getSmartDisplayName(),
75 principal.principalURL,
76 utils.printList(principal.alternateURIs),
77 utils.printPrincipalPaths(self.shell.account, principal.memberset, resolve, refresh),
78 utils.printPrincipalPaths(self.shell.account, principal.memberships, resolve, refresh),
79 utils.printList(principal.homeset),
80 principal.outboxURL,
81 principal.inboxURL,
82 utils.printList(principal.cuaddrs),
83 ),
84
85 if print_proxies:
86 utils.printProxyPrincipals(self.shell.account, principal, True, True, resolve, False, refresh)
87
88 return True
89
91 return """Usage: %s [OPTIONS]
92 Options:
93 -f force reload of all cached principals to be returned
94 -p principal path to request proxies for [OPTIONAL]
95 if not present, the current user's principal is used.
96 -n do not resolve references to other principals.
97 -x print proxy details as well.
98 """ % (name,)
99
101 return "Displays the current server login id."
102