本文整理匯總了Python中mkt.extensions.models.Extension.disabled方法的典型用法代碼示例。如果您正苦於以下問題:Python Extension.disabled方法的具體用法?Python Extension.disabled怎麽用?Python Extension.disabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mkt.extensions.models.Extension
的用法示例。
在下文中一共展示了Extension.disabled方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: fake_object
# 需要導入模塊: from mkt.extensions.models import Extension [as 別名]
# 或者: from mkt.extensions.models.Extension import disabled [as 別名]
def fake_object(self, data):
"""Create a fake instance of Extension from ES data."""
obj = Extension(id=data['id'])
# Create a fake ExtensionVersion for latest_public_version.
if data['latest_public_version']:
obj.latest_public_version = ExtensionVersion(
extension=obj,
id=data['latest_public_version']['id'],
created=data['latest_public_version']['created'],
size=data['latest_public_version'].get('size', 0),
status=STATUS_PUBLIC,
version=data['latest_public_version']['version'],)
# Set basic attributes we'll need on the fake instance using the data
# from ES.
self._attach_fields(
obj, data, ('author', 'created', 'default_language',
'last_updated', 'modified', 'slug', 'status',
'version'))
obj.deleted = data['is_deleted']
obj.disabled = data['is_disabled']
obj.uuid = data['guid']
# Attach translations for all translated attributes.
# obj.default_language should be set first for this to work.
self._attach_translations(
obj, data, ('name', 'description', ))
# Some methods might need the raw data from ES, put it on obj.
obj.es_data = data
return obj