def split_pootle_path(pootle_path):
 slash_count = pootle_path.count(u'/')
 parts = pootle_path.split(u'/', 3)[1:]
 language_code = None
 project_code = None
 ctx = ''
 if ((slash_count != 0) and (pootle_path != '/projects/')):
  if (slash_count == 2):
   language_code = parts[0]
  elif pootle_path.startswith('/projects/'):
   project_code = parts[1]
   ctx = parts[2]
  elif (slash_count != 1):
   language_code = parts[0]
   project_code = parts[1]
   ctx = parts[2]
 (dir_path, filename) = os.path.split(ctx)
 if dir_path:
  dir_path = u'/'.join([dir_path, ''])
 return (language_code, project_code, dir_path, filename)

def split_pootle_path ( pootle_path ) : slash_count = pootle_path . count ( u'/' ) parts = pootle_path . split ( u'/' , 3 ) [ 1 : ] language_code = None project_code = None ctx = '' if ( ( slash_count != 0 ) and ( pootle_path != '/projects/' ) ) : if ( slash_count == 2 ) : language_code = parts [ 0 ] elif pootle_path . startswith ( '/projects/' ) : project_code = parts [ 1 ] ctx = parts [ 2 ] elif ( slash_count != 1 ) : language_code = parts [ 0 ] project_code = parts [ 1 ] ctx = parts [ 2 ] ( dir_path , filename ) = os . path . split ( ctx ) if dir_path : dir_path = u'/' . join ( [ dir_path , '' ] ) return ( language_code , project_code , dir_path , filename )
split an internal pootle_path into proper parts .