I was trying out the QuickWiki tutorial and discovered that this code is
flawed:
models/__init__.py:
def get_wiki_content(self):
content = publish_parts(self.content,
writer_name="html")["html_body"]
titles = wikiwords.findall(content)
for title in titles:
content = content.replace(title, h.link_to(title,
h.url_for(controller='page', action='index',
title=title)))
return content
This fails if a particular WikiWord appears more than once on a page
(the title is substituted back in as the name of the link and then
substituted *again* on the next iteration).
There may be a better fix, but this works:
def get_wiki_content(self):
content = publish_parts(self.content,
writer_name="html")[ "html_body" ]
# get a list of WikiWords, filtered for duplicates
titles = dict([(w,w)
for w in wikiwords.findall(content)]).keys()
for title in titles:
content = content.replace(title, h.link_to(title,
h.url_for(controller='page', action='index',
title=title)))
return content
Regards,
Cliff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---