app/soc/logic/path_link_name.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Mon, 10 Nov 2008 14:40:16 +0000
changeset 462 1f164cd0529b
parent 409 9d24850db88f
child 512 aae25d2b4464
permissions -rw-r--r--
Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods. Patch by: Lennard de Rijk Review by: Pawel Solyga
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""Path and link name manipulation functions.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Todd Larsen" <tlarsen@google.com>',
462
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
  ]
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
import re
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
# start with ASCII digit or lowercase
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
#   (additional ASCII digit or lowercase
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
#     -OR-
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
#   underscore and ASCII digit or lowercase)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
#     zero or more of OR group
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
LINKNAME_PATTERN_CORE = r'[0-9a-z](?:[0-9a-z]|_[0-9a-z])*'
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
LINKNAME_ARG_PATTERN = r'(?P<link_name>%s)' % LINKNAME_PATTERN_CORE
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
LINKNAME_PATTERN = r'^%s$' % LINKNAME_PATTERN_CORE
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
LINKNAME_REGEX = re.compile(LINKNAME_PATTERN)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
# partial path is multiple link_name chunks,
462
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    40
# each separated by a trailing /
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    41
# (at least 1)
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    42
PARTIAL_PATH_ARG_PATTERN = (r'(?P<partial_path>%(link_name)s'
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    43
                             '(?:/%(link_name)s)*)' % {
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    44
                               'link_name': LINKNAME_PATTERN_CORE})
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    45
PARTIAL_PATH_PATTERN = r'^%s$' % PARTIAL_PATH_ARG_PATTERN
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    46
PARTIAL_PATH_REGEX = re.compile(PARTIAL_PATH_PATTERN)
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    47
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    48
# path is multiple link_name chunks,
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
#   each separated by a trailing /
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
#     (at least 1)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
# followed by a single link_name with no trailing /
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
PATH_LINKNAME_ARGS_PATTERN = (
462
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    53
    r'%(partial_path)s/'
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
     '(?P<link_name>%(link_name)s)' % {
462
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    55
       'partial_path' : PARTIAL_PATH_ARG_PATTERN,
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 409
diff changeset
    56
       'link_name': LINKNAME_PATTERN_CORE})
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
PATH_LINKNAME_PATTERN = r'^%s$' % PATH_LINKNAME_ARGS_PATTERN
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    58
PATH_LINKNAME_REGEX = re.compile(PATH_LINKNAME_PATTERN)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    59
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    60
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
def getPartsFromPath(path):
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
  """Splits path string into partial_path and link_name.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
  
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
  Returns:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65
    {'partial_path': 'everything/but',
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    66
     'link_name': 'link_name'}
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
    or {} (empty dict) if string did not match PATH_LINKNAME_PATTERN.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    68
  """
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    69
  path_link_name_match = PATH_LINKNAME_REGEX.match(path)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    70
  
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    71
  if not path_link_name_match:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    72
    return {}
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    74
  return path_link_name_match.groupdict()
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    75
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    76
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
def combinePath(path_parts):
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
  """Returns path components combined into a single string.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    79
  
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    80
  Args:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    81
    path_parts: a single path string, or a list of path part strings,
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    82
      or a nested list of path part strings (where the zeroeth element in
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    83
      the list is itself a list); for example:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
        'a/complete/path/in/one/string'
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    85
        ['some', 'path', 'parts']
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    86
        [['path', 'parts', 'and', 'a'], 'link name']
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    87
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    88
  Returns:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    89
    None if path_parts is False (None, empty string, etc.) or if
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
    any list elements are False (an empty list, empty string, etc.);
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
    otherwise, the combined string with the necessary separators.
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    92
  """
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    93
  if not path_parts:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    94
    # completely empty input, so return early
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    95
    return None
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    96
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    97
  if not isinstance(path_parts, (list, tuple)):
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    98
    # a single path string, so just return it as-is (nothing to do)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
    return path_parts
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   100
  
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
  flattened_parts = []
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   102
  
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   103
  for part in path_parts:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   104
    if not part:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   105
      # encountered a "False" element, which invalidates everything else
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   106
      return None    
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   107
  
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   108
    if isinstance(part, (list, tuple)):
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   109
      flattened_parts.extend(part)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
    else:
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
      flattened_parts.append(part)
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   113
  return '/'.join(flattened_parts)