[Zope3-Users] Registered utility is never found

FB fbo2 at gmx.net
Tue Dec 12 08:15:34 EST 2006


Hi,

On Tue, Dec 12, 2006 at 01:54:01PM +0100, Tom Gross wrote:
> Hi Frank,
> 
>    is your InitIndicator-instance implementing the IInitIndicatorFB-interface. This is absolutely 
> necessary
> for providing it as an utility. There's an easy test for this:
> 
> >>> from zope.interface.verify import verifyObject
> >>> ii = InitIndicator()
> >>> verifyObject(IInitIndicatorFB, ii)
> True
> 
> I usually put this in the docstring of classes I want to use as utilities. Just to make sure :-).

it verifies successfully. This is the *whole* class ...


class InitIndicator(Contained,Persistent):
	implements(IInitIndicator)
	def __init__(self,application='',url='',description=u''):
		self.application=application
		self.url=url
		self.description=description

...  this is the interface ... 


class IInitIndicator(Interface):
	"""A utility that is registered, when a application is initialized"""
	
	application=BytesLine(
		title=_(u"Application id"),
		description=_(u"Python package of the application which initialized the site"),
		required=False
	)
	
	url=URI(
		title=_(u"Homepage"),
		description=_(u"Homepage of the initializing application"),
		required=False,
	)
	
	description=TextLine(
		title=_(u"Short description"),
		description=_(u"Short textual description of the application"),
		default=u""
	)

... and this is all zcml related to this class:

	<utility
		provides=".interfaces.IInitIndicator"
		factory=".indicator.InitIndicator"
	/>
	<class class=".indicator.InitIndicator">
		<factory
			id="fb.init.indicator"
			title="Application information container"
			description="This utility knows about the name of the current application"
		/>
		<require permission="zope.Public" interface=".interfaces.IInitIndicator" />
		<require permission="zope.ManageServices" set_schema=".interfaces.IInitIndicator" />
	</class>


Yet, that's *really* the whole thing. There are some more browser-related
zcml-statements which I added when I realized that it just didn't work :-( .

Regards,

Frank


More information about the Zope3-users mailing list