• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Révisione388ce210d390856fdd0a9604a9cb5d10dc0e74c (tree)
l'heure2011-11-17 04:48:17
AuteurJenny Steele <jsteele@geek...>
CommiterWayne Witzel III

Message de Log

[#3226] Added option to specify apps to install during register project so neighborhoods with a project template have more control

Signed-off-by: Jenny Steele <jsteele@geek.net>

Change Summary

Modification

--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -170,11 +170,17 @@ class NeighborhoodController(object):
170170 project_description = h.really_unicode(project_description or '').encode('utf-8')
171171 project_name = h.really_unicode(project_name or '').encode('utf-8')
172172 project_unixname = h.really_unicode(project_unixname or '').encode('utf-8').lower()
173- c.project = neighborhood.register_project(project_unixname, project_name=project_name, private_project=private_project)
173+ apps = None
174+ if 'tools' in project_template:
175+ apps = []
176+ c.project = neighborhood.register_project(project_unixname, project_name=project_name, private_project=private_project, apps=apps)
174177 if project_description:
175178 c.project.short_description = project_description
176179 ming.orm.ormsession.ThreadLocalORMSession.flush_all()
177- offset = int(c.project.ordered_mounts(include_search=True)[-1]['ordinal']) + 1
180+ ordered_mounts = c.project.ordered_mounts(include_search=True)
181+ offset = 0
182+ if len(ordered_mounts):
183+ offset = int(ordered_mounts[-1]['ordinal']) + 1
178184 if 'tools' in project_template:
179185 for i, tool in enumerate(project_template['tools'].keys()):
180186 tool_config = project_template['tools'][tool]
@@ -198,16 +204,17 @@ class NeighborhoodController(object):
198204 troves = getattr(c.project,'trove_%s'%trove_type)
199205 for trove_id in project_template['trove_cats'][trove_type]:
200206 troves.append(M.TroveCategory.query.get(trove_cat_id=trove_id)._id)
201- if 'home_options' in project_template:
207+ if 'home_options' in project_template and c.project.app_config('home'):
202208 options = c.project.app_config('home').options
203209 for option in project_template['home_options'].keys():
204210 options[option] = project_template['home_options'][option]
205- from forgewiki import model as WM
206211 home_app = c.project.app_instance('home')
207- if 'home_text' in project_template:
208- WM.Page.query.get(app_config_id=home_app.config._id).text = project_template['home_text']
209- else:
210- WM.Page.query.get(app_config_id=home_app.config._id).text = """[[project_admins]]
212+ if home_app:
213+ from forgewiki import model as WM
214+ if 'home_text' in project_template:
215+ WM.Page.query.get(app_config_id=home_app.config._id).text = project_template['home_text']
216+ else:
217+ WM.Page.query.get(app_config_id=home_app.config._id).text = """[[project_admins]]
211218 [[download_button]]"""
212219 if 'icon' in project_template:
213220 icon_file = StringIO(urlopen(project_template['icon']['url']).read())
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -329,7 +329,7 @@ class ProjectRegistrationProvider(object):
329329 state(p).soil()
330330 return p
331331
332- def register_project(self, neighborhood, shortname, project_name, user, user_project, private_project):
332+ def register_project(self, neighborhood, shortname, project_name, user, user_project, private_project, apps=None):
333333 '''Register a new project in the neighborhood. The given user will
334334 become the project's superuser.
335335 '''
@@ -351,7 +351,8 @@ class ProjectRegistrationProvider(object):
351351 p.configure_project(
352352 users=[user],
353353 is_user_project=user_project,
354- is_private_project=private_project)
354+ is_private_project=private_project,
355+ apps=apps)
355356 except forge_exc.ProjectConflict:
356357 raise
357358 except:
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -68,7 +68,7 @@ class Neighborhood(MappedClass):
6868 else:
6969 return url
7070
71- def register_project(self, shortname, user=None, project_name=None, user_project=False, private_project=False):
71+ def register_project(self, shortname, user=None, project_name=None, user_project=False, private_project=False, apps=None):
7272 '''Register a new project in the neighborhood. The given user will
7373 become the project's superuser. If no user is specified, c.user is used.
7474 '''
@@ -76,7 +76,7 @@ class Neighborhood(MappedClass):
7676 if project_name is None:
7777 project_name = shortname
7878 return provider.register_project(
79- self, shortname, project_name, user or getattr(c,'user',None), user_project, private_project)
79+ self, shortname, project_name, user or getattr(c,'user',None), user_project, private_project, apps)
8080
8181 def bind_controller(self, controller):
8282 from allura.controllers.project import NeighborhoodController
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -202,11 +202,13 @@ class TestNeighborhood(TestController):
202202 "filename":"icon.png"
203203 },
204204 "tools":{
205+ "wiki":{"label":"Home","mount_point":"home"},
205206 "discussion":{"label":"Discussion","mount_point":"discussion"},
206207 "blog":{"label":"News","mount_point":"news","options":{
207208 "show_discussion":false
208209 }},
209- "downloads":{"label":"Downloads","mount_point":"downloads"}
210+ "downloads":{"label":"Downloads","mount_point":"downloads"},
211+ "admin":{"label":"Admin","mount_point":"admin"}
210212 },
211213 "tool_order":["home","discussion","news","downloads","admin"],
212214 "labels":["mmi"],