#10851: mysql CursorWrapper.execute has different prototype than CursorDebugWrapper ------------------------------------------+--------------------------------- Reporter: wdoekes | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 1 | ------------------------------------------+--------------------------------- {{{ /usr/share/python-support/python-django/django/db/backends/mysql/base.py: class CursorWrapper(object): def execute(self, query, args=None): def executemany(self, query, args): /usr/share/python-support/python- django/django/db/backends/sqlite3/base.py: class SQLiteCursorWrapper(Database.Cursor): def execute(self, query, params=()): def executemany(self, query, param_list): /usr/share/python-support/python- django/django/db/backends/postgresql/base.py: class UnicodeCursorWrapper(object): def execute(self, sql, params=()): def executemany(self, sql, param_list): /usr/share/python-support/python-django/django/db/backends/util.py: class CursorDebugWrapper(object): def execute(self, sql, params=()): def executemany(self, sql, param_list): }}}
If you're in DEBUG-mode, you get the DebugWrapper and an empty tuple as default parameter. For queries without parameters this means that you have to escape percent signs (using the double-percent). When you switch to !DEBUG, you get the regular CursorWrapper that gets a None as default. Now parameter-less queries do not want the percent-sign escaped. The fix: change {{{ def execute(self, query, args=None): }}} to {{{ def execute(self, query, args=()): }}} in /usr/share/python-support/python- django/django/db/backends/mysql/base.py Regards, Walter Doekes OSSO B.V. -- Ticket URL: <http://code.djangoproject.com/ticket/10851> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---