Re: Zope 2: circular import

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

yuppie wrote:
> 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?

Put it in Shared.DC.Scripting?  ZPT and DTML already depend on it, I
think (oops, no, ZPT and PythonScript, but not DTML).  Or just put it in
a module / package in the Zope2 distribution's 'src' directory.

While we're at it, the circular import between ZServer and ZPublisher is
insane, too.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [email protected]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks3ogsACgkQ+gerLs4ltQ7n2ACfS2eKzoshRz2KuyJIsi+9WIHO
ZLcAoIfIINZDKtedf3LWfyGYoFT9iPHS
=0owd
-----END PGP SIGNATURE-----

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.