On 9/25/07, jean-marc pouchoulon <[EMAIL PROTECTED]> wrote: > > > >> What version of Elixir are you using? And what version of SQLAlchemy? > >> > last svn > > > in tg-admin shell (TG 1.0.3.2, elixir trunk 211) you get this error > > until you do a "elixir.setup_all()" > > > > adding elixir.setup_all() at the end of model.py solves the problem. > > > yes it works . thanks > A bit magic but this is an elixir, isn't it ? > More an elixir question list but what is doing setup_all() ( the setup > of course but what else ...)
Elixir takes all the "entities" (ie elixir classes) it knows of, and create the corresponding SQLAlchemy mapper and table for those. Previously, this happened as soon as the class was defined, but this imposed some pretty harsh limitation on what you could do in your entities. Now it happens whenever you call setup_all OR when you access some specific attributes on the class. The recommented way is to call setup_all explicitely, but for backward compatibility, I provided that attribute hackery to trigger the setup_all automatically. And what happens here is that, get_by should be one of those "trigger" attributes (or rather "query" which is used by get_by), but I forgot to put it there. In while I'm here, I'm more and more tempted to remove that auto-setup hack altogether (or turn it off by default). Although that'd break a lot of code, it'd be more explicit and would probably lead to less bugs in the long term. Hope this helps you understand what really happens... -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

