コード例 #1
0
def clean_name(name, instance=None):
    if not instance:
        log.debug('clean_name called without an instance: %s' % name)
    if instance:
        id = ReverseNameLookup(instance.is_webapp()).get(name)
    else:
        id = ReverseNameLookup().get(name)

    # If we get an id and either there's no instance or the instance.id != id.
    if id and (not instance or id != instance.id):
        raise forms.ValidationError(_('This name is already in use. Please '
                                      'choose another.'))
    return name
コード例 #2
0
ファイル: forms.py プロジェクト: exezaid/zamboni
def clean_name(name, instance=None):
    id = ReverseNameLookup.get(name)

    # If we get an id and either there's no instance or the instance.id != id.
    if id and (not instance or id != instance.id):
        raise forms.ValidationError(_('This add-on name is already in use.  '
                                      'Please choose another.'))
    return name
コード例 #3
0
ファイル: forms.py プロジェクト: AutomatedTester/zamboni
def clean_name(name, instance=None):
    id = ReverseNameLookup().get(name)

    # If we get an id and either there's no instance or the instance.id != id.
    if id and (not instance or id != instance.id):
        raise forms.ValidationError(_('This add-on name is already in use.  '
                                      'Please choose another.'))
    return name