• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python index_webapps.delay函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: save

    def save(self, addon, commit=True):
        if (self.cleaned_data.get('DELETE') and
                'upload_hash' not in self.changed_data and self.promo.id):
            self.promo.delete()
        elif self.promo and 'upload_hash' in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get('upload_hash'):
            super(AdminSettingsForm, self).save(addon, True)

        updates = {
            'vip_app': self.cleaned_data.get('vip_app'),
            'priority_review': self.cleaned_data.get('priority_review'),
        }
        contact = self.cleaned_data.get('mozilla_contact')
        if contact is not None:
            updates['mozilla_contact'] = contact
        addon.update(**updates)

        geodata = addon.geodata
        geodata.banner_regions = self.cleaned_data.get('banner_regions')
        geodata.banner_message = self.cleaned_data.get('banner_message')
        geodata.save()

        uses_flash = self.cleaned_data.get('flash')
        af = addon.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        index_webapps.delay([addon.id])

        return addon
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:31,代码来源:forms.py


示例2: save

    def save(self, addon, commit=True):
        if (self.cleaned_data.get('DELETE') and
                'upload_hash' not in self.changed_data and self.promo.id):
            self.promo.delete()
        elif self.promo and 'upload_hash' in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get('upload_hash'):
            super(AdminSettingsForm, self).save(addon, True)

        updates = {
            'vip_app': self.cleaned_data.get('vip_app'),
        }
        contact = self.cleaned_data.get('mozilla_contact')
        if contact is not None:
            updates['mozilla_contact'] = contact
        if (self.cleaned_data.get('priority_review') and
                not addon.priority_review):
            # addon.priority_review gets updated within prioritize_app().
            prioritize_app(addon, self.request.user)
        else:
            updates['priority_review'] = self.cleaned_data.get(
                'priority_review')
        addon.update(**updates)
        index_webapps.delay([addon.id])

        return addon
开发者ID:ujdhesa,项目名称:zamboni,代码行数:26,代码来源:forms.py


示例3: handle

    def handle(self, *args, **kw):
        apps = kw.get('apps')
        if not apps:
            raise CommandError('The --apps option is required.')

        ids = [int(a.strip()) for a in apps.split(',')]
        index_webapps.delay(ids)
开发者ID:AALEKH,项目名称:zamboni,代码行数:7,代码来源:reindex_app.py


示例4: save

    def save(self, addon, commit=True):
        if self.cleaned_data.get("DELETE") and "upload_hash" not in self.changed_data and self.promo.id:
            self.promo.delete()
        elif self.promo and "upload_hash" in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get("upload_hash"):
            super(AdminSettingsForm, self).save(addon, True)

        updates = {
            "vip_app": self.cleaned_data.get("vip_app"),
            "priority_review": self.cleaned_data.get("priority_review"),
        }
        contact = self.cleaned_data.get("mozilla_contact")
        if contact is not None:
            updates["mozilla_contact"] = contact
        addon.update(**updates)

        geodata = addon.geodata
        geodata.banner_regions = self.cleaned_data.get("banner_regions")
        geodata.banner_message = self.cleaned_data.get("banner_message")
        geodata.save()

        uses_flash = self.cleaned_data.get("flash")
        af = addon.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        index_webapps.delay([addon.id])

        return addon
开发者ID:Hitechverma,项目名称:zamboni,代码行数:30,代码来源:forms.py


