Skip to content

Commit

Permalink
Merge pull request #47 from gcandal/gc/field-dict-cast
Browse files Browse the repository at this point in the history
feat: allow casting fields from strings to dicts
  • Loading branch information
joamag committed Jul 7, 2021
2 parents 16a6dc9 + aa6ee4b commit 9f522d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/appier/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@
CASTERS = {
list : lambda v: [y for y in itertools.chain(*[util.split_unescape(x, ",") for x in v])],
bool : lambda v: v if isinstance(v, bool) else\
not v in ("", "0", "false", "False")
not v in ("", "0", "false", "False"),
dict : lambda v: json.loads(v) if isinstance(v, legacy.UNICODE) else dict(v)
}
""" The map associating the various data types with a proper custom
caster to be used for special data types (more complex) under some
Expand Down

0 comments on commit 9f522d6

Please sign in to comment.