contentful-labs / contentful.py

This project is unofficial and currently unsupported, the official SDK can be found here: https://github.com/contentful/contentful.py
Apache License 2.0
18 stars 6 forks source link

KeyError when asset has no file #15

Open jeremydw opened 8 years ago

jeremydw commented 8 years ago

Seems like if a user presses "Add Asset" but doesn't upload a file, serialization dies with a KeyError on a key named file here:

https://github.com/contentful-labs/contentful.py/blob/master/contentful/cda/serialization.py#L111

This corresponds to when a field in Contentful looks like this (added but not uploaded yet):

image

I think the correct behavior would be to return a resources.Asset but without a url or mimeType property. If this sounds right I can send a PR to update the behavior. Thanks for this library!