|
a/Allura/allura/model/index.py |
|
b/Allura/allura/model/index.py |
|
... |
|
... |
144 |
result = {}
|
144 |
result = {}
|
145 |
for link, d in parsed_links.iteritems():
|
145 |
for link, d in parsed_links.iteritems():
|
146 |
matches = matches_by_artifact.get(d['artifact'], [])
|
146 |
matches = matches_by_artifact.get(d['artifact'], [])
|
147 |
matches = (
|
147 |
matches = (
|
148 |
m for m in matches
|
148 |
m for m in matches
|
149 |
if m.project.shortname == d['project'] )
|
149 |
if m.project.shortname == d['project'] and m.project.neighborhood_id == d['nbhd'])
|
150 |
if d['app']:
|
150 |
if d['app']:
|
151 |
matches = (
|
151 |
matches = (
|
152 |
m for m in matches
|
152 |
m for m in matches
|
153 |
if m.app_config.options.mount_point == d['app'])
|
153 |
if m.app_config.options.mount_point == d['app'])
|
154 |
matches = list(matches)
|
154 |
matches = list(matches)
|
|
... |
|
... |
162 |
log.warn('... %r', m)
|
162 |
log.warn('... %r', m)
|
163 |
return result
|
163 |
return result
|
164 |
|
164 |
|
165 |
@classmethod
|
165 |
@classmethod
|
166 |
def _parse_link(cls, s):
|
166 |
def _parse_link(cls, s):
|
167 |
'''Parse a shortlink into its project/app/artifact parts'''
|
167 |
'''Parse a shortlink into its nbhd/project/app/artifact parts'''
|
168 |
s = s.strip()
|
168 |
s = s.strip()
|
169 |
if s.startswith('['):
|
169 |
if s.startswith('['):
|
170 |
s = s[1:]
|
170 |
s = s[1:]
|
171 |
if s.endswith(']'):
|
171 |
if s.endswith(']'):
|
172 |
s = s[:-1]
|
172 |
s = s[:-1]
|
173 |
parts = s.split(':')
|
173 |
parts = s.split(':')
|
174 |
p_shortname = None
|
174 |
p_shortname = None
|
|
|
175 |
p_nbhd = None
|
175 |
if hasattr(c, 'project'):
|
176 |
if hasattr(c, 'project'):
|
176 |
p_shortname = getattr(c.project, 'shortname', None)
|
177 |
p_shortname = getattr(c.project, 'shortname', None)
|
|
|
178 |
p_nbhd = c.project.neighborhood_id
|
177 |
if len(parts) == 3:
|
179 |
if len(parts) == 3:
|
178 |
return dict(
|
180 |
return dict(
|
|
|
181 |
nbhd=p_nbhd,
|
179 |
project=parts[0],
|
182 |
project=parts[0],
|
180 |
app=parts[1],
|
183 |
app=parts[1],
|
181 |
artifact=parts[2])
|
184 |
artifact=parts[2])
|
182 |
elif len(parts) == 2:
|
185 |
elif len(parts) == 2:
|
183 |
return dict(
|
186 |
return dict(
|
|
|
187 |
nbhd=p_nbhd,
|
184 |
project=p_shortname,
|
188 |
project=p_shortname,
|
185 |
app=parts[0],
|
189 |
app=parts[0],
|
186 |
artifact=parts[1])
|
190 |
artifact=parts[1])
|
187 |
elif len(parts) == 1:
|
191 |
elif len(parts) == 1:
|
188 |
return dict(
|
192 |
return dict(
|
|
|
193 |
nbhd=p_nbhd,
|
189 |
project=p_shortname,
|
194 |
project=p_shortname,
|
190 |
app=None,
|
195 |
app=None,
|
191 |
artifact=parts[0])
|
196 |
artifact=parts[0])
|
192 |
else:
|
197 |
else:
|
193 |
return None
|
198 |
return None
|