1.1 --- a/EventAggregatorSupport.py Tue Mar 31 00:43:20 2009 +0200
1.2 +++ b/EventAggregatorSupport.py Thu Apr 02 00:59:53 2009 +0200
1.3 @@ -92,7 +92,11 @@
1.4
1.5 # From MoinMoin.xmlrpc...
1.6
1.7 - edit_info = page.edit_info()
1.8 + if hasattr(page, "edit_info"):
1.9 + edit_info = page.edit_info()
1.10 + else:
1.11 + edit_info = page.last_edit(page.request) # MoinMoin 1.5.x and 1.6.x
1.12 +
1.13 mtime = wikiutil.version2timestamp(long(edit_info['timestamp'])) # must be long for py 2.2.x
1.14 return tuple(time.gmtime(mtime))
1.15
1.16 @@ -128,14 +132,23 @@
1.17
1.18 return "".join([s for s in verbatim_regexp.split(text) if s is not None])
1.19
1.20 +def getFormat(page):
1.21 +
1.22 + "Get the format used on 'page'."
1.23 +
1.24 + if isMoin15():
1.25 + return "wiki" # page.pi_format
1.26 + else:
1.27 + return page.pi["format"]
1.28 +
1.29 def getEventDetails(page):
1.30
1.31 "Return a dictionary of event details from the given 'page'."
1.32
1.33 event_details = {}
1.34
1.35 - if page.pi["format"] == "wiki":
1.36 - for match in definition_list_regexp.finditer(page.body):
1.37 + if getFormat(page) == "wiki":
1.38 + for match in definition_list_regexp.finditer(page.get_raw_body()):
1.39
1.40 # Permit case-insensitive list terms.
1.41
1.42 @@ -587,7 +600,12 @@
1.43
1.44 "Return a nicely formatted title/name for the given 'page'."
1.45
1.46 - return page.split_title(force=1).replace("_", " ").replace("/", u" » ")
1.47 + if isMoin15():
1.48 + title = page.split_title(page.request, force=1)
1.49 + else:
1.50 + title = page.split_title(force=1)
1.51 +
1.52 + return title.replace("_", " ").replace("/", u" » ")
1.53
1.54 def getMonthLabel(month):
1.55
1.56 @@ -601,4 +619,21 @@
1.57
1.58 return weekday_labels[weekday]
1.59
1.60 +def linkToPage(request, page, text, query_string=None):
1.61 +
1.62 + """
1.63 + Using 'request', return a link to 'page' with the given link 'text' and
1.64 + optional 'query_string'.
1.65 + """
1.66 +
1.67 + text = wikiutil.escape(text)
1.68 +
1.69 + if isMoin15():
1.70 + url = wikiutil.quoteWikinameURL(page.page_name)
1.71 + if query_string is not None:
1.72 + url = "%s?%s" % (url, query_string)
1.73 + return wikiutil.link_tag(request, url, text, getattr(page, "formatter", None))
1.74 + else:
1.75 + return page.link_to_raw(request, text, query_string)
1.76 +
1.77 # vim: tabstop=4 expandtab shiftwidth=4