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"]
|
**kwds)["result"]
|
||||||
value = {}
|
value = {}
|
||||||
if "next" in result:
|
if "next" in result:
|
||||||
|
# Workaround for APIv1
|
||||||
|
if not isinstance(result["next"], list):
|
||||||
|
result["next"] = [result["next"]]
|
||||||
|
|
||||||
value["next"] = []
|
value["next"] = []
|
||||||
for photo in result["next"]:
|
for photo in result["next"]:
|
||||||
value["next"].append(Photo(self._openphoto, photo))
|
value["next"].append(Photo(self._openphoto, photo))
|
||||||
|
|
||||||
if "previous" in result:
|
if "previous" in result:
|
||||||
|
# Workaround for APIv1
|
||||||
|
if not isinstance(result["previous"], list):
|
||||||
|
result["previous"] = [result["previous"]]
|
||||||
|
|
||||||
value["previous"] = []
|
value["previous"] = []
|
||||||
for photo in result["previous"]:
|
for photo in result["previous"]:
|
||||||
value["previous"].append(Photo(self._openphoto, photo))
|
value["previous"].append(Photo(self._openphoto, photo))
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def transform(self, **kwds):
|
def transform(self, **kwds):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue