Add data to appResource (bug 838916) #693

Merged
merged 1 commit into from Mar 28, 2013

Conversation

Projects
None yet
2 participants
Member

muffinresearch commented Mar 26, 2013

Exposes additional data from API as per https://bugzilla.mozilla.org/show_bug.cgi?id=838916

@muffinresearch muffinresearch commented on the diff Mar 28, 2013

mkt/webapps/utils.py
@@ -11,3 +15,48 @@ def get_locale_properties(manifest, property, default_locale=None):
locale_dict[default] = root_property
return locale_dict
+
+
+def app_to_dict(app, user=None):
+ """Return app data as dict for API."""
+ cv = app.current_version
+ version_data = {
+ 'version': getattr(cv, 'version', None),
+ 'release_notes': getattr(cv, 'releasenotes', None)
+ }
+
+ data = {
+ 'app_slug': app.app_slug,
+ 'app_type': app.app_type,
+ 'categories': list(app.categories.values_list('pk', flat=True)),
@muffinresearch

muffinresearch Mar 28, 2013

Member

@andymckay: I'm not sure if this is much of an improvement?

@muffinresearch muffinresearch added a commit that referenced this pull request Mar 28, 2013

@muffinresearch muffinresearch Merge pull request #693 from muffinresearch/update-appresource-838916
Add data to appResource (bug 838916)
e38c1ae

@muffinresearch muffinresearch merged commit e38c1ae into mozilla:master Mar 28, 2013

could we be using fixtures here instead of creating new app objects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment