Re: [Zope3-Users] Wierd import problem

2006-03-01 Thread Darryl Cousins
Hi Florian,

To get around the circular import error use a marker interface to suit
your code.

Best regards.
Darryl

On Wed, 2006-03-01 at 08:15 -0500, Stephan Richter wrote:
> On Tuesday 28 February 2006 06:50, Florian Lindner wrote:
> > ImportError: cannot import name UserRegistrationField
> >
> >
> >
> > my views.py has:
> >
> >
> > class UserRegistrationField(TextLine):
> > implements(ITextLine)
> >
> > def _validate(self, value):
> > super(UserRegistrationField, self)._validate(value)
> > [...]
> >
> >
> > and my interfaces.py:
> >
> > from views import UserRegistrationField
> >
> > both are in the same directory. If I remove the the import everything goes
> > well. If I cut&paste the code from views.py to interfaces it works too.
> >
> > What am I doing wrong here?
> 
> This is a classical circular import error. If your views.py, for example, 
> imports interfaces.py, you have a circular import loop between views.py and 
> interfaces.py.
> 
> Regards,
> Stephan

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Wierd import problem

2006-03-01 Thread Stephan Richter
On Tuesday 28 February 2006 06:50, Florian Lindner wrote:
>     ImportError: cannot import name UserRegistrationField
>
>
>
> my views.py has:
>
>
> class UserRegistrationField(TextLine):
>     implements(ITextLine)
>    
>     def _validate(self, value):
>         super(UserRegistrationField, self)._validate(value)
> [...]
>
>
> and my interfaces.py:
>
> from views import UserRegistrationField
>
> both are in the same directory. If I remove the the import everything goes
> well. If I cut&paste the code from views.py to interfaces it works too.
>
> What am I doing wrong here?

This is a classical circular import error. If your views.py, for example, 
imports interfaces.py, you have a circular import loop between views.py and 
interfaces.py.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Wierd import problem

2006-02-28 Thread Florian Lindner
Hello,
I've a wierd problem which is supposed to be plain simple but I can't see 
it...

Zope3 gives on startup:


  File "/home/florian/Desktop/zope/lib/python/CS/user_management/views.py", 
line 2, in ?
from interfaces import IRegistrationForm
  File 
"/home/florian/Desktop/zope/lib/python/CS/user_management/interfaces.py", 
line 5, in ?
from views import UserRegistrationField
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/etc/site.zcml", line 7.2-7.55
ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/etc/package-includes/cs-configure.zcml", line 
1.0-1.24
ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/lib/python/CS/configure.zcml", line 20.4-20.42
ZopeXMLConfigurationError: File 
"/home/florian/Desktop/zope/lib/python/CS/user_management/configure.zcml", 
line 3.4-11.38
ImportError: cannot import name UserRegistrationField



my views.py has:


class UserRegistrationField(TextLine):
implements(ITextLine)

def _validate(self, value):
super(UserRegistrationField, self)._validate(value)
[...]


and my interfaces.py:

from views import UserRegistrationField

both are in the same directory. If I remove the the import everything goes 
well. If I cut&paste the code from views.py to interfaces it works too.

What am I doing wrong here?


Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users