def execute(self, objname, methodname, **options): objects = dict() methods = dict() commands = dict() empty = True try: if not objname: objname = options['object'] if objname in self.api.Object: o = self.api.Object[objname] objects = dict([(o.name, json_serialize(o))]) elif objname == "all": objects = dict( (o.name, json_serialize(o)) for o in self.api.Object()) empty = False except KeyError: pass try: if not methodname: methodname = options['method'] if methodname in self.api.Method: m = self.api.Method[methodname] methods = dict([(m.name, json_serialize(m))]) elif methodname == "all": methods = dict( (m.name, json_serialize(m)) for m in self.api.Method()) empty = False except KeyError: pass try: cmdname = options['command'] if cmdname in self.api.Command: c = self.api.Command[cmdname] commands = dict([(c.name, json_serialize(c))]) elif cmdname == "all": commands = dict( (c.name, json_serialize(c)) for c in self.api.Command()) empty = False except KeyError: pass if empty: objects = dict( (o.name, json_serialize(o)) for o in self.api.Object()) methods = dict( (m.name, json_serialize(m)) for m in self.api.Method()) commands = dict( (c.name, json_serialize(c)) for c in self.api.Command()) retval = dict([ ("objects", objects), ("methods", methods), ("commands", commands), ]) return retval
def __json__(self): json_dict = dict( (a, json_serialize(getattr(self, a))) for a in self.json_friendly_attributes ) if self.primary_key: json_dict['primary_key'] = self.primary_key.name json_dict['methods'] = [m for m in self.methods] return json_dict
def execute(self, **options): return dict(texts=json_serialize(self.messages))
def execute(self, objname, methodname, **options): objects = dict() methods = dict() commands = dict() empty = True try: if not objname: objname = options['object'] if objname in self.api.Object: o = self.api.Object[objname] objects = dict([(o.name, json_serialize(o))]) elif objname == "all": objects = dict( (o.name, json_serialize(o)) for o in self.api.Object() ) empty = False except KeyError: pass try: if not methodname: methodname = options['method'] if methodname in self.api.Method: m = self.api.Method[methodname] methods = dict([(m.name, json_serialize(m))]) elif methodname == "all": methods = dict( (m.name, json_serialize(m)) for m in self.api.Method() ) empty = False except KeyError: pass try: cmdname = options['command'] if cmdname in self.api.Command: c = self.api.Command[cmdname] commands = dict([(c.name, json_serialize(c))]) elif cmdname == "all": commands = dict( (c.name, json_serialize(c)) for c in self.api.Command() ) empty = False except KeyError: pass if empty: objects = dict( (o.name, json_serialize(o)) for o in self.api.Object() ) methods = dict( (m.name, json_serialize(m)) for m in self.api.Method() ) commands = dict( (c.name, json_serialize(c)) for c in self.api.Command() ) retval = dict([ ("objects", objects), ("methods", methods), ("commands", commands), ]) return retval
def execute(self): return dict([("messages", json_serialize(self.messages))])
def execute(self): return dict([("messages",json_serialize(self.messages))])