equal
deleted
inserted
replaced
243 |
243 |
244 names = params['logic'].getKeyFieldNames() |
244 names = params['logic'].getKeyFieldNames() |
245 patterns = params['key_fields_prefix'] |
245 patterns = params['key_fields_prefix'] |
246 |
246 |
247 for name in names: |
247 for name in names: |
248 pattern = r'(?P<%s>%s)' % (name, linkable.LINK_ID_PATTERN_CORE) |
248 if name == 'scope_path': |
|
249 pattern = getScopePattern(params) |
|
250 else: |
|
251 pattern = r'(?P<%s>%s)' % (name, linkable.LINK_ID_PATTERN_CORE) |
249 patterns.append(pattern) |
252 patterns.append(pattern) |
250 |
253 |
251 result = '/'.join(patterns) |
254 result = '/'.join(patterns) |
252 return result |
255 return result |
|
256 |
|
257 def getScopePattern(params): |
|
258 """Returns the Scope pattern for this entity |
|
259 """ |
|
260 |
|
261 logic = params['logic'] |
|
262 depth = logic.getScopeDepth() |
|
263 if depth is None: |
|
264 return linkable.SCOPE_PATH_ARG_PATTERN |
|
265 |
|
266 regexps = [linkable.LINK_ID_PATTERN_CORE for i in range(depth)] |
|
267 regexp = '/'.join(regexps) |
|
268 return r'(?P<scope_path>%s)' % regexp |