Changed regex while validating column name

This commit is contained in:
Anand Doshi 2011-12-23 16:16:03 +05:30
parent a2d23027a6
commit 8bc26b856d

View file

@ -387,7 +387,7 @@ class DbManager:
def validate_column_name(n):
n = n.replace(' ','_').strip().lower()
import re
if not re.match("[a-zA-Z_][a-zA-Z0-9_]*$", n):
if re.search("[\W]", n):
webnotes.msgprint('err:%s is not a valid fieldname.<br>A valid name must contain letters / numbers / spaces.<br><b>Tip: </b>You can change the Label after the fieldname has been set' % n)
raise Exception
return n