|
a/Allura/allura/controllers/project.py |
|
b/Allura/allura/controllers/project.py |
|
... |
|
... |
132 |
projects=projects,
|
132 |
projects=projects,
|
133 |
sort=sort,
|
133 |
sort=sort,
|
134 |
limit=limit, page=page, count=count)
|
134 |
limit=limit, page=page, count=count)
|
135 |
|
135 |
|
136 |
@expose('jinja:allura:templates/neighborhood_add_project.html')
|
136 |
@expose('jinja:allura:templates/neighborhood_add_project.html')
|
|
|
137 |
@without_trailing_slash
|
137 |
def add_project(self, **form_data):
|
138 |
def add_project(self, **form_data):
|
138 |
require(has_neighborhood_access('create', self.neighborhood), 'Create access required')
|
139 |
require(has_neighborhood_access('create', self.neighborhood), 'Create access required')
|
139 |
c.add_project = W.add_project
|
140 |
c.add_project = W.add_project
|
140 |
for checkbox in ['Wiki','Git','Tickets','Downloads','Discussion']:
|
141 |
for checkbox in ['Wiki','Git','Tickets','Downloads','Discussion']:
|
141 |
form_data.setdefault(checkbox, True)
|
142 |
form_data.setdefault(checkbox, True)
|
142 |
form_data['neighborhood'] = self.neighborhood.name
|
143 |
form_data['neighborhood'] = self.neighborhood.name
|
143 |
return dict(neighborhood=self.neighborhood, form_data=form_data)
|
144 |
return dict(neighborhood=self.neighborhood, form_data=form_data)
|
|
|
145 |
|
|
|
146 |
@expose('json:')
|
|
|
147 |
def suggest_name(self, project_name=None):
|
|
|
148 |
new_name = re.sub("[^A-Za-z0-9]", "", project_name).lower()
|
|
|
149 |
name_taken = plugin.ProjectRegistrationProvider.get().name_taken(new_name)
|
|
|
150 |
return dict(suggested_name=new_name, name_taken=name_taken)
|
|
|
151 |
|
|
|
152 |
@expose('json:')
|
|
|
153 |
def check_name(self, project_name=None):
|
|
|
154 |
allowed = not not h.re_path_portion.match(project_name)
|
|
|
155 |
name_taken = plugin.ProjectRegistrationProvider.get().name_taken(project_name)
|
|
|
156 |
return dict(allowed=allowed, name_taken=name_taken)
|
144 |
|
157 |
|
145 |
@h.vardec
|
158 |
@h.vardec
|
146 |
@expose()
|
159 |
@expose()
|
147 |
@require_post()
|
160 |
@require_post()
|
148 |
@validate(W.add_project, error_handler=add_project)
|
161 |
@validate(W.add_project, error_handler=add_project)
|