Skip to content
Snippets Groups Projects
Commit 2c81bd3d authored by Magnus Giesbert's avatar Magnus Giesbert
Browse files

add function to get pagenames without namespace

parent 34e424fb
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,17 @@ import re ...@@ -5,6 +5,17 @@ import re
import datetime import datetime
def strip_namespace(full_name):
"""Returns the pure pagename without namespace
If a namespace withoput pagename is given like "n1:n2:" then the last namespace is returned
"""
split = full_name.split(":")
if len(split) > 1 and split[-1] == "":
return split[-2]
else:
return split[-1]
def move_page(original_page, new_page, delete=False): def move_page(original_page, new_page, delete=False):
"""Moves a page, updates link to new page and flags or deletes the old one""" """Moves a page, updates link to new page and flags or deletes the old one"""
with Proxy(config.WIKI_API_URL) as proxy: with Proxy(config.WIKI_API_URL) as proxy:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment