[PEAK] ZConfig and peak naming
Phillip J. Eby
pje at telecommunity.com
Thu Jul 29 17:22:44 EDT 2004
At 10:38 PM 7/29/04 +0200, Roché Compaan wrote:
>I need a key in ZConfig file that needs to set a file object as
>attribute on a subclass of binding.Component *and* values should be
>specifiable as peak urls.
> file pkgfile:jack/somefile.txt
>The above configuration, must set 'file' in:
> class Process(binding.Component):
> file = binding.Make(lambda:None)
>if 'file' is defined as key in my schema file:
> <sectiontype name="process" datatype=".Process.fromZConfig">
> <key name="file" datatype="some.peak.component.fromZConfig"
>Is there a peak component that can do this for me, or do I have to write
Do something like this:
fileURL = binding.Require("URL needed", adaptTo=naming.IStreamFactory)
file = binding.Obtain(naming.Indirect('fileURL'))
And make the 'attribute' for 'file' be 'fileURL' instead.
'naming.Indirect("some_name")' translates to, "use the object you find at
'some_name' as a name to look up".
More information about the PEAK