app/soc/views/helper/params.py
changeset 672 c8f9281f535b
parent 671 2c02178037ff
child 673 2433d5c1d7e6
equal deleted inserted replaced
671:2c02178037ff 672:c8f9281f535b
   239   Params usage:
   239   Params usage:
   240     key_fields_prefix: The key_fields_prefix value is used as the
   240     key_fields_prefix: The key_fields_prefix value is used as the
   241       first part of the returned pattern.
   241       first part of the returned pattern.
   242   """
   242   """
   243 
   243 
   244   names = params['logic'].getKeyFieldNames()
   244   logic = params['logic']
       
   245   names = logic.getKeyFieldNames()
   245   patterns = params['key_fields_prefix']
   246   patterns = params['key_fields_prefix']
   246 
   247 
   247   for name in names:
   248   for name in names:
   248     pattern = r'(?P<%s>%s)' % (name, linkable.LINK_ID_PATTERN_CORE)
   249     regexp = linkable.LINK_ID_PATTERN_CORE
       
   250     if name == 'scope_path':
       
   251       regexp = '/'.join((regexp for i in range(logic.getScopeDepth())))
       
   252 
       
   253     pattern = r'(?P<%s>%s)' % (name, regexp)
   249     patterns.append(pattern)
   254     patterns.append(pattern)
   250 
   255 
   251   result = '/'.join(patterns)
   256   result = '/'.join(patterns)
   252   return result
   257   return result