14 lines
No EOL
472 B
Python
14 lines
No EOL
472 B
Python
def get_parent_pksk_from_path(parent_path):
|
|
if parent_path == '/':
|
|
return 'maintrunk#maintrunk'
|
|
|
|
entity, slug = parent_path.strip('/').split('/')
|
|
if entity == 'branch':
|
|
entity = 'subwiki'
|
|
elif entity != 'user':
|
|
entity = 'userprofile'
|
|
|
|
if entity not in ['userprofile', 'subwiki']:
|
|
raise ValueError(f"Invalid parent entity: {entity}. Must be 'userprofile' or 'branch'.")
|
|
|
|
return f"{entity}#{slug}" |