|
a/Allura/allura/app.py |
|
b/Allura/allura/app.py |
|
... |
|
... |
31 |
return self._default()
|
31 |
return self._default()
|
32 |
return self._default
|
32 |
return self._default
|
33 |
|
33 |
|
34 |
class SitemapEntry(object):
|
34 |
class SitemapEntry(object):
|
35 |
|
35 |
|
36 |
def __init__(self, label, url=None, children=None, className=None, ui_icon=None, small=None):
|
36 |
def __init__(self, label, url=None, children=None, className=None,
|
|
|
37 |
ui_icon=None, small=None, tool_name=None):
|
37 |
self.label = label
|
38 |
self.label = label
|
38 |
self.className = className
|
39 |
self.className = className
|
39 |
if url is not None:
|
40 |
if url is not None:
|
40 |
url = url.encode('utf-8')
|
41 |
url = url.encode('utf-8')
|
41 |
self.url = url
|
42 |
self.url = url
|
42 |
self.small = small
|
43 |
self.small = small
|
43 |
self.ui_icon = ui_icon
|
44 |
self.ui_icon = ui_icon
|
44 |
if children is None:
|
45 |
if children is None:
|
45 |
children = []
|
46 |
children = []
|
46 |
self.children = children
|
47 |
self.children = children
|
|
|
48 |
self.tool_name = tool_name
|
|
|
49 |
self.matching_urls = []
|
47 |
|
50 |
|
48 |
def __getitem__(self, x):
|
51 |
def __getitem__(self, x):
|
49 |
"""
|
52 |
"""
|
50 |
Automatically expand the list of sitemap child entries with the given items. Example:
|
53 |
Automatically expand the list of sitemap child entries with the given items. Example:
|
51 |
SitemapEntry('HelloForge')[
|
54 |
SitemapEntry('HelloForge')[
|
|
... |
|
... |
90 |
match.extend(e.children)
|
93 |
match.extend(e.children)
|
91 |
else:
|
94 |
else:
|
92 |
self.children.append(e)
|
95 |
self.children.append(e)
|
93 |
child_index[lbl] = e
|
96 |
child_index[lbl] = e
|
94 |
|
97 |
|
|
|
98 |
def matches_url(self, request):
|
|
|
99 |
"""Return true if this SitemapEntry 'matches' the url of `request`."""
|
|
|
100 |
return self.url in request.upath_info or any([
|
|
|
101 |
url in request.upath_info for url in self.matching_urls])
|
95 |
|
102 |
|
96 |
class Application(object):
|
103 |
class Application(object):
|
97 |
"""
|
104 |
"""
|
98 |
The base Allura pluggable application
|
105 |
The base Allura pluggable application
|
99 |
|
106 |
|