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?



Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to