[Zope-dev] Relative Imports: PEP-328
Sidnei da Silva
sidnei at enfoldsystems.com
Wed Oct 8 01:47:36 EDT 2008
On Wed, Oct 8, 2008 at 2:40 AM, Marius Gedminas <marius at gedmin.as> wrote:
> I'd suggest converting it to an absolute import
>
> from zope.documenttemplate.dt_util import parse_params, name_param
So I thought at first. Except there is a problem:
Inside 'DocumentTemplate' there's another 'DocumentTemplate' module. So doing:
'from DocumentTemplate.DT_Util import parse_params'
... tries to import DT_Util from the relative module. Then the fix is to do:
'from __future__ import absolute_import'
... except that doesn't work on Python 2.4.
So the try: except seems to be the only way around here, unfortunately.
> or whatever the equivalent for Zope 2 is (I'm assuming it's Zope 2,
> since DT_Util is capitalized).
Another option might be to switch this to use zope.documenttemplate. :)
--
Sidnei da Silva
Enfold Systems http://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214
More information about the Zope-Dev
mailing list