当前位置: 首页>>代码示例>>Python>>正文


Python applications.DEVICE_TYPES类代码示例

本文整理汇总了Python中mkt.constants.applications.DEVICE_TYPES的典型用法代码示例。如果您正苦于以下问题:Python DEVICE_TYPES类的具体用法?Python DEVICE_TYPES怎么用?Python DEVICE_TYPES使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DEVICE_TYPES类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: device_list

def device_list(product):
    device_types = product.device_types
    if device_types:
        t = env.get_template('detail/helpers/device_list.html')
        return jinja2.Markup(t.render({
            'device_types': device_types,
            'all_device_types': DEVICE_TYPES.values()}))
开发者ID:kolyaflash,项目名称:zamboni,代码行数:7,代码来源:helpers.py

示例2: app_factory

def app_factory(**kw):
    """
    Create an app. Keyword arguments are passed to addon_factory.

    complete -- fills out app details + creates content ratings.
    rated -- creates content ratings
    """
    complete = kw.pop('complete', False)
    rated = kw.pop('rated', False)
    if complete:
        kw.setdefault('support_email', '[email protected]')

    kw.update(type=amo.ADDON_WEBAPP)
    app = amo.tests.addon_factory(**kw)

    if rated or complete:
        make_rated(app)

    if complete:
        if not app.categories:
            app.update(categories=['utilities'])
        app.addondevicetype_set.create(device_type=DEVICE_TYPES.keys()[0])
        app.previews.create()

    return app
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:25,代码来源:__init__.py

示例3: _step

    def _step(self):
        self.user.update(read_dev_agreement=datetime.datetime.now())
        self.cl = AppSubmissionChecklist.objects.create(addon=self.webapp, terms=True, manifest=True)

        # Associate app with user.
        AddonUser.objects.create(addon=self.webapp, user=self.user)

        # Associate device type with app.
        self.dtype = DEVICE_TYPES.values()[0]
        AddonDeviceType.objects.create(addon=self.webapp, device_type=self.dtype.id)
        self.device_types = [self.dtype]

        # Associate category with app.
        self.webapp.update(categories=[self.cat1])
开发者ID:jostw,项目名称:zamboni,代码行数:14,代码来源:test_views.py

示例4: setUp

    def setUp(self):
        super(TestVersionPackaged, self).setUp()
        self.login('[email protected]')
        self.app.update(is_packaged=True)
        self.app = self.get_app()
        # Needed for various status checking routines on fully complete apps.
        make_rated(self.app)
        if not self.app.categories:
            self.app.update(categories=['utilities'])
        self.app.addondevicetype_set.create(device_type=DEVICE_TYPES.keys()[0])
        self.app.previews.create()

        self.url = self.app.get_dev_url('versions')
        self.delete_url = self.app.get_dev_url('versions.delete')
开发者ID:pkdevboxy,项目名称:zamboni,代码行数:14,代码来源:test_views_versions.py

示例5: website_factory

def website_factory(**kwargs):
    text = rand_text()
    data = {
        'description': 'Description for %s' % text.capitalize(),
        'name': text.capitalize(),
        'short_name': text[:10].capitalize(),
        'status': STATUS_PUBLIC,
        'title': 'Title for %s' % text.capitalize(),
        'url': 'http://%s.example.com' % text,
        'mobile_url': 'http://mobile.%s.example.com' % text,
        'devices': DEVICE_TYPES.keys(),
    }
    data.update(kwargs)
    return Website.objects.create(**data)
开发者ID:Jobava,项目名称:zamboni,代码行数:14,代码来源:utils.py

示例6: test_additional_info

    def test_additional_info(self):
        """
        One of the ways `additional_info` is used it to pass the device type of
        the request and filter apps by device.
        """
        # By default app_factory creates apps with device being
        # DEVICE_TYPES.keys()[0]. Let's change a couple and query by that
        # device.
        device = DEVICE_TYPES.keys()[1]
        self.apps[0].addondevicetype_set.create(device_type=device)
        self.apps[1].addondevicetype_set.create(device_type=device)
        # Reindex b/c we changed an off-model attribute.
        self.reindex(Webapp, 'webapp')

        sq = WebappIndexer.get_app_filter(self.request, {'device': device},
                                          app_ids=self.app_ids)
        results = sq.execute().hits
        eq_(len(results), 2)
开发者ID:j-barron,项目名称:zamboni,代码行数:18,代码来源:test_indexers.py

示例7: test_extract_device

    def test_extract_device(self):
        device = DEVICE_TYPES.keys()[0]
        AddonDeviceType.objects.create(addon=self.app, device_type=device)

        obj, doc = self._get_doc()
        eq_(doc['device'], [device])
开发者ID:MaxMillion,项目名称:zamboni,代码行数:6,代码来源:test_indexers.py

示例8: app_factory

def app_factory(status=mkt.STATUS_PUBLIC, version_kw={}, file_kw={}, **kw):
    """
    Create an app.

    complete -- fills out app details + creates content ratings.
    rated -- creates content ratings

    """
    from mkt.webapps.models import update_search_index, Webapp
    # Disconnect signals until the last save.
    post_save.disconnect(update_search_index, sender=Webapp,
                         dispatch_uid='webapp.search.index')

    complete = kw.pop('complete', False)
    rated = kw.pop('rated', False)
    if complete:
        kw.setdefault('support_email', '[email protected]')
    when = _get_created(kw.pop('created', None))

    # Keep as much unique data as possible in the uuid: '-' aren't important.
    name = kw.pop('name',
                  u'Webapp %s' % unicode(uuid.uuid4()).replace('-', ''))

    kwargs = {
        # Set artificially the status to STATUS_PUBLIC for now, the real
        # status will be set a few lines below, after the update_version()
        # call. This prevents issues when calling app_factory with
        # STATUS_DELETED.
        'status': mkt.STATUS_PUBLIC,
        'name': name,
        'app_slug': name.replace(' ', '-').lower()[:30],
        'bayesian_rating': random.uniform(1, 5),
        'created': when,
        'last_updated': when,
    }
    kwargs.update(kw)

    # Save 1.
    app = Webapp.objects.create(**kwargs)
    version = version_factory(file_kw, addon=app, **version_kw)  # Save 2.
    app.status = status
    app.update_version()

    # Put signals back.
    post_save.connect(update_search_index, sender=Webapp,
                      dispatch_uid='webapp.search.index')

    app.save()  # Save 4.

    if 'nomination' in version_kw:
        # If a nomination date was set on the version, then it might have been
        # erased at post_save by addons.models.watch_status() or
        # mkt.webapps.models.watch_status().
        version.save()

    if rated or complete:
        make_rated(app)

    if complete:
        if not app.categories:
            app.update(categories=['utilities'])
        app.addondevicetype_set.create(device_type=DEVICE_TYPES.keys()[0])
        app.previews.create()

    return app
开发者ID:clouserw,项目名称:zamboni,代码行数:65,代码来源:utils.py


注:本文中的mkt.constants.applications.DEVICE_TYPES类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。