[PEAK] Re: first draft of a webdemo

Ulrich Eck ueck at net-labs.de
Thu Feb 26 18:41:53 EST 2004


> > > [Files *.pwt]
> > > file_factory = xslskins.StyleWrapperFactory(
> > >       style_pattern="%s_style",
> > > factory="peak.web.resources.TemplateResource" )

are you sure that this is possible a.t.m ??

[snippet from ResourceDirectory::__getitem__]

        # look up factory for name
        path = os.path.join(self.filename, filename)
        if os.path.isdir(path):
            factory = DIR_FACTORY.of(self)[prop]
        else:
            factory = FILE_FACTORY.of(self)[prop]

        # create a reference, and dereference it
        ref = naming.Reference(factory, 
addresses=[FileURL.fromFilename(path)])
        obj = ref.restore(self,None)
        obj.setParentComponent(self, filename)
        self.cache[name] = obj
        return obj


a naming.Reference takes a factoryName as first argument, 
that is restored like this:

    def restore(self, context, name):
        factory = importObject(FACTORY_PREFIX.of(context)[self.factoryName])
        factory = adapt(factory, IObjectFactory)
        return factory.getObjectInstance(context, self, name)

i haven't tried it, but i assume that your example would break with a 
key-error for peak.naming.schemes.<instance of StyleWrapperFactory>

am i right ?


-------------------------------

Ulrich Eck
net-labs Systemhaus GmbH
CEO & Code-Artist
Ebersberger Str. 46
85570 Markt Schwaben - Germany

eMail: ueck <at> net-labs.de
phone: +49 8121 4747 10
fax:   +49 8121 4747 77




More information about the PEAK mailing list