示例5: save

    def save(self, addon, commit=True):
        if (self.cleaned_data.get('DELETE') and
            'upload_hash' not in self.changed_data and self.promo.id):
            self.promo.delete()
        elif self.promo and 'upload_hash' in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get('upload_hash'):
            super(AdminSettingsForm, self).save(addon, True)

        contact = self.cleaned_data.get('mozilla_contact')
        if contact:
            addon.update(mozilla_contact=contact)

        tags = self.cleaned_data.get('tags')
        if tags:
            tags_new = self.cleaned_data['tags']
            tags_old = [slugify(t, spaces=True) for t in self.get_tags(addon)]

            add_tags = set(tags_new) - set(tags_old)
            del_tags = set(tags_old) - set(tags_new)

            # Add new tags.
            for t in add_tags:
                Tag(tag_text=t).save_tag(addon)

            # Remove old tags.
            for t in del_tags:
                Tag(tag_text=t).remove_tag(addon)

        # Content ratings.
        ratings = self.cleaned_data.get('app_ratings')
        if ratings:
            ratings = [ALL_RATINGS()[int(i)] for i in ratings]

            # Delete content ratings with ratings body not in new set.
            r_bodies = set([rating.ratingsbody.id for rating in ratings])
            addon.content_ratings.exclude(ratings_body__in=r_bodies).delete()

            # Set content ratings, takes {<ratingsbody class>: <rating class>}.
            addon.set_content_ratings(
                dict((rating.ratingsbody, rating) for rating in ratings))
        else:
            addon.content_ratings.all().delete()

        geodata = addon.geodata
        geodata.banner_regions = self.cleaned_data.get('banner_regions')
        geodata.banner_message = self.cleaned_data.get('banner_message')
        geodata.save()

        toggle_game(addon)
        uses_flash = self.cleaned_data.get('flash')
        af = addon.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        index_webapps.delay([addon.id])

        return addon
开发者ID:aricha,项目名称:zamboni,代码行数:58,代码来源:forms.py


示例6: set_apps

 def set_apps(self, new_apps):
     """
     Passed a list of app IDs, will remove all existing members on the
     collection and create new ones for each of the passed apps, in order.
     """
     self.remove_apps()
     for app_id in new_apps:
         self.add_app(Webapp.objects.get(pk=app_id))
     index_webapps.delay(new_apps)
开发者ID:Witia1,项目名称:zamboni,代码行数:9,代码来源:models.py


示例7: save

    def save(self, addon, commit=True):
        if (self.cleaned_data.get('DELETE') and
            'upload_hash' not in self.changed_data and self.promo.id):
            self.promo.delete()
        elif self.promo and 'upload_hash' in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get('upload_hash'):
            super(AdminSettingsForm, self).save(addon, True)

        contact = self.cleaned_data.get('mozilla_contact')
        if contact:
            addon.update(mozilla_contact=contact)

        tags = self.cleaned_data.get('tags')
        if tags:
            tags_new = self.cleaned_data['tags']
            tags_old = [slugify(t, spaces=True) for t in self.get_tags(addon)]

            add_tags = set(tags_new) - set(tags_old)
            del_tags = set(tags_old) - set(tags_new)

            # Add new tags.
            for t in add_tags:
                Tag(tag_text=t).save_tag(addon)

            # Remove old tags.
            for t in del_tags:
                Tag(tag_text=t).remove_tag(addon)

        ratings = self.cleaned_data.get('app_ratings')
        if ratings:
            before = set(addon.content_ratings.filter(rating__in=ratings)
                         .values_list('rating', flat=True))
            after = set(int(r) for r in ratings)
            addon.content_ratings.exclude(rating__in=after).delete()
            new_ratings = after - before
            for i in new_ratings:
                rb = ALL_RATINGS()[i]
                addon.content_ratings.create(rating=rb.id,
                    ratings_body=rb.ratingsbody.id)
        else:
            addon.content_ratings.all().delete()

        geodata = addon.geodata
        geodata.banner_regions = self.cleaned_data.get('banner_regions')
        geodata.banner_message = self.cleaned_data.get('banner_message')
        geodata.save()

        toggle_game(addon)
        uses_flash = self.cleaned_data.get('flash')
        af = addon.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        index_webapps.delay([addon.id])

        return addon
开发者ID:hardikj,项目名称:zamboni,代码行数:57,代码来源:forms.py


示例8: remove_app

 def remove_app(self, app):
     """
     Remove the passed app from this collection, returning a boolean
     indicating whether a successful deletion took place.
     """
     try:
         membership = self.membership_class.objects.get(obj=self, app=app)
     except self.membership_class.DoesNotExist:
         return False
     else:
         membership.delete()
         index_webapps.delay([app.pk])
         return True
开发者ID:kylewu,项目名称:zamboni,代码行数:13,代码来源:models.py


