Allow return all attributes
authorJack Miller <jack@codezen.org>
Sat, 13 Sep 2014 19:37:07 +0000 (14:37 -0500)
committerJack Miller <jack@codezen.org>
Sun, 14 Sep 2014 01:07:49 +0000 (20:07 -0500)
When ATTRIBUTES's arg has an id with an empty list of attributes
requested, then return all of the item data.

Good for discovery of items.

canto_next/feed.py

index 3761ca5..c9f51f9 100644 (file)
@@ -187,7 +187,12 @@ class CantoFeed(PluginHandler):
                 if d_id != d_item["id"]:
                     continue
 
-                for a in attributes[item]:
+                if not attributes[item]:
+                    get = list(d_item.keys())
+                else:
+                    get = attributes[item]
+
+                for a in get:
                     if a == "description":
                         real = "summary"
                     else:
@@ -197,6 +202,7 @@ class CantoFeed(PluginHandler):
                         attrs[a] = d_item[real]
                     else:
                         attrs[a] = ""
+
             r[item] = attrs
         return r