Merge lp:~benoit.pierre/sloecode/allow-more-chars-in-indentifiers into lp:sloecode

Proposed by Benoit Pierre
Status: Merged
Merge reported by: Thomi Richards
Merged at revision: not available
Proposed branch: lp:~benoit.pierre/sloecode/allow-more-chars-in-indentifiers
Merge into: lp:sloecode
Diff against target: 43 lines (+4/-4)
2 files modified
sloecode/model/person.py (+2/-2)
sloecode/model/project.py (+2/-2)
To merge this branch: bzr merge lp:~benoit.pierre/sloecode/allow-more-chars-in-indentifiers
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
Review via email: mp+77773@code.launchpad.net

Description of the change

Allow _-. in project/person identifiers (after the first char).

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Looks great, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sloecode/model/person.py'
2--- sloecode/model/person.py 2011-07-22 04:20:11 +0000
3+++ sloecode/model/person.py 2011-10-01 00:30:29 +0000
4@@ -78,7 +78,7 @@
5 """A simple formencode validator that checks that Person logins are unique.
6 """
7
8- login_regex = re.compile(r'^[a-z0-9]{3,24}$')
9+ login_regex = re.compile(r'^[a-z0-9][a-z0-9_.-]{2,23}$')
10
11 def _to_python(self, value, state):
12 """Try to validate form data.
13@@ -88,7 +88,7 @@
14 'That login already exists.', value, state)
15
16 if not self.login_regex.match(value):
17- raise formencode.Invalid('Logins must be lower-case letters or numbers only.', value, state)
18+ raise formencode.Invalid('Logins must be lower-case letters, numbers, or _-. only.', value, state)
19
20 return value
21
22
23=== modified file 'sloecode/model/project.py'
24--- sloecode/model/project.py 2011-07-02 07:13:32 +0000
25+++ sloecode/model/project.py 2011-10-01 00:30:29 +0000
26@@ -32,7 +32,7 @@
27 class UniqueProject(formencode.FancyValidator):
28 "A simple formencode validator that checks Project names are unique."
29
30- project_regex = re.compile(r'^[a-z0-9]{3,24}$')
31+ project_regex = re.compile(r'^[a-z0-9][a-z0-9_.-]{2,23}$')
32
33 def _to_python(self, value, state):
34 """Validate form-data.
35@@ -44,7 +44,7 @@
36
37 if not self.project_regex.match(value):
38 raise formencode.Invalid(
39- 'A project name must be lower case letters and numbers, and be 3-24 characters long.',
40+ 'A project name must be lower case letters, numbers, or _-., and be 3-24 characters long.',
41 value, state)
42
43 return value

Subscribers

People subscribed via source and target branches