next/previous fields are lists in APIv2, but single photo ids in APIv1.
This commit is contained in:
parent
fc234096f2
commit
7501c8ca77
1 changed files with 10 additions and 0 deletions
|
@ -87,13 +87,23 @@ class Photo(OpenPhotoObject):
|
|||
**kwds)["result"]
|
||||
value = {}
|
||||
if "next" in result:
|
||||
# Workaround for APIv1
|
||||
if not isinstance(result["next"], list):
|
||||
result["next"] = [result["next"]]
|
||||
|
||||
value["next"] = []
|
||||
for photo in result["next"]:
|
||||
value["next"].append(Photo(self._openphoto, photo))
|
||||
|
||||
if "previous" in result:
|
||||
# Workaround for APIv1
|
||||
if not isinstance(result["previous"], list):
|
||||
result["previous"] = [result["previous"]]
|
||||
|
||||
value["previous"] = []
|
||||
for photo in result["previous"]:
|
||||
value["previous"].append(Photo(self._openphoto, photo))
|
||||
|
||||
return value
|
||||
|
||||
def transform(self, **kwds):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue