# HG changeset patch # User Paul Boddie # Date 1328567018 -3600 # Node ID 150ee6859f5783deed3d20a01b0d38b50611c08c # Parent 9bde0ff6e584dcb5603ee322a9338d0ab99a76a1 Added keyword argument support to linkToPage, passing such arguments on to the underlying link_to_raw method invocation. Added some docstrings. diff -r 9bde0ff6e584 -r 150ee6859f57 MoinSupport.py --- a/MoinSupport.py Mon Jan 23 23:23:20 2012 +0100 +++ b/MoinSupport.py Mon Feb 06 23:23:38 2012 +0100 @@ -179,15 +179,31 @@ self.subcategory = "/".join(parts[1:]) def get_parts(self): + + "Return the category, subcategory parts." + return self.category, self.subcategory def get_specificity(self): + + """ + Return the specificity of the media type in terms of the scope of the + category and subcategory, and also in terms of any qualifying + parameters. + """ + if "*" in self.get_parts(): return -list(self.get_parts()).count("*") else: return len(self.parameters) def permits(self, other): + + """ + Return whether this media type permits the use of the 'other' media type + if suggested as suitable content. + """ + if not isinstance(other, MediaRange): other = MediaRange(other) @@ -203,6 +219,12 @@ return False def __eq__(self, other): + + """ + Return whether this media type is effectively the same as the 'other' + media type. + """ + if not isinstance(other, MediaRange): other = MediaRange(other) @@ -494,7 +516,7 @@ title = page.split_title(force=1) return getPrettyTitle(title) -def linkToPage(request, page, text, query_string=None): +def linkToPage(request, page, text, query_string=None, **kw): """ Using 'request', return a link to 'page' with the given link 'text' and @@ -502,7 +524,7 @@ """ text = wikiutil.escape(text) - return page.link_to_raw(request, text, query_string) + return page.link_to_raw(request, text, query_string, **kw) def linkToResource(url, request, text, query_string=None):