|
a/Allura/allura/lib/plugin.py |
|
b/Allura/allura/lib/plugin.py |
|
... |
|
... |
215 |
|
215 |
|
216 |
def name_taken(self, project_name):
|
216 |
def name_taken(self, project_name):
|
217 |
from allura import model as M
|
217 |
from allura import model as M
|
218 |
p = M.Project.query.get(shortname=project_name)
|
218 |
p = M.Project.query.get(shortname=project_name)
|
219 |
if p:
|
219 |
if p:
|
|
|
220 |
return 'This project name is taken.'
|
|
|
221 |
for check in self.extra_name_checks():
|
|
|
222 |
if re.match(str(check[1]),project_name) is not None:
|
220 |
return True
|
223 |
return check[0]
|
221 |
return False
|
224 |
return False
|
|
|
225 |
|
|
|
226 |
def extra_name_checks(self):
|
|
|
227 |
'''This should be a list or iterator containing tuples.
|
|
|
228 |
The first tiem in the tuple should be an error message and the
|
|
|
229 |
second should be a regex. If the user attempts to register a
|
|
|
230 |
project with a name that matches the regex, the field will
|
|
|
231 |
be marked invalid with the message displayed to the user.
|
|
|
232 |
'''
|
|
|
233 |
return []
|
222 |
|
234 |
|
223 |
def register_neighborhood_project(self, neighborhood, users):
|
235 |
def register_neighborhood_project(self, neighborhood, users):
|
224 |
from allura import model as M
|
236 |
from allura import model as M
|
225 |
shortname='--init--'
|
237 |
shortname='--init--'
|
226 |
p = M.Project.query.get(
|
238 |
p = M.Project.query.get(
|