On Mon, Jun 22, 2009 at 2:19 PM, Erik Vorhes <e...@textivism.com> wrote:

>
> On Mon, Jun 22, 2009 at 12:52 PM, Greg Corey<gregco...@gmail.com> wrote:
> > Karen, the double % ( i.e. 'discount%%') worked. Is this a big enough bug
> > that it should be reported? I'm not sure what is a bug and what is just
> my
> > ignorance. Thank you sooo much for the help.
>
> The first % escapes the second % sign, and thus allows for the actual
> symbol to display. This is because Python uses % to include variables,
> etc., into a string. So it's not a bug at all.
>

But we're talking about the the db_column parameter for a model field
definition here.  I don't see that it's at all obvious that one should need
to escape % symbols there.  I see how down in the depths of passing SQL to
the database (for the one backend I looked at, MySQL) it needs to have been
done, when args are being passed with the SQL, because the DB backend is
going to use string interpolation to place the args into the SQL and if the
% in the column name hasn't been escaped there won't be enough actual passed
args  for the interpolation.

But I don't know if that code is the same for all backends, nor do I know if
Django consistently uses and empty tuple for the no-args case vs. passing
None for args.  If it ever does the latter, doubling the % in the db_column
specification won't work because when None is passed for args string
interpolation isn't done, and the doubled % would be passed as the column
name.

All in all I think it would be good to open a ticket to track this.  I don't
have time to look into it any more deeply right now.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to