On 17.06.2008, at 22:24, David Abrahams wrote:
> on Wed Jun 11 2008, David Abrahams <dave-AT-boostpro.com> wrote:
>
>> on Fri Jun 06 2008, "Noah Kantrowitz" <noah-AT-coderanger.net> wrote:
>>
>>> What happens is Trac passes the SQL (with placeholders in it) and  
>>> the
>>> argument tuple to the low-level database library. That library is  
>>> what
>>> handles interpolating the arguments into the SQL+placeholders.  
>>> When it does
>>> the interpolation, it should see that the argument is a str or  
>>> Unicode
>>> object, and wrap it with quotes. If this is not happening, please  
>>> file a
>>> ticket with whatever database library you use.
>>
>> Okay, thanks for clarifying.  Of course, now we can't reproduce the
>> issue, so we'll just have to wait until we see a problem again.
>
> This looks like an example of it, FWIW:
>
>  Traceback (most recent call last):
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/api.py", line 339, in send_error
>      'text/html')
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/chrome.py", line 708, in render_template
>      if not req.session or not int(req.session.get('accesskeys', 0)):
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/api.py", line 168, in __getattr__
>      value = self.callbacks[name](self)
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/main.py", line 257, in _get_session
>      return Session(self.env, req)
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/session.py", line 142, in __init__
>      self.get_session(req.authname, authenticated=True)
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/session.py", line 156, in get_session
>      super(Session, self).get_session(sid, authenticated)
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/web/session.py", line 56, in get_session
>      (sid, int(authenticated)))
>    File "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1- 
> py2.5.egg/trac/db/util.py", line 54, in execute
>      repr(sql_escape_percent(sql)) + '\n' + repr(args)
>  Exception: invalid sql:
>  'SELECT last_visit FROM session WHERE sid=%s AND authenticated=%s'
>  'SELECT last_visit FROM session WHERE sid=%s AND authenticated=%s'
>  (u'dave', 1)

That looks like completely valid SQL to me. Note that %s does not  
imply string formatting, it's prepared statement placeholders.

So, which DB-API module are you using? There's something weird going  
on here.

Cheers,
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" 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/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to