def execute(self, cmdname, options): names = False all_props = False xmllist = False prop = None path = None opts, args = getopt.getopt(shlex.split(options), 'alnp:') for name, value in opts: if name == "-a": all_props = True elif name == "-l": xmllist = True elif name == "-n": names = True elif name == "-p": prop = value else: print "Unknown option: %s" % (name, ) print self.usage(cmdname) raise WrongOptions if len(args) > 1: print "Wrong number of arguments: %d" % (len(args), ) print self.usage(cmdname) raise WrongOptions elif args: path = args[0] if not path.startswith("/"): path = os.path.join(self.shell.wd, path) else: path = self.shell.wd if not path.endswith("/"): path += "/" resource = URL(url=path) if names: results = self.shell.account.session.getPropertyNames(resource) print " Properties: %s" % (utils.printList(results), ) else: if all_props: props = None elif prop: props = (prop, ) else: props = self.shell.account.session.getPropertyNames(resource) results, bad = self.shell.account.session.getProperties( resource, props, xmllist) print "OK Properties:" utils.printProperties(results) if bad: print "Failed Properties:" utils.printProperties(bad) return True
def execute(self, cmdname, options): names = False all_props = False xmllist = False prop = None path = None opts, args = getopt.getopt(shlex.split(options), 'alnp:') for name, value in opts: if name == "-a": all_props = True elif name == "-l": xmllist = True elif name == "-n": names = True elif name == "-p": prop = value else: print "Unknown option: %s" % (name,) print self.usage(cmdname) raise WrongOptions if len(args) > 1: print "Wrong number of arguments: %d" % (len(args),) print self.usage(cmdname) raise WrongOptions elif args: path = args[0] if not path.startswith("/"): path = os.path.join(self.shell.wd, path) else: path = self.shell.wd if not path.endswith("/"): path += "/" resource = URL(url=path) if names: results = self.shell.account.session.getPropertyNames(resource) print " Properties: %s" % (utils.printList(results),) else: if all_props: props = None elif prop: props = (prop,) else: props = self.shell.account.session.getPropertyNames(resource) results, bad = self.shell.account.session.getProperties(resource, props, xmllist) print "OK Properties:" utils.printProperties(results) if bad: print "Failed Properties:" utils.printProperties(bad) return True
def execute(self, cmdname, options): refresh = False resolve = True principal = None print_proxies = False opts, args = getopt.getopt(shlex.split(options), 'fnp:x') for name, value in opts: if name == "-f": refresh = True elif name == "-n": resolve = False elif name == "-p": principal = self.shell.account.getPrincipal(URL(url=value), refresh=refresh) elif name == "-x": print_proxies = True else: print "Unknown option: %s" % (name, ) print self.usage(cmdname) raise WrongOptions if len(args) > 0: print "Wrong number of arguments: %d" % (len(args), ) print self.usage(cmdname) raise WrongOptions if not principal: principal = self.shell.account.getPrincipal(refresh=refresh) print """ Principal Path : %s Display Name : %s Principal URL : %s Alternate URLs : %s Group Members : %s Memberships : %s Calendar Homes : %s Outbox URL : %s Inbox URL : %s Calendar Addresses: %s Address Book Homes: %s """ % ( principal.principalPath, principal.getSmartDisplayName(), principal.principalURL, utils.printList(principal.alternateURIs), utils.printPrincipalPaths(self.shell.account, principal.memberset, resolve, refresh), utils.printPrincipalPaths(self.shell.account, principal.memberships, resolve, refresh), utils.printList(principal.homeset), principal.outboxURL, principal.inboxURL, utils.printList(principal.cuaddrs), utils.printList(principal.adbkhomeset), ), if print_proxies: utils.printProxyPrincipals(self.shell.account, principal, True, True, resolve, False, refresh) print "" return True
def execute(self, cmdname, options): refresh = False resolve = True principal = None print_proxies = False opts, args = getopt.getopt(shlex.split(options), 'fnp:x') for name, value in opts: if name == "-f": refresh = True elif name == "-n": resolve = False elif name == "-p": principal = self.shell.account.getPrincipal(URL(url=value), refresh=refresh) elif name == "-x": print_proxies = True else: print "Unknown option: %s" % (name,) print self.usage(cmdname) raise WrongOptions if len(args) > 0: print "Wrong number of arguments: %d" % (len(args),) print self.usage(cmdname) raise WrongOptions if not principal: principal = self.shell.account.getPrincipal(refresh=refresh) print """ Principal Path : %s Display Name : %s Principal URL : %s Alternate URLs : %s Group Members : %s Memberships : %s Calendar Homes : %s Outbox URL : %s Inbox URL : %s Calendar Addresses: %s Address Book Homes: %s """ % ( principal.principalPath, principal.getSmartDisplayName(), principal.principalURL, utils.printList(principal.alternateURIs), utils.printPrincipalPaths(self.shell.account, principal.memberset, resolve, refresh), utils.printPrincipalPaths(self.shell.account, principal.memberships, resolve, refresh), utils.printList(principal.homeset), principal.outboxURL, principal.inboxURL, utils.printList(principal.cuaddrs), utils.printList(principal.adbkhomeset), ), if print_proxies: utils.printProxyPrincipals(self.shell.account, principal, True, True, resolve, False, refresh) print "" return True