示例9: reorder

    def reorder(self, new_order):
        """
        Passed a list of app IDs, e.g.

        [18, 24, 9]

        will change the order of each item in the collection to match the
        passed order. A ValueError will be raised if each app in the
        collection is not included in the ditionary.
        """
        if set(a.pk for a in self.apps()) != set(new_order):
            raise ValueError("Not all apps included")
        for order, pk in enumerate(new_order):
            CollectionMembership.objects.get(collection=self, app_id=pk).update(order=order)
        index_webapps.delay(new_order)
开发者ID:rajuch,项目名称:zamboni,代码行数:15,代码来源:models.py


示例10: add_app

 def add_app(self, app, order=None):
     """
     Add an app to this collection. If specified, the app will be created
     with the specified `order`. If not, it will be added to the end of the
     collection.
     """
     qs = CollectionMembership.objects.filter(collection=self)
     if order is None:
         aggregate = qs.aggregate(models.Max("order"))["order__max"]
         order = aggregate + 1 if aggregate is not None else 0
     rval = CollectionMembership.objects.create(collection=self, app=app, order=order)
     # Help django-cache-machine: it doesn't like many 2 many relations,
     # the cache is never invalidated properly when adding a new object.
     CollectionMembership.objects.invalidate(*qs)
     index_webapps.delay([app.pk])
     return rval
开发者ID:rajuch,项目名称:zamboni,代码行数:16,代码来源:models.py


示例11: add_app

    def add_app(self, app, order=None):
        """
        Add an app to this collection. If specified, the app will be created
        with the specified `order`. If not, it will be added to the end of the
        collection.
        """
        qs = self.membership_class.objects.filter(obj=self)

        if order is None:
            aggregate = qs.aggregate(models.Max('order'))['order__max']
            order = aggregate + 1 if aggregate is not None else 0

        rval = self.membership_class.objects.create(obj=self, app=app,
                                                    order=order)
        index_webapps.delay([app.pk])
        return rval
开发者ID:Witia1,项目名称:zamboni,代码行数:16,代码来源:models.py


示例12: reorder

    def reorder(self, new_order):
        """
        Passed a list of app IDs, e.g.

        [18, 24, 9]

        will change the order of each item in the collection to match the
        passed order. A ValueError will be raised if each app in the
        collection is not included in the ditionary.
        """
        existing_pks = self.apps().no_cache().values_list('pk', flat=True)
        if set(existing_pks) != set(new_order):
            raise ValueError('Not all apps included')
        for order, pk in enumerate(new_order):
            CollectionMembership.objects.get(collection=self,
                                             app_id=pk).update(order=order)
        index_webapps.delay(new_order)
开发者ID:anushbmx,项目名称:zamboni,代码行数:17,代码来源:models.py


示例13: save

    def save(self, addon, commit=True):
        if (self.cleaned_data.get('DELETE') and
            'upload_hash' not in self.changed_data and self.promo.id):
            self.promo.delete()
        elif self.promo and 'upload_hash' in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get('upload_hash'):
            super(AdminSettingsForm, self).save(addon, True)

        updates = {
            'vip_app': self.cleaned_data.get('vip_app'),
            'priority_review': self.cleaned_data.get('priority_review'),
        }
        contact = self.cleaned_data.get('mozilla_contact')
        if contact is not None:
            updates['mozilla_contact'] = contact
        addon.update(**updates)

        tags_new = self.cleaned_data['tags']
        tags_old = [slugify(t, spaces=True) for t in self.get_tags(addon)]

        add_tags = set(tags_new) - set(tags_old)
        del_tags = set(tags_old) - set(tags_new)

        # Add new tags.
        for t in add_tags:
            Tag(tag_text=t).save_tag(addon)

        # Remove old tags.
        for t in del_tags:
            Tag(tag_text=t).remove_tag(addon)

        geodata = addon.geodata
        geodata.banner_regions = self.cleaned_data.get('banner_regions')
        geodata.banner_message = self.cleaned_data.get('banner_message')
        geodata.save()

        uses_flash = self.cleaned_data.get('flash')
        af = addon.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        index_webapps.delay([addon.id])

        return addon
开发者ID:MorrisJobke,项目名称:zamboni,代码行数:45,代码来源:forms.py


