Ejemplo n.º 1
0
 def clean_package_name(self):
     slug = self.cleaned_data['package_name']
     slug_validator(slug, lower=False)
     if Addon.objects.filter(slug=slug).exists():
         raise forms.ValidationError(_('This slug is already in use.'))
     if BlacklistedSlug.blocked(slug):
         raise forms.ValidationError(_('The slug cannot be: %s.' % slug))
     return slug
Ejemplo n.º 2
0
 def clean_package_name(self):
     slug = self.cleaned_data["package_name"]
     if slugify(slug, ok="_", lower=False, delimiter="_") != slug:
         raise forms.ValidationError(
             _("Enter a valid package name consisting of letters, numbers, " "or underscores.")
         )
     if Addon.objects.filter(slug=slug).exists():
         raise forms.ValidationError(_("This package name is already in use."))
     if BlacklistedSlug.blocked(slug):
         raise forms.ValidationError(_(u"The package name cannot be: %s." % slug))
     return slug
Ejemplo n.º 3
0
    def clean_app_slug(self):
        slug = self.cleaned_data["app_slug"]
        slug_validator(slug, lower=False)

        if slug != self.instance.app_slug:
            if Webapp.objects.filter(app_slug=slug).exists():
                raise forms.ValidationError(_("This slug is already in use. Please choose another."))

            if BlacklistedSlug.blocked(slug):
                raise forms.ValidationError(_('The slug cannot be "%s". Please choose another.' % slug))

        return slug
Ejemplo n.º 4
0
    def clean_slug(self):
        target = self.cleaned_data['slug']
        slug_validator(target, lower=False)

        if target != self.instance.slug:
            if Addon.objects.filter(slug=target).exists():
                raise forms.ValidationError(_('This slug is already in use.'))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(_('The slug cannot be: %s.'
                                              % target))
        return target
Ejemplo n.º 5
0
def clean_slug(slug, instance):
    slug_validator(slug, lower=False)

    if slug != instance.slug:
        if Addon.objects.filter(slug=slug).exists():
            raise forms.ValidationError(
                _('This slug is already in use. Please choose another.'))
        if BlacklistedSlug.blocked(slug):
            raise forms.ValidationError(
                _('The slug cannot be "%s". Please choose another.' % slug))

    return slug
Ejemplo n.º 6
0
    def clean_slug(self):
        target = self.cleaned_data["slug"]
        slug_validator(target, lower=False)
        slug_field = "app_slug" if self.instance.is_webapp() else "slug"

        if target != getattr(self.instance, slug_field):
            if Addon.objects.filter(**{slug_field: target}).exists():
                raise forms.ValidationError(_("This slug is already in use."))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(_("The slug cannot be: %s." % target))
        return target
Ejemplo n.º 7
0
def clean_slug(slug, instance):
    slug_validator(slug, lower=False)

    if slug != instance.slug:
        if Addon.objects.filter(slug=slug).exists():
            raise forms.ValidationError(
                _('This slug is already in use. Please choose another.'))
        if BlacklistedSlug.blocked(slug):
            raise forms.ValidationError(
                _('The slug cannot be "%s". Please choose another.' % slug))

    return slug
Ejemplo n.º 8
0
    def clean_slug(self):
        target = self.cleaned_data['slug']
        slug_validator(target, lower=False)

        if target != self.instance.slug:
            if Addon.objects.filter(slug=target).exists():
                raise forms.ValidationError(_('This slug is already in use.'))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(
                    _('The slug cannot be: %s.' % target))
        return target
Ejemplo n.º 9
0
 def clean_package_name(self):
     slug = self.cleaned_data['package_name']
     if slugify(slug, ok='_', lower=False, delimiter='_') != slug:
         raise forms.ValidationError(
             _('Enter a valid package name consisting of letters, numbers, '
               'or underscores.'))
     if Addon.objects.filter(slug=slug).exists():
         raise forms.ValidationError(
             _('This package name is already in use.'))
     if BlacklistedSlug.blocked(slug):
         raise forms.ValidationError(
             _(u'The package name cannot be: %s.' % slug))
     return slug
Ejemplo n.º 10
0
def clean_slug(slug, instance):
    slug_validator(slug, lower=False)
    slug_field = 'app_slug' if instance.is_webapp() else 'slug'

    if slug != getattr(instance, slug_field):
        if Addon.objects.filter(**{slug_field: slug}).exists():
            raise forms.ValidationError(
                _('This slug is already in use. Please choose another.'))
        if BlacklistedSlug.blocked(slug):
            raise forms.ValidationError(
                _('The slug cannot be "%s". Please choose another.' % slug))

    return slug
Ejemplo n.º 11
0
def clean_slug(slug, instance):
    slug_validator(slug, lower=False)
    slug_field = 'app_slug' if instance.is_webapp() else 'slug'

    if slug != getattr(instance, slug_field):
        if Addon.objects.filter(**{slug_field: slug}).exists():
            raise forms.ValidationError(
                _('This slug is already in use. Please choose another.'))
        if BlacklistedSlug.blocked(slug):
            raise forms.ValidationError(
                _('The slug cannot be "%s". Please choose another.' % slug))

    return slug
Ejemplo n.º 12
0
    def clean_slug(self):
        target = self.cleaned_data['slug']
        slug_validator(target, lower=False)
        slug_field = 'app_slug' if self.instance.is_webapp() else 'slug'

        if target != getattr(self.instance, slug_field):
            if Addon.objects.filter(**{slug_field: target}).exists():
                raise forms.ValidationError(_('This slug is already in use.'))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(
                    _('The slug cannot be: %s.' % target))
        return target
Ejemplo n.º 13
0
    def clean_app_slug(self):
        slug_field = 'app_slug'
        target = self.cleaned_data[slug_field]
        slug_validator(target, lower=False)

        if target != getattr(self.instance, slug_field):
            if Addon.objects.filter(**{slug_field: target}).exists():
                raise forms.ValidationError(_('This slug is already in use.'))

            if BlacklistedSlug.blocked(target):
                raise forms.ValidationError(
                    _('The slug cannot be %s.' % target))
        return target
Ejemplo n.º 14
0
    def clean_slug(self):
        slug = self.cleaned_data['slug']
        slug_validator(slug, lower=False)

        if slug != self.instance.app_slug:
            if Webapp.objects.filter(app_slug=slug).exists():
                raise forms.ValidationError(
                    _('This slug is already in use. Please choose another.'))

            if BlacklistedSlug.blocked(slug):
                raise forms.ValidationError(_('The slug cannot be "%s". '
                                              'Please choose another.' % slug))

        return slug.lower()