|
a/Allura/allura/controllers/root.py |
|
b/Allura/allura/controllers/root.py |
|
... |
|
... |
56 |
error = ErrorController()
|
56 |
error = ErrorController()
|
57 |
nf = NewForgeController()
|
57 |
nf = NewForgeController()
|
58 |
nf.admin = SiteAdminController()
|
58 |
nf.admin = SiteAdminController()
|
59 |
search = SearchController()
|
59 |
search = SearchController()
|
60 |
rest = RestController()
|
60 |
rest = RestController()
|
|
|
61 |
neighborhoods_bound = False
|
61 |
|
62 |
|
62 |
def __init__(self):
|
63 |
def __init__(self):
|
63 |
for n in M.Neighborhood.query.find():
|
64 |
if not self.neighborhoods_bound:
|
64 |
if n.url_prefix.startswith('//'): continue
|
|
|
65 |
n.bind_controller(self)
|
65 |
self.bind_controllers()
|
66 |
self.browse = ProjectBrowseController()
|
66 |
self.browse = ProjectBrowseController()
|
67 |
self.allura_sitemap = SitemapIndexController()
|
67 |
self.allura_sitemap = SitemapIndexController()
|
68 |
super(RootController, self).__init__()
|
68 |
super(RootController, self).__init__()
|
|
|
69 |
|
|
|
70 |
@classmethod
|
|
|
71 |
def bind_controllers(cls):
|
|
|
72 |
for n in M.Neighborhood.query.find():
|
|
|
73 |
if n.url_prefix.startswith('//'): continue
|
|
|
74 |
n.bind_controller(cls)
|
|
|
75 |
cls.neighborhoods_bound = True
|
69 |
|
76 |
|
70 |
def _setup_request(self):
|
77 |
def _setup_request(self):
|
71 |
c.project = c.app = None
|
78 |
c.project = c.app = None
|
72 |
c.memoize_cache = {}
|
79 |
c.memoize_cache = {}
|
73 |
c.user = plugin.AuthenticationProvider.get(request).authenticate_request()
|
80 |
c.user = plugin.AuthenticationProvider.get(request).authenticate_request()
|
|
... |
|
... |
81 |
def index(self, **kw):
|
88 |
def index(self, **kw):
|
82 |
"""Handle the front-page."""
|
89 |
"""Handle the front-page."""
|
83 |
c.project_summary = W.project_summary
|
90 |
c.project_summary = W.project_summary
|
84 |
projects = M.Project.query.find(
|
91 |
projects = M.Project.query.find(
|
85 |
dict(is_root=True,
|
92 |
dict(is_root=True,
|
86 |
shortname={'$ne':'--init--'},
|
93 |
is_nbhd_project=False,
|
87 |
deleted=False)).sort('shortname').all()
|
94 |
deleted=False)).sort('shortname').all()
|
88 |
neighborhoods = M.Neighborhood.query.find().sort('name')
|
95 |
neighborhoods = M.Neighborhood.query.find().sort('name')
|
89 |
psort = [ (n, [ p for p in projects if p.neighborhood_id==n._id ])
|
96 |
psort = [ (n, [ p for p in projects if p.neighborhood_id==n._id ])
|
90 |
for n in neighborhoods ]
|
97 |
for n in neighborhoods ]
|
91 |
categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all()
|
98 |
categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all()
|