On Jan 8, 2008 6:13 PM, Jonathan LaCour <[EMAIL PROTECTED]> wrote:
> What follows is an email from Ben Bangert regarding an odd bug, that
> appears to be a race condition. I am in meetings for the next couple
> of days, so I won't have a chance to look at this before then. If
> anyone else could help me out by taking a look, it would be great!
>
> Gaetan -- you might have some insight here. It looks to me like
> something is happening inside setup_all() before the classes have all
> had time to fully load.
Here I get a traceback ending with:
File "/home/ged/devel/elixir/trunk/elixir/relationships.py", line
427, in target
self._target = caller_entities[classname]
KeyError: 'Party'
My initial impression is that this problem is caused by a pattern for
specifying relationships target that I didn't think of at the time
(even though it looks pretty natural now that I see it).
The two ways which are currently supported are:
- full path addressing (including module the name in all targets)
eg. parties = OneToMany('party.Party')
- local (in the frame where the "source" entity is defined) references:
eg. (in datafolder.py)
from party import Party
class DataFolder(Entity):
...
parties = OneToMany('Party')
Now, why it works in python2.4, I honestly don't know.
FWIW, improving the "target" resolving code is ticket #9
(http://elixir.ematia.de/trac/ticket/9). I'll add a note to the ticket
to make sure I try to get Ben's way of doing things to work when I
tackle that ticket.
> Begin forwarded message:
>
> > From: Ben Bangert <[EMAIL PROTECTED]>
> > Date: January 8, 2008 1:29:39 AM EST
> > To: Jonathan LaCour <[EMAIL PROTECTED]>
> > Subject: Elixir bug
> >
> > Ok, I made a small directory of some base models. On my mac, and my
> > linux box, the first 'python __init__.py' pops up an exception,
> > later runs are fine. Removing the .pyc causes it to occur again.
> > Interesting note, this does NOT happen with python2.4, just Python
> > 2.5. No idea....
> >
> > Taking it another step, make a new Pylons project with pylons-dev,
> > use sqlalchemy options, wipe the model dir, and copy this dir in as
> > model instead. paster shell will *always* throw the exception.
> > There's definitely some sort of race condition going on, playing
> > with the models, which ones __init__ loads, etc. seems to change the
> > behavior in totally random ways as well.
> >
> > Enjoy!
--
Gaƫtan de Menten
http://openhex.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---