[silvatheme.silvacmsorg][Sylvain Viollon] Improve the validation.
[email protected] Tue, 15 Oct 2013 12:12:37 +0200
| Newsgroups | gmane.comp.web.zope.silva.cvs |
|---|---|
| Message-ID | <[email protected]> |
author: Sylvain Viollon
date: Tue Oct 15 12:12:31 2013 +0200
revision: 724:2effe80cf757 in silvatheme.silvacmsorg
branch:
details: https://hg.infrae.com/silvatheme.silvacmsorg?cmd=changeset;node=2effe80cf757
modified: src/silvatheme/silvacmsorg/cloud.py
added:
removed:
log: Improve the validation.
diffstat:
src/silvatheme/silvacmsorg/cloud.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (23 lines):
diff -r dbd6a55d033d -r 2effe80cf757 src/silvatheme/silvacmsorg/cloud.py
--- a/src/silvatheme/silvacmsorg/cloud.py Tue Oct 15 12:05:43 2013 +0200
+++ b/src/silvatheme/silvacmsorg/cloud.py Tue Oct 15 12:12:31 2013 +0200
@@ -34,15 +34,16 @@
def validate_subdomain(value):
+ value = value.strip()
if not value:
return True
- if '.' in value:
- raise InvalidDomain("The subdomain cannot contain dots.")
+ if '.' in value or ' ' in value or '\t' in value:
+ raise InvalidDomain("The subdomain cannot contain dots or spaces.")
if value.startswith('manage_'):
raise InvalidDomain("The subdomain cannot start with manage_.")
if not value[0].isalnum():
raise InvalidDomain("The subdomain need to start with a letter or a digit.")
- if value in ('silva', 'test'):
+ if value in ('silva', 'test', 'silvacms', 'infrae'):
raise InvalidDomain("This subdomain is reserved and cannot be used.")
return True