diff options
author | Nikita Karetnikov <nikita.karetnikov@gmail.com> | 2012-06-10 05:13:34 +0400 |
---|---|---|
committer | Nikita Karetnikov <nikita.karetnikov@gmail.com> | 2012-06-10 05:13:34 +0400 |
commit | e494a5a9b45f14b971eeb3a4cea32601e79c5cfe (patch) | |
tree | 8f5f61a84bbc12e350fdf05ebd93caf45e25bbb8 /gstudio/xmlrpc | |
parent | 7abcbe2b92065094d07d096b01bba368ed956c69 (diff) | |
download | gnowsys-e494a5a9b45f14b971eeb3a4cea32601e79c5cfe.tar.gz |
Sync-related methods for Gbobjects
Diffstat (limited to 'gstudio/xmlrpc')
-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 9dd4ca2..9b91635 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 6990ca1..a77ab82 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()] |