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


Python forms.verify_app_domain函数代码示例

本文整理汇总了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;未经允许,请勿转载。