[Zope-dev] Zope 2: circular import

yuppie y.2009 at wcm-solutions.de
Sun Dec 27 12:21:24 EST 2009


Hi!


I stumbled over a circular import in Zope 2.


in DocumentTemplate.DT_Util:
from ZPublisher.TaintedString import TaintedString

this triggers ZPublisher.BaseRequest with:
from AccessControl.ZopeSecurityPolicy import getRoles

this triggers AccessControl.DTML with:
from DocumentTemplate import DT_Util


With try/except imports and the right import order this works, but it 
would be better to break up that circle.

At first glance the solution is simple: TaintedString doesn't have any 
dependencies and is used by DocumentTemplate and ZPublisher. So it 
should be moved to a place where both modules can use it without 
triggering countless imports.

But where would be a good place for TaintedString? It is too small to 
create a package just for that. In which existing package would it fit?

Or should we just add a copy of TaintedString to DocumentTemplate?

Any ideas?


Cheers,

	Yuppie




More information about the Zope-Dev mailing list