[Zope-dev] Relative Imports: PEP-328

Marius Gedminas marius at gedmin.as
Wed Oct 8 01:40:17 EDT 2008


On Wed, Oct 08, 2008 at 12:14:29AM -0300, Sidnei da Silva wrote:
> I'm trying to fix some import errors, which seem to be related to PEP-328.
> 
> I'm fixing those errors this way, though I don't know if that's the
> recommended way of fixing it. Thoughts?
> 
> """
> try:
>     from DT_Util import parse_params, name_param
> except ImportError:
>     # See PEP-328
>     from .DT_Util import parse_params, name_param
> """

I'd suggest converting it to an absolute import

  from zope.documenttemplate.dt_util import parse_params, name_param

or whatever the equivalent for Zope 2 is (I'm assuming it's Zope 2,
since DT_Util is capitalized).

Marius Gedminas
-- 
My mail reader can beat up your mail reader.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20081007/c19baa7c/attachment.bin 


More information about the Zope-Dev mailing list