Re: [SQLObject] Strange ForeignKey behavior...
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Oleg B. <ph...@ph...> - 2015-12-23 19:35:22
|
Hi!
On Wed, Dec 23, 2015 at 12:09:27PM -0500, Nathan Edwards <nj...@ge...> wrote:
>
> >> I'll see if I can figure out a minimalist patch to
> >> propose...
> >
> > Eagerly waiting! But if you don't succeed notify me -- I'll at least
> > add a TODO item.
>
> Not sure if this will be up to your coding standards, but here is an
> attempt - it uses the validator infrastructure to attempt conversion
> using the idType function of the foreign table. This will suffice to
> ensure values can be converted to the correct type, next level of
> validation would be to require the converted value to be a valid id for
> the foreign table (probably too much overhead). I think this approach is
> relatively consistent with the current style and conventions, but I'm
> sure you'll tell me if not. :-)
>
> Patch for col.py and a new test module attached.
Thank you! I need to work on it: the test doesn't work with Postgres;
I'd like to rename 'to_python' to 'from_python' and remove 'from_python'
assignment (I think there is no need to validate foreign keys when
they're fetched from the database); and I want to fix style.
> Cheers!
>
> - n
>
> --
> Dr. Nathan Edwards nj...@ge...
> Department of Biochemistry and Molecular & Cellular Biology
> Georgetown University Medical Center
> Room 1217, Harris Building,
> 3300 Whitehaven St, NW, Washington DC 20007
> Phone: 202-687-7042, Fax: 202-687-0057
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|