Skip to content

Commit

Permalink
Read content type in asset serialisation SkygearIO/skygear-SDK-JS#164
Browse files Browse the repository at this point in the history
  • Loading branch information
b123400 committed Mar 28, 2017
2 parents 2f6dee3 + 8c18e54 commit 69a748b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion skygear/models.py
Expand Up @@ -140,8 +140,9 @@ def __init__(self, user_id, level):


class Asset:
def __init__(self, name):
def __init__(self, name, content_type):
self.name = name
self.content_type = content_type

@property
def name(self):
Expand Down
3 changes: 2 additions & 1 deletion skygear/transmitter/encoding.py
Expand Up @@ -143,7 +143,7 @@ def decode_date_value(self, s):
return datetime.fromtimestamp(ts)

def decode_asset(self, d):
return Asset(d['$name'])
return Asset(d['$name'], d.get('$content_type', None))

def decode_location(self, d):
return Location(d['$lng'], d['$lat'])
Expand Down Expand Up @@ -241,6 +241,7 @@ def encode_asset(self, asset):
return {
'$type': 'asset',
'$name': asset.name,
'$content_type': asset.content_type
}

def encode_location(self, location):
Expand Down

0 comments on commit 69a748b

Please sign in to comment.