• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

allura


Commit MetaInfo

Revision70d3e7a4752af912e0493d1195d9ad5c6beba93a (tree)
Zeit2012-06-18 17:27:50
Autorbolkimen <bolkimen@yaho...>
Commiterbolkimen

Log Message

[#4208] ticket:87 refactor and change the code

Ändern Zusammenfassung

Diff

--- a/Allura/allura/command/create_neighborhood.py
+++ b/Allura/allura/command/create_neighborhood.py
@@ -31,7 +31,12 @@ class UpdateNeighborhoodCommand(base.Command):
3131 min_args=3
3232 max_args=None
3333 usage = '<ini file> <neighborhood_shortname> <home_tool_active>'
34- summary = 'Activate Home application for neighborhood'
34+ summary = 'Activate Home application for neighborhood\r\n' \
35+ '\t<neighborhood> - the neighborhood name\r\n' \
36+ '\t<value> - boolean value to install/uninstall Home tool\r\n' \
37+ '\t must be True or False\r\n\r\n' \
38+ '\tExample:\r\n' \
39+ '\tpaster update-neighborhood-home-tool development.ini Projects True'
3540 parser = base.Command.standard_parser(verbose=True)
3641
3742 def command(self):
@@ -47,7 +52,7 @@ class UpdateNeighborhoodCommand(base.Command):
4752 else:
4853 home_tool_active = False
4954
50- if home_tool_active == nb.have_home_project:
55+ if home_tool_active == nb.has_home_project:
5156 return
5257
5358 p = nb.neighborhood_project
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -90,8 +90,15 @@ class NeighborhoodController(object):
9090 c.project = self.neighborhood.neighborhood_project
9191 if self.neighborhood.redirect:
9292 redirect(self.neighborhood.redirect)
93- if not self.neighborhood.have_home_project:
94- redirect(c.project.script_name + 'wiki/')
93+ if not self.neighborhood.has_home_project:
94+ mount = c.project.first_mount()
95+ if mount is not None:
96+ if 'ac' in mount:
97+ redirect(mount['ac'].options.mount_point + '/')
98+ elif 'sub' in mount:
99+ redirect(mount['sub'].url())
100+ else:
101+ redirect(c.project.app_configs[0].options.mount_point + '/')
95102 c.project_summary = W.project_summary
96103 c.page_list = W.page_list
97104 limit, page, start = g.handle_paging(limit, page)
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -109,11 +109,8 @@ class Neighborhood(MappedClass):
109109 return ""
110110
111111 @property
112- def have_home_project(self):
113- if self.neighborhood_project.app_config('home') is not None:
114- return True
115- else:
116- return False
112+ def has_home_project(self):
113+ return self.neighborhood_project.app_config('home') is not None
117114
118115 @property
119116 def icon(self):
--- a/Allura/allura/templates/widgets/neighborhood_overview_form.html
+++ b/Allura/allura/templates/widgets/neighborhood_overview_form.html
@@ -5,7 +5,7 @@
55 <div class="grid-14">{{widget.display_field(widget.fields.name)}}</div>
66 <label class="grid-4">Redirect</label>
77 <div class="grid-14">{{widget.display_field(widget.fields.redirect)}}</div>
8- {% if value.have_home_project %}
8+ {% if value.has_home_project %}
99 <label class="grid-4">Home Content (HTML)</label>
1010 <div class="grid-14">{{widget.display_field(widget.fields.homepage)}}</div>
1111 <label class="grid-4">Allow Browsing</label>
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -143,10 +143,10 @@ def test_update_neighborhood():
143143 cmd.run([test_config, 'Projects', 'True'])
144144 cmd.command()
145145 nb = M.Neighborhood.query.get(name='Projects')
146- assert nb.have_home_project == True
146+ assert nb.has_home_project == True
147147
148148 cmd = create_neighborhood.UpdateNeighborhoodCommand('update-neighborhood')
149149 cmd.run([test_config, 'Projects', 'False'])
150150 cmd.command()
151151 nb = M.Neighborhood.query.get(name='Projects')
152- assert nb.have_home_project == False
152+ assert nb.has_home_project == False
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -111,7 +111,7 @@ setup(
111111 set-tool-access = allura.command:SetToolAccessCommand
112112 smtp_server=allura.command:SMTPServerCommand
113113 create-neighborhood = allura.command:CreateNeighborhoodCommand
114- update-neighborhood = allura.command:UpdateNeighborhoodCommand
114+ update-neighborhood-home-tool = allura.command:UpdateNeighborhoodCommand
115115 create-trove-categories = allura.command:CreateTroveCategoriesCommand
116116 set-neighborhood-features = allura.command:SetNeighborhoodFeaturesCommand
117117 pull-rss-feeds = allura.command.rssfeeds:RssFeedsCommand