app/soc/logic/key_name.py
changeset 298 c76a366c7ab4
parent 263 9b39d93b677f
child 299 a1cc853a56e5
equal deleted inserted replaced
297:35211afcd563 298:c76a366c7ab4
    21   '"Todd Larsen" <tlarsen@google.com>',
    21   '"Todd Larsen" <tlarsen@google.com>',
    22   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    22   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    23   ]
    23   ]
    24 
    24 
    25 
    25 
    26 from soc.logic import path_linkname
    26 from soc.logic import path_link_name
    27 
    27 
    28 
    28 
    29 class Error(Exception):
    29 class Error(Exception):
    30   """Base class for all exceptions raised by this module."""
    30   """Base class for all exceptions raised by this module."""
    31   pass
    31   pass
    48   path = [partial_path]
    48   path = [partial_path]
    49   
    49   
    50   if link_name:
    50   if link_name:
    51     path.append(link_name)
    51     path.append(link_name)
    52 
    52 
    53   path = path_linkname.combinePath(path)
    53   path = path_link_name.combinePath(path)
    54 
    54 
    55   if not path:
    55   if not path:
    56     raise Error('"path" must be non-False: "%s"' % path)
    56     raise Error('"path" must be non-False: "%s"' % path)
    57 
    57 
    58   return 'Document:%s' % path
    58   return 'Document:%s' % path
   104 
   104 
   105   Raises:
   105   Raises:
   106     Error if sponsor_ln, program_ln, and link_Name combine to produce
   106     Error if sponsor_ln, program_ln, and link_Name combine to produce
   107     a "False" path (None, empty string, etc.)
   107     a "False" path (None, empty string, etc.)
   108   """
   108   """
   109   path = path_linkname.combinePath([[sponsor_ln, program_ln], link_name])
   109   path = path_link_name.combinePath([[sponsor_ln, program_ln], link_name])
   110   
   110   
   111   if not path:
   111   if not path:
   112     raise Error('"path" must be non-False: "%s"' % path)
   112     raise Error('"path" must be non-False: "%s"' % path)
   113   
   113   
   114   return 'Group/School:%s' % path
   114   return 'Group/School:%s' % path
   124 
   124 
   125   Raises:
   125   Raises:
   126     Error if sponsor_ln, program_ln, and link_Name combine to produce
   126     Error if sponsor_ln, program_ln, and link_Name combine to produce
   127     a "False" path (None, empty string, etc.)
   127     a "False" path (None, empty string, etc.)
   128   """
   128   """
   129   path = path_linkname.combinePath([[sponsor_ln, program_ln], link_name])
   129   path = path_link_name.combinePath([[sponsor_ln, program_ln], link_name])
   130   
   130   
   131   if not path:
   131   if not path:
   132     raise Error('"path" must be non-False: "%s"' % path)
   132     raise Error('"path" must be non-False: "%s"' % path)
   133   
   133   
   134   return 'Group/Organization:%s' % path 
   134   return 'Group/Organization:%s' % path