Fix regexp for link id format validation. Link id needs to start with ASCII lowercase and not with digit, which caused User Profile view to crash.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Thu, 29 Jan 2009 09:33:50 +0000
changeset 1058 6acbbb68f032
parent 1057 75f72ea26883
child 1059 17221b578fe7
Fix regexp for link id format validation. Link id needs to start with ASCII lowercase and not with digit, which caused User Profile view to crash. Patch by: Pawel Solyga Reviewed by: to-be-reviewed
app/soc/models/linkable.py
--- a/app/soc/models/linkable.py	Thu Jan 29 08:14:46 2009 +0000
+++ b/app/soc/models/linkable.py	Thu Jan 29 09:33:50 2009 +0000
@@ -30,7 +30,7 @@
 from soc.models import base
 
 
-# start with ASCII digit or lowercase
+# start with ASCII lowercase
 #   (additional ASCII digit or lowercase
 #     -OR-
 #   underscore and ASCII digit or lowercase)
@@ -39,7 +39,7 @@
 # * starting or ending underscores are *not* permitted
 # * double internal underscores are *not* permitted
 #
-LINK_ID_PATTERN_CORE = r'[0-9a-z](?:[0-9a-z]|_[0-9a-z])*'
+LINK_ID_PATTERN_CORE = r'[a-z](?:[0-9a-z]|_[0-9a-z])*'
 LINK_ID_ARG_PATTERN = r'(?P<link_id>%s)' % LINK_ID_PATTERN_CORE
 LINK_ID_PATTERN = r'^%s$' % LINK_ID_PATTERN_CORE
 LINK_ID_REGEX = re.compile(LINK_ID_PATTERN)