示例14: save

    def save(self, addon, commit=True):
        if self.cleaned_data.get("DELETE") and "upload_hash" not in self.changed_data and self.promo.id:
            self.promo.delete()
        elif self.promo and "upload_hash" in self.changed_data:
            self.promo.delete()
        elif self.cleaned_data.get("upload_hash"):
            super(AdminSettingsForm, self).save(addon, True)

        updates = {
            "vip_app": self.cleaned_data.get("vip_app"),
            "priority_review": self.cleaned_data.get("priority_review"),
        }
        contact = self.cleaned_data.get("mozilla_contact")
        if contact is not None:
            updates["mozilla_contact"] = contact
        addon.update(**updates)

        tags_new = self.cleaned_data["tags"]
        tags_old = [slugify(t, spaces=True) for t in self.get_tags(addon)]

        add_tags = set(tags_new) - set(tags_old)
        del_tags = set(tags_old) - set(tags_new)

        # Add new tags.
        for t in add_tags:
            Tag(tag_text=t).save_tag(addon)

        # Remove old tags.
        for t in del_tags:
            Tag(tag_text=t).remove_tag(addon)

        geodata = addon.geodata
        geodata.banner_regions = self.cleaned_data.get("banner_regions")
        geodata.banner_message = self.cleaned_data.get("banner_message")
        geodata.save()

        uses_flash = self.cleaned_data.get("flash")
        af = addon.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        index_webapps.delay([addon.id])

        return addon
开发者ID:gurumukhi,项目名称:zamboni,代码行数:44,代码来源:forms.py


示例15: add_app_grouped

    def add_app_grouped(self, app, group, order=None):
        """
        Add an app to this collection, as a member of the passed `group`.

        If specified, the app will be created with the specified `order`. If
        not, it will be added to the end of the collection.
        """
        qs = self.membership_class.objects.filter(obj=self)
        if order is None:
            aggregate = qs.aggregate(models.Max('order'))['order__max']
            order = aggregate + 1 if aggregate is not None else 0

        rval = self.membership_class.objects.create(obj_id=self.id, app_id=app,
                                                    group=group, order=order)

        # Help django-cache-machine: it doesn't like many 2 many relations,
        # the cache is never invalidated properly when adding a new object.
        self.membership_class.objects.invalidate(*qs)
        index_webapps.delay([app])
        return rval
开发者ID:j-barron,项目名称:zamboni,代码行数:20,代码来源:models.py


示例16: update_price_currency

def update_price_currency(sender, instance, **kw):
    """
    Ensure that when PriceCurrencies are updated, all the apps that use them
    are re-indexed into ES so that the region information will be correct.
    """
    if kw.get('raw'):
        return

    try:
        ids = list(instance.tier.addonpremium_set
                           .values_list('addon_id', flat=True))
    except Price.DoesNotExist:
        return

    if ids:
        log.info('Indexing {0} add-ons due to PriceCurrency changes'
                 .format(len(ids)))

        # Circular import sad face.
        from mkt.webapps.tasks import index_webapps
        index_webapps.delay(ids)
开发者ID:clouserw,项目名称:zamboni,代码行数:21,代码来源:models.py


示例17: handle

    def handle(self, *args, **kwargs):
        index = WebappIndexer.get_index()
        doctype = WebappIndexer.get_mapping_type_name()
        es = WebappIndexer.get_es()

        apps = Webapp.objects.values_list('id', flat=True)

        missing_ids = []

        for app in apps:
            try:
                res = es.get(index, doctype, app, fields='id')
            except ElasticHttpNotFoundError:
                # App doesn't exist in our index, add it to `missing_ids`.
                missing_ids.append(app)

        if missing_ids:
            sys.stdout.write('Adding %s doc(s) to the index.'
                             % len(missing_ids))
            index_webapps.delay(missing_ids)
        else:
            sys.stdout.write('No docs missing from index.')
开发者ID:AALEKH,项目名称:zamboni,代码行数:22,代码来源:fixup_mkt_index.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pre_generate_apk.delay函数代码示例发布时间:2022-05-27
下一篇:
Python tasks.update_manifests函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap