from zope import schema
from zope.interface import Interface
class IMyInterface(Interface):
password = schema.Password(
title=_(u"Password"),
description=_(u"Your password."),
required=True,
default=PASSWORD
)
With PasswordStrength installed (both the last release and the 4.3 branch), the validate patch in PasswordStrength raises an AttributeError during Zope startup. zope.schema bootstraps the Password field and validates the properties. Unfortunately there is no context at this point and the validate method fails, causing Zope to not start.
Checking that context is not None before attempting the validation avoids the exception, but that is probably not the correct way to fix the problem.
File "/Users/zope/site/src/my.egg/my/egg/interfaces.py", line 16, in <module>
class IMyInterface(Interface):
File "/Users/zope/site/src/my.egg/my/egg/interfaces.py", line 41, in IMyInterface
default=PASSWORD)
File "/Users/zope/buildout-cache/eggs/zope.schema-4.2.2-py2.7.egg/zope/schema/_bootstrapfields.py", line 324, in __init__
super(Text, self).__init__(*args, **kw)
File "/Users/zope/buildout-cache/eggs/zope.schema-4.2.2-py2.7.egg/zope/schema/_bootstrapfields.py", line 306, in __init__
super(MinMaxLen, self).__init__(**kw)
File "/Users/zope/buildout-cache/eggs/zope.schema-4.2.2-py2.7.egg/zope/schema/_bootstrapfields.py", line 157, in __init__
self.default = default
File "/Users/zope/buildout-cache/eggs/zope.schema-4.2.2-py2.7.egg/zope/schema/_bootstrapfields.py", line 53, in __set__
inst.validate(value)
File "/Users/zope/buildout-cache/eggs/Products.PasswordStrength-0.3.1-py2.7.egg/Products/PasswordStrength/plugin.py", line 273, in validate
reg_tool = getToolByName(context, 'portal_registration')
File "/Users/zope/buildout-cache/eggs/Products.CMFCore-2.2.8-py2.7.egg/Products/CMFCore/utils.py", line 120, in getToolByName
raise AttributeError, name
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/Users/zope/site/parts/client/etc/site.zcml", line 16.2-16.23
ZopeXMLConfigurationError: File "/Users/zope/buildout-cache/eggs/Products.CMFPlone-4.3.4.1-py2.7.egg/Products/CMFPlone/configure.zcml", line 98.4-102.10
ZopeXMLConfigurationError: File "/Users/zope/site/src/my.policy/my/policy/configure.zcml", line 15.2-15.34
ZopeXMLConfigurationError: File "/Users/zope/site/src/my.egg/my/egg/configure.zcml", line 9.2-9.32
ZopeXMLConfigurationError: File "/Users/zope/site/src/my.egg/my/egg/browser/configure.zcml", line 10.4-16.10
AttributeError: portal_registration
I have an Interface with a password field:
With PasswordStrength installed (both the last release and the 4.3 branch), the validate patch in PasswordStrength raises an AttributeError during Zope startup. zope.schema bootstraps the Password field and validates the properties. Unfortunately there is no context at this point and the validate method fails, causing Zope to not start.
Checking that context is not None before attempting the validation avoids the exception, but that is probably not the correct way to fix the problem.