u can use the timephase-separation, i.e. declare vs runtime;
i.e. use global scope in for B in A, but use runtime scope for A in B.

modB.py:
 import A
 ...

modA.py:
  def somefunc_or_method():
    import B
    ...


another solution is to have sort-of forward-text-declarations that at 
certain time are all translated into real things by someone else. But 
this has more overhead and is more usable on more larger-scale 
dependencies; i.e. all business-obj klasses

> Hi there,
>
> We have a pretty large project by now and we run into import loops.
> So I decided to restructure the code, and I hoped some people with
> more experience can comment on this.
>
> The basic problem is this:
>
> We have the database object code, mappers and tables neatly
> organized in one module (db). The controller code imports this
> module to get access to these objects. All fine.
>
> But we have another object called Connection which is a singleton
> class that actually manages the connection to our database. It is
> basically a wrapper for create_engine and contextual_session. But
> next to that it keeps info about the current login state like the
> employee, location etc. The mapped database objects need this info
> on their turn to add the current user to a new object etc. So the
> Connection object depends on the Mapped Database Objects, but the
> Mapped Database Object depend on the Connection object too.
>
> Anyone got a good tip to solve this? Or designed something similar?
>
> Thanks, Koen
>
>
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to