1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-09 14:28:03 +00:00

validation.py: check if only ".i2p" supplied as hostname

This is a common error.
This commit is contained in:
Hidden Z 2010-10-22 18:36:05 +00:00
parent 9ea9db109a
commit 5da0cc4b59

View File

@ -23,6 +23,9 @@ def validate_hostname(data):
# Base 32 hostnames (*.b32.i2p) are not allowed
if re.match(r'.*\.b32\.i2p$', data):
raise forms.ValidationError('Base32 hostnames are not allowed')
# prevent common errors
if re.match(r'\.i2p$', data):
raise forms.ValidationError('Incomplete hostname')
# Must not contain '..'
if re.search(r'\.\.', data):
raise forms.ValidationError('".." in hostname')