Discussion:
[Modeling-users] problem when fetch specification has odd number of backslashes
John Lenton
2004-02-06 01:55:02 UTC
Permalink
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?
from Sample.Person import Person
from Modeling.EditingContext import EditingContext
ec=EditingContext()
ec.fetch('Person', 'firstName == "\\"')
this is python 2.3, psycopg 1.1.10, modeling... uh, how do I find out
what version of modeling I'm using?

BTW, can I help with the .deb?
--
John Lenton (***@vialibre.org.ar) -- Random fortune:
Si no puedes combatirlos, Ășnete a ellos.
-- Un injerto.
Sebastien Bigaret
2004-02-06 12:18:15 UTC
Permalink
Post by John Lenton
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?
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)
Post by John Lenton
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.
Post by John Lenton
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.

Loading...