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

Python forms.verify_app_domain函数代码示例

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

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



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

示例1: clean

    def clean(self):
        data = self.cleaned_data
        if 'upload' not in self.cleaned_data:
            self._errors['upload'] = self.upload_error
            return

        if self.is_packaged():
            # Now run the packaged app check, done in clean, because
            # clean_packaged needs to be processed first.

            try:
                pkg = parse_addon(data['upload'], self.addon)
            except forms.ValidationError, e:
                self._errors['upload'] = self.error_class(e.messages)
                return

            # Collect validation errors so we can display them at once.
            errors = []

            ver = pkg.get('version')
            if (ver and self.addon and
                self.addon.versions.filter(version=ver).exists()):
                errors.append(_(u'Version %s already exists.') % ver)

            origin = pkg.get('origin')
            if origin:
                try:
                    verify_app_domain(origin, packaged=True,
                                      exclude=self.addon)
                except forms.ValidationError, e:
                    errors.append(e.message)

                if self.addon and origin != self.addon.app_domain:
                    errors.append(_('Changes to "origin" are not allowed.'))
开发者ID:andymckay,项目名称:zamboni,代码行数:34,代码来源:forms.py


示例2: clean_upload

 def clean_upload(self):
     upload = self.cleaned_data['upload']
     if self.is_packaged:
         pkg = parse_addon(upload, self.addon)
         ver = pkg.get('version')
         if (ver and self.addon and
             self.addon.versions.filter(version=ver).exists()):
             raise forms.ValidationError(
                 _(u'Version %s already exists') % ver)
     else:
         # Throw an error if this is a dupe.
         verify_app_domain(upload.name)  # JS sets manifest as `upload.name`.
     return upload
开发者ID:Sancus,项目名称:zamboni,代码行数:13,代码来源:forms.py


示例3: clean

    def clean(self):
        data = self.cleaned_data
        if 'upload' not in self.cleaned_data:
            self._errors['upload'] = self.upload_error
            return

        if self.is_packaged():
            # Now run the packaged app check, done in clean, because
            # clean_packaged needs to be processed first.
            try:
                pkg = parse_addon(data['upload'], self.addon)
            except forms.ValidationError, e:
                self._errors['upload'] = self.error_class(e.messages)
                return

            ver = pkg.get('version')
            if (ver and self.addon and
                self.addon.versions.filter(version=ver).exists()):
                self._errors['upload'] = _(u'Version %s already exists') % ver
                return

            origin = pkg.get('origin')
            if origin:
                try:
                    origin = verify_app_domain(origin, packaged=True,
                                               exclude=self.addon)
                except forms.ValidationError, e:
                    self._errors['upload'] = self.error_class(e.messages)
                    return
                if origin:
                    data['origin'] = origin
开发者ID:kylewu,项目名称:zamboni,代码行数:31,代码来源:forms.py


示例4: verify_app_domain

                                      exclude=self.addon)
                except forms.ValidationError, e:
                    errors.append(e.message)

                if self.addon and origin != self.addon.app_domain:
                    errors.append(_('Changes to "origin" are not allowed.'))

            if errors:
                self._errors['upload'] = self.error_class(errors)
                return

        else:
            # Throw an error if this is a dupe.
            # (JS sets manifest as `upload.name`.)
            try:
                verify_app_domain(data['upload'].name)
            except forms.ValidationError, e:
                self._errors['upload'] = self.error_class(e.messages)
                return

        return data

    def is_packaged(self):
        return self._is_packaged


class NewWebappForm(DeviceTypeForm, NewWebappVersionForm):
    upload = forms.ModelChoiceField(widget=forms.HiddenInput,
        queryset=FileUpload.objects.filter(valid=True),
        error_messages={'invalid_choice': _lazy(
            u'There was an error with your upload. Please try again.')})
开发者ID:andymckay,项目名称:zamboni,代码行数:31,代码来源:forms.py


示例5: clean_upload

 def clean_upload(self):
     upload = self.cleaned_data['upload']
     # Throw an error if this is a dupe.
     verify_app_domain(upload.name)  # JS sets manifest as `upload.name`.
     return upload
开发者ID:beenishkhan,项目名称:zamboni,代码行数:5,代码来源:forms.py


示例6: clean_upload

 def clean_upload(self):
     upload = self.cleaned_data['upload']
     verify_app_domain(upload.name)  # JS puts manifest URL here.
     return upload
开发者ID:pjajara,项目名称:zamboni,代码行数:4,代码来源:forms.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python forms.APIConsumerForm类代码示例发布时间:2022-05-27
下一篇:
Python forms.trap_duplicate函数代码示例发布时间: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