[PEAK] (Z)ConfigLoader gives me a tuple when I just want a component

Giles Brown giles_brown at hotmail.com
Thu Jun 8 08:56:01 EDT 2006


> -----Original Message-----
> From: Phillip J. Eby [mailto:pje at telecommunity.com] 
<snipped> 
> I believe this should work:
> 
> peak.naming.factories.myschema = \
>      naming.lookup(propertyMap, 
> "ref:zconfig.schema at pkfile:mypkg/Schema.xml")[0]
> 

I get a TypeError for this being unindexable, but I tweaked the
answer and got the object out as desired.  The answer being.

"""
[Named Services]
peak.naming.factories.myschema = \
  naming.Reference('zconfig.schema',['pkgfile:mypkg/schema.xml'])

[some.place]
myobject = naming.lookup(propertyMap, "ref:myschema at myobject.cfg")[0]
"""

I'm not sure I understand why naming.lookup() works, but not
naming.Reference().
Is it because the operation of naming.Reference() relies on the kind of
repeated evaluation that comes from implementing ISmartProperty, but
that naming.lookup() actually does the lookup when the rule expression is
evaluated so that we can safely index the result of naming.lookup() but not
of naming.Reference()?

Thanks,
Giles



More information about the PEAK mailing list