Added public attribute with relation name regexp
Also simplified the function to check whether a name is valid for a relation.
This commit is contained in:
parent
a655e81b28
commit
e2ab59bcc4
@ -24,6 +24,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
RELATION_NAME_REGEXP = r'^[_a-zA-Z]+[_a-zA-Z0-9]*$'
|
||||||
|
|
||||||
class rstring (str):
|
class rstring (str):
|
||||||
|
|
||||||
@ -160,7 +161,4 @@ class rdate (object):
|
|||||||
def is_valid_relation_name(name):
|
def is_valid_relation_name(name):
|
||||||
'''Checks if a name is valid for a relation.
|
'''Checks if a name is valid for a relation.
|
||||||
Returns boolean'''
|
Returns boolean'''
|
||||||
if re.match(r'^[_a-zA-Z]+[_a-zA-Z0-9]*$', name) == None:
|
return re.match(RELATION_NAME_REGEXP, name) != None
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
Loading…
Reference in New Issue
Block a user