summaryrefslogtreecommitdiffstats
path: root/ipalib/util.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2014-05-30 13:49:02 +0200
committerMartin Kosek <mkosek@redhat.com>2014-06-03 16:43:09 +0200
commit7bf30ae7739c7d503f9c2d4dd82a4f6112f4e8c0 (patch)
tree300f8838192729f4896204e0a6d417c8d85f5515 /ipalib/util.py
parent67565d38af45822a4d975cfbbca32fc9bf1ad08f (diff)
downloadfreeipa-7bf30ae7739c7d503f9c2d4dd82a4f6112f4e8c0.tar.gz
freeipa-7bf30ae7739c7d503f9c2d4dd82a4f6112f4e8c0.tar.xz
freeipa-7bf30ae7739c7d503f9c2d4dd82a4f6112f4e8c0.zip
Fix indentation
There was 5 spaces instead of 4, my bad. Reviewed-By: Martin Kosek <mkosek@redhat.com>
Diffstat (limited to 'ipalib/util.py')
-rw-r--r--ipalib/util.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/ipalib/util.py b/ipalib/util.py
index 7250fd9ce..265957949 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -220,33 +220,33 @@ def normalize_zone(zone):
def validate_dns_label(dns_label, allow_underscore=False, allow_slash=False):
- base_chars = 'a-z0-9'
- extra_chars = ''
- middle_chars = ''
+ base_chars = 'a-z0-9'
+ extra_chars = ''
+ middle_chars = ''
- if allow_underscore:
- extra_chars += '_'
- if allow_slash:
- middle_chars += '/'
+ if allow_underscore:
+ extra_chars += '_'
+ if allow_slash:
+ middle_chars += '/'
- middle_chars = middle_chars + '-' #has to be always the last in the regex [....-]
+ middle_chars = middle_chars + '-' #has to be always the last in the regex [....-]
- label_regex = r'^[%(base)s%(extra)s]([%(base)s%(extra)s%(middle)s]?[%(base)s%(extra)s])*$' \
- % dict(base=base_chars, extra=extra_chars, middle=middle_chars)
- regex = re.compile(label_regex, re.IGNORECASE)
+ label_regex = r'^[%(base)s%(extra)s]([%(base)s%(extra)s%(middle)s]?[%(base)s%(extra)s])*$' \
+ % dict(base=base_chars, extra=extra_chars, middle=middle_chars)
+ regex = re.compile(label_regex, re.IGNORECASE)
- if not dns_label:
- raise ValueError(_('empty DNS label'))
+ if not dns_label:
+ raise ValueError(_('empty DNS label'))
- if len(dns_label) > 63:
- raise ValueError(_('DNS label cannot be longer that 63 characters'))
+ if len(dns_label) > 63:
+ raise ValueError(_('DNS label cannot be longer that 63 characters'))
- if not regex.match(dns_label):
- chars = ', '.join("'%s'" % c for c in extra_chars + middle_chars)
- chars2 = ', '.join("'%s'" % c for c in middle_chars)
- raise ValueError(_("only letters, numbers, %(chars)s are allowed. " \
- "DNS label may not start or end with %(chars2)s") \
- % dict(chars=chars, chars2=chars2))
+ if not regex.match(dns_label):
+ chars = ', '.join("'%s'" % c for c in extra_chars + middle_chars)
+ chars2 = ', '.join("'%s'" % c for c in middle_chars)
+ raise ValueError(_("only letters, numbers, %(chars)s are allowed. " \
+ "DNS label may not start or end with %(chars2)s") \
+ % dict(chars=chars, chars2=chars2))
def validate_domain_name(domain_name, allow_underscore=False, allow_slash=False):