Skip to content

Commit

Permalink
new unpack of values
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Dec 12, 2017
1 parent fe0dc06 commit 8863e6a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/appier_extras/parts/prismic/partials/_prismic.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,24 @@ def _prismic_deref(cls, entry):
if type == "Text":
return values

if type == "Select":
return values

if type == "Image":
value = values[0] if values else dict()
return value["main"]["url"]
return values["main"]["url"]

if type == "Link.web":
return values["url"]

if type == "Group":
return [
dict(key, cls._prismic_deref(value))
for key, value in appier.legacy.iteritems(value)
for value in values
]
group = []
for value in values:
value_d = dict([
(key, cls._prismic_deref(value))
for key, value in appier.legacy.iteritems(value)
])
group.append(value_d)
return group

return entry

Expand Down

0 comments on commit 8863e6a

Please sign in to comment.