From: Eric Price Date: Tue, 24 Jun 2008 01:28:19 +0000 (-0400) Subject: More accurate validMachineName (no _, 63 character limit). X-Git-Tag: sipb-xen-www/3.6~20 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/b2eea8efa6fd45a3d4afbd88352b6d22e9ae4b81?ds=sidebyside;hp=f586c77c2bb2684c6ac5150894bcbb79ee1c35c3 More accurate validMachineName (no _, 63 character limit). svn path=/trunk/packages/sipb-xen-www/; revision=648 --- diff --git a/code/validation.py b/code/validation.py index 9b703ad..e69559a 100644 --- a/code/validation.py +++ b/code/validation.py @@ -135,8 +135,8 @@ def validMachineName(name): """Check that name is valid for a machine name""" if not name: return False - charset = string.ascii_letters + string.digits + '-_' - if name[0] in '-_' or len(name) > 22: + charset = string.lowercase + string.digits + '-' + if '-' in (name[0], name[-1]) or len(name) > 63: return False for x in name: if x not in charset: