[PEAK] (Z)ConfigLoader gives me a tuple when I just want a
component
Phillip J. Eby
pje at telecommunity.com
Tue Jun 6 11:58:08 EDT 2006
At 02:16 PM 6/6/2006 +0000, Giles Brown wrote:
>In http://peak.telecommunity.com/doc/CHANGES.txt.html I found stuff
>describing how
>to create a component as configuration property from a ZConfig schema +
>config file.
>
>""
> [Named Services]
> peak.naming.factories.myschema = \
> naming.Reference('zconfig.schema',['pkgfile:mypkg/Schema.xml'])
>
> which runs somewhat faster at lookup time. Similarly, one can also use
> 'naming.Reference("myschema",["somefile"])' in place of a
> 'naming.LinkRef("ref:myschema at filename")'. As well as being faster, for
> some use cases it's easier to 'Reference' directly than to glue together
> a 'ref:' URL string.
>"""
>
>My problem is that the return value of naming.Reference("myschema",
>["somefile"]) (after
>the property is computed) is a tuple of (component, Zconfig handler).
>
>I know this is inherited from the way ZConfig handles file loading, but I
>don't want the
>handler (I don't think). What is the most elegent way of just getting the
>component (and
>dropping the handler)?
I believe this should work:
peak.naming.factories.myschema = \
naming.lookup(propertyMap,
"ref:zconfig.schema at pkfile:mypkg/Schema.xml")[0]
More information about the PEAK
mailing list