1.1 --- a/MoinSupport.py Mon Jan 23 23:23:20 2012 +0100
1.2 +++ b/MoinSupport.py Mon Feb 06 23:23:38 2012 +0100
1.3 @@ -179,15 +179,31 @@
1.4 self.subcategory = "/".join(parts[1:])
1.5
1.6 def get_parts(self):
1.7 +
1.8 + "Return the category, subcategory parts."
1.9 +
1.10 return self.category, self.subcategory
1.11
1.12 def get_specificity(self):
1.13 +
1.14 + """
1.15 + Return the specificity of the media type in terms of the scope of the
1.16 + category and subcategory, and also in terms of any qualifying
1.17 + parameters.
1.18 + """
1.19 +
1.20 if "*" in self.get_parts():
1.21 return -list(self.get_parts()).count("*")
1.22 else:
1.23 return len(self.parameters)
1.24
1.25 def permits(self, other):
1.26 +
1.27 + """
1.28 + Return whether this media type permits the use of the 'other' media type
1.29 + if suggested as suitable content.
1.30 + """
1.31 +
1.32 if not isinstance(other, MediaRange):
1.33 other = MediaRange(other)
1.34
1.35 @@ -203,6 +219,12 @@
1.36 return False
1.37
1.38 def __eq__(self, other):
1.39 +
1.40 + """
1.41 + Return whether this media type is effectively the same as the 'other'
1.42 + media type.
1.43 + """
1.44 +
1.45 if not isinstance(other, MediaRange):
1.46 other = MediaRange(other)
1.47
1.48 @@ -494,7 +516,7 @@
1.49 title = page.split_title(force=1)
1.50 return getPrettyTitle(title)
1.51
1.52 -def linkToPage(request, page, text, query_string=None):
1.53 +def linkToPage(request, page, text, query_string=None, **kw):
1.54
1.55 """
1.56 Using 'request', return a link to 'page' with the given link 'text' and
1.57 @@ -502,7 +524,7 @@
1.58 """
1.59
1.60 text = wikiutil.escape(text)
1.61 - return page.link_to_raw(request, text, query_string)
1.62 + return page.link_to_raw(request, text, query_string, **kw)
1.63
1.64 def linkToResource(url, request, text, query_string=None):
1.65