diff options
-rw-r--r-- | gstudio/xmlrpc/__init__.py | 8 | ||||
-rw-r--r-- | gstudio/xmlrpc/metaweblog.py | 65 |
2 files changed, 17 insertions, 56 deletions
diff --git a/gstudio/xmlrpc/__init__.py b/gstudio/xmlrpc/__init__.py index 9dd4ca22..9b91635d 100644 --- a/gstudio/xmlrpc/__init__.py +++ b/gstudio/xmlrpc/__init__.py @@ -125,9 +125,11 @@ GSTUDIO_XMLRPC_METAWEBLOG = [ ('gstudio.xmlrpc.metaweblog.set_relation', 'metaWeblog.setRelation'), ('gstudio.xmlrpc.metaweblog.get_gbobject_neighbourhood', - 'metaWeblog.getGbobjectNeighbourhood') - -] + 'metaWeblog.getGbobjectNeighbourhood'), + ('gstudio.xmlrpc.metaweblog.list_id', + 'metaWeblog.list_id'), + ('gstudio.xmlrpc.metaweblog.dict_id', + 'metaWeblog.dict_id')] GSTUDIO_XMLRPC_METHODS = GSTUDIO_XMLRPC_PINGBACK + GSTUDIO_XMLRPC_METAWEBLOG diff --git a/gstudio/xmlrpc/metaweblog.py b/gstudio/xmlrpc/metaweblog.py index 6990ca12..a77ab82a 100644 --- a/gstudio/xmlrpc/metaweblog.py +++ b/gstudio/xmlrpc/metaweblog.py @@ -831,58 +831,17 @@ def set_relation(d,obj1,obj2) : s.save() return s.id except Relationtype.DoesNotExist : - return "Relationtype Does Not Exist" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + return "Relationtype Does Not Exist" +@xmlrpc_func(returns='list') +def list_id(): + """Get a list of Gbobjects' ids""" + return [id.id for id in Gbobject.objects.all()] +@xmlrpc_func(returns='struct', args=['string']) +def dict_id(id=None): + """Get a Gbobject as a dict or as a list of dicts""" + if id: + return Gbobject.objects.get(id="{0}".format(id)) + else: + return [dict_id(id) for id in list_id()] |