28 from django.utils.translation import ugettext |
28 from django.utils.translation import ugettext |
29 |
29 |
30 from soc.models import base |
30 from soc.models import base |
31 |
31 |
32 |
32 |
33 # start with ASCII digit or lowercase |
33 # start with ASCII lowercase |
34 # (additional ASCII digit or lowercase |
34 # (additional ASCII digit or lowercase |
35 # -OR- |
35 # -OR- |
36 # underscore and ASCII digit or lowercase) |
36 # underscore and ASCII digit or lowercase) |
37 # zero or more of OR group |
37 # zero or more of OR group |
38 # |
38 # |
39 # * starting or ending underscores are *not* permitted |
39 # * starting or ending underscores are *not* permitted |
40 # * double internal underscores are *not* permitted |
40 # * double internal underscores are *not* permitted |
41 # |
41 # |
42 LINK_ID_PATTERN_CORE = r'[0-9a-z](?:[0-9a-z]|_[0-9a-z])*' |
42 LINK_ID_PATTERN_CORE = r'[a-z](?:[0-9a-z]|_[0-9a-z])*' |
43 LINK_ID_ARG_PATTERN = r'(?P<link_id>%s)' % LINK_ID_PATTERN_CORE |
43 LINK_ID_ARG_PATTERN = r'(?P<link_id>%s)' % LINK_ID_PATTERN_CORE |
44 LINK_ID_PATTERN = r'^%s$' % LINK_ID_PATTERN_CORE |
44 LINK_ID_PATTERN = r'^%s$' % LINK_ID_PATTERN_CORE |
45 LINK_ID_REGEX = re.compile(LINK_ID_PATTERN) |
45 LINK_ID_REGEX = re.compile(LINK_ID_PATTERN) |
46 |
46 |
47 # scope path is multiple link_id chunks, |
47 # scope path is multiple link_id chunks, |