public
Created

fieldtooltip: Parameter passing in Database API

  • Download Gist
fieldtooltip.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Index: fieldtooltip/fieldtooltip.py
===================================================================
--- fieldtooltip/fieldtooltip.py (revision 11088)
+++ fieldtooltip/fieldtooltip.py (working copy)
@@ -51,10 +51,11 @@
pages = {}
cursor = db.cursor()
wiki_pages = WikiSystem(self.env).get_pages(FieldTooltip._wiki_prefix)
+ prefix_len = len(FieldTooltip._wiki_prefix)
for page in wiki_pages:
- cursor.execute("SELECT text FROM wiki WHERE name = '%s' ORDER BY version DESC LIMIT 1" % page)
+ cursor.execute("SELECT text FROM wiki WHERE name = %s ORDER BY version DESC LIMIT 1", (page,))
for text, in cursor:
- pages[page[len(FieldTooltip._wiki_prefix):]] = text
+ pages[page[prefix_len:]] = text
return pages
 
# ITemplateStreamFilter methods

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.