[Zope3-Users] Re: ZCML directives/InterfaceField?
Andreas Jung
lists at zopyx.com
Sun Sep 2 07:36:48 EDT 2007
Tnx, works like a charm.
-aj
--On 2. September 2007 13:08:57 +0200 Philipp von Weitershausen
<philipp at weitershausen.de> wrote:
> Andreas Jung wrote:
>> I need to write a custom ZCML directive that takes a list of interfaces
>> - something like
>>
>> interfaces="Products.Foo.intefaces.IXXX,
>> Products.Foo.interfaces.IYYY,..."
>
> We usually do it without the comma, just separated by whitespace.
>
>> What is the recommended way to specify 'interfaces' within the schema
>> definition (as InterfaceField or as TextLine)?
>>
>> InterfaceField did not work out-of-the-box complaining about a missing
>> fromUnicode attribute.
>>
>> With a TextLine: what is the recommended way to get hold of the interface
>> represented by a string? Is there some magic available somewhere in Zope
>> 3?
>
> You won't ever have to resolve an interface name yourself. We have fields
> for this. Here's the field definition for your use case above (multiple
> interfaces separated by whitespace):
>
>
> interfaces = zope.configuration.fields.Tokens(
> title=...,
> description=...,
> required=True,
> value_type=zope.configuration.fields.GlobalInterface()
> )
>
>
>
> --
> http://worldcookery.com -- Professional Zope documentation and training
--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: info at zopyx.com - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20070902/224ec909/attachment.bin
More information about the Zope3-users
mailing list