Skip to content
Snippets Groups Projects
Commit 1eb8a299 authored by Lukas Juhrich's avatar Lukas Juhrich Committed by Dan Michael O. Heggø
Browse files

Add a docstring to `guess_namespace`

parent 8ab48a7e
No related branches found
No related tags found
No related merge requests found
......@@ -254,6 +254,14 @@ class PageList(GeneratorList):
return cls(self.site, full_page_name, info)
def guess_namespace(self, name):
"""Guess the namespace from name
If name starts with any of the site's namespaces' names or
default_namespaces, use that. Else, return zero.
:param name: The pagename as a string (having `.startswith`)
:return: the id of the guessed namespace or zero.
"""
for ns in self.site.namespaces:
if ns == 0:
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment