piwigo: Add session.getStatus, improve categories.getList
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 21 Mar 2013 08:07:59 +0000 (09:07 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 21 Mar 2013 08:18:07 +0000 (09:18 +0100)
- pwg.session.getStatus returns the current user as
  "fake_user".  When we have a session, we'll return
  something better.

- pwg.categories.getList add a name and the parent id for
  its one and only "collection".

- Improve logging a bit.

mediagoblin/plugins/piwigo/tools.py
mediagoblin/plugins/piwigo/views.py

index e53d94b97c744858451ff23c64e7946116a817a9..85d77310ac93835a9487aa0645922727d5dc5903 100644 (file)
@@ -99,6 +99,7 @@ class CmdTable(object):
         entry = cls._cmd_table.get(cmd_name)
         if not entry:
             return entry
+        _log.debug("Found method %s", cmd_name)
         func, only_post = entry
         if only_post and request.method != "POST":
             _log.warn("Method %s only allowed for POST", cmd_name)
index d0629b73f914c83b3db0ac1be4657d0ad4c1108a..6198ec6e498b8ff34fca9e70f19d143542348fe7 100644 (file)
@@ -32,8 +32,6 @@ def pwg_login(request):
     username = request.form.get("username")
     password = request.form.get("password")
     _log.info("Login for %r/%r...", username, password)
-    _log.warn("login: %s %r %r", request.method,
-                  request.args, request.form)
     return True
 
 
@@ -45,13 +43,19 @@ def pwg_logout(request):
 
 @CmdTable("pwg.getVersion")
 def pwg_getversion(request):
-    _log.info("getversion")
-    return "piwigo 2.5.0"
+    return "piwigo 2.5.0 (MediaGoblin)"
+
+
+@CmdTable("pwg.session.getStatus")
+def pwg_session_getStatus(request):
+    return {'username': "fake_user"}
 
 
 @CmdTable("pwg.categories.getList")
 def pwg_categories_getList(request):
-    catlist = ({'id': -29711},)
+    catlist = ({'id': -29711,
+                'uppercats': "-29711",
+                'name': "All my images"},)
     return {
           'categories': PwgNamedArray(
             catlist,