Re: problem when fetch specification has odd number of backslashes

Sebastien Bigaret <[email protected]> 06 Feb 2004 15:17:39 +0100
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
John Lenton <[email protected]> wrote:
> Whenever I do a fetch with a specification that has an odd
> (i.e. =1(2)) number of backslashes I get a very interesting
> error. Should I be escaping the specification?
> 
> For example, the following tickles the problem:
> 
>     >>> from Sample.Person import Person
>     >>> from Modeling.EditingContext import EditingContext
>     >>> ec=EditingContext()
>     >>> ec.fetch('Person', 'firstName == "\\"')

Oh my, another backslash nightmare... Sorry, but I have to answer: yes,
please escape the specification until a better solution is found.

  The fact is that different db, different adaptors do not behave the
  same way as far as backslashes are concerned. I just made some
  experimentations, and it appears that it also depends on whether the
  backslash is within a word, or at the end of the string (thus,
  backslashing the delimiting quote). I suspect there are also some
  problems with backslashes and like/ilike operators. Last I just
  noticed that an object's attribute whose value contains backslashes
  can lead to trouble.

We definitively need to fully testproof these situations, and define a
standard way of handling this (esp. regarding the way a fetch spec.
should be written), but this is will probably need some time. This is
also very close to RFE #804243: secure quoting of qualifier
(https://sf.net/tracker/index.php?func=detail&aid=804243&group_id=58935&atid=489338)

> this is python 2.3, psycopg 1.1.10, modeling... uh, how do I find out
> what version of modeling I'm using?

Mmm, ahem... well, amazing but true: you cannot :/  Thanks for noticing,
I've just added a __version__ attribute to the Modeling package, it will
be in the next release.

> BTW, can I help with the .deb?

Yes, with great pleasure ;)
We once had a discussion on this w/ Guenther Starnberger here, see:
https://sf.net/mailarchive/forum.php?thread_id=3058547&forum_id=10674

He proposed some work of his own, but till now I didn't have the time to
look at this any further --and we're definitely looking for a .deb
manager, so if you feel like helping us in releasing .deb for MDL and
the NotificationFramework, that would be great!

-- Sébastien.



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn