本文整理汇总了Python中mkt.webapps.models.Webapp.tags_list方法的典型用法代码示例。如果您正苦于以下问题:Python Webapp.tags_list方法的具体用法?Python Webapp.tags_list怎么用?Python Webapp.tags_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.webapps.models.Webapp
的用法示例。
在下文中一共展示了Webapp.tags_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fake_object
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import tags_list [as 别名]
def fake_object(self, data):
"""Create a fake instance of Webapp and related models from ES data."""
is_packaged = data['app_type'] != mkt.ADDON_WEBAPP_HOSTED
is_privileged = data['app_type'] == mkt.ADDON_WEBAPP_PRIVILEGED
obj = Webapp(id=data['id'], app_slug=data['app_slug'],
is_packaged=is_packaged, icon_type='image/png')
# Set relations and attributes we need on those relations.
# The properties set on latest_version and current_version differ
# because we are only setting what the serializer is going to need.
# In particular, latest_version.is_privileged needs to be set because
# it's used by obj.app_type_id.
obj.listed_authors = []
obj._current_version = Version()
obj._current_version.addon = obj
obj._current_version._developer_name = data['author']
obj._current_version.supported_locales = data['supported_locales']
obj._current_version.version = data['current_version']
obj._latest_version = Version()
obj._latest_version.is_privileged = is_privileged
obj._geodata = Geodata()
obj.all_previews = [
Preview(id=p['id'], modified=self.to_datetime(p['modified']),
filetype=p['filetype'], sizes=p.get('sizes', {}))
for p in data['previews']]
obj.categories = data['category']
obj.tags_list = data['tags']
obj._device_types = [DEVICE_TYPES[d] for d in data['device']]
obj._is_disabled = data['is_disabled']
# Set base attributes on the "fake" app using the data from ES.
self._attach_fields(
obj, data, ('created', 'default_locale', 'guid', 'icon_hash',
'is_escalated', 'is_offline', 'last_updated',
'manifest_url', 'modified', 'premium_type', 'regions',
'reviewed', 'status'))
# Attach translations for all translated attributes.
self._attach_translations(
obj, data, ('name', 'description', 'homepage',
'support_email', 'support_url'))
if data.get('group_translations'):
self._attach_translations(obj, data, ('group',)) # Feed group.
else:
obj.group_translations = None
self._attach_translations(obj._geodata, data, ('banner_message',))
# Release notes target and source name differ (ES stores it as
# release_notes but the db field we are emulating is called
# releasenotes without the "_").
ESTranslationSerializerField.attach_translations(
obj._current_version, data, 'release_notes',
target_name='releasenotes')
# Set attributes that have a different name in ES.
obj.public_stats = data['has_public_stats']
# Override obj.get_excluded_region_ids() to just return the list of
# regions stored in ES instead of making SQL queries.
obj.get_excluded_region_ids = lambda: data['region_exclusions']
# Set up payments stuff to avoid extra queries later (we'll still make
# some, because price info is not in ES).
if obj.is_premium():
Webapp.attach_premiums([obj])
# Some methods below will need the raw data from ES, put it on obj.
obj.es_data = data
return obj