1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-09 06:18:05 +00:00

validation.py: strip leading and trailing whitespaces from hostname

This commit is contained in:
Hidden Z 2010-10-22 17:14:30 +00:00
parent 6a50774e5f
commit 573efddf8b

View File

@ -11,8 +11,8 @@ def validate_hostname(data):
Here we do additional hostname validation as described in
http://www.i2p2.i2p/naming.html
"""
# convert hostname to lowercase
data = data.lower()
# convert hostname to lowercase and strip leading and trailing whitespaces
data = data.lower().strip()
# Must end with '.i2p'.
if re.match(r'.*\.i2p$', data) == None:
raise forms.ValidationError('Hostname doesn\'t ends with .i2p')