Added public attribute with relation name regexp

Also simplified the function to check whether a name is valid for
a relation.
master
Salvo 'LtWorf' Tomaselli 2015-07-14 10:35:54 +07:00
parent a655e81b28
commit e2ab59bcc4
1 changed files with 2 additions and 4 deletions

@ -24,6 +24,7 @@
import datetime
import re
RELATION_NAME_REGEXP = r'^[_a-zA-Z]+[_a-zA-Z0-9]*$'
class rstring (str):
@ -160,7 +161,4 @@ class rdate (object):
def is_valid_relation_name(name):
'''Checks if a name is valid for a relation.
Returns boolean'''
if re.match(r'^[_a-zA-Z]+[_a-zA-Z0-9]*$', name) == None:
return False
else:
return True
return re.match(RELATION_NAME_REGEXP, name) != None