Thomas Wittek ha scritto:
> Hi!
>
> I'm getting to a point where my model.py gets too large for one file/
> module (for my taste).
> So I tried to split it up into several modules, but I ran into
> problems with the dependencies between the classes/mappings and I
> wonder how the other TG users handle this.
>
> A simple example would be a model handling `users` that can
> `participate` at an `event`.
> I would like to create a module for all user-related stuff (in my case
> this would be an extended TG-Identity model) and another one for the
> event-related tables/classes/mappings.
>
> Unfortunately, the mapper for the user references a participation from
> the event module and the participation table references the user
> table.
> So I have a cyclic dependency between those modules.
> In one single module you can easily resolve this dependency by
> defining *all* tables first, then all classes and last, all mappings.
> You cannot easily do this when you split up your model into several
> modules -- at least if you have the tables, classes and mappings for
> one sub-model in one module.
> My solution was to defer the creation of the mappings by putting them
> in functions that get called after all models have been loaded.
> Is there a better/more convenient way of doing this?
> How would you organize your model (and your imports, mappings)?
>
> Maybe this is more of a Python problem than a TG/SA problem. I'm
> relatively new to all of those ;)
> Thank you for any hints on this.
>
> (Maybe sub-optimal) solution to my sample problem:
>
> <CUT>
In our project we no have something like 70 model ...for now, and our 
approach is a tree of package  and module corresponding to dependencies.

Every package import all necessary, sub-package and model, so if i must 
use something , everywhere i do:


from myproj.model import something



that's all.
Glauco








-- 
+------------------------------------------------------------+
                                  Glauco Uri - Programmatore
                                    glauco(at)allevatori.com 
                               
  Sfera Carta Software®      [EMAIL PROTECTED]
  Via Bazzanese,69  Casalecchio di Reno(BO) - Tel. 051591054 
+------------------------------------------------------------+



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to