Created
January 2, 2012 14:32
-
-
Save jun66j5/1550894 to your computer and use it in GitHub Desktop.
fieldtooltip: Parameter passing in Database API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment