[Zope3-dev] factoryFromClass: for_container

Gary Poster garyposter@earthlink.net
Mon, 15 Apr 2002 09:39:22 -0400


The zcml for adding content factories should add a for_container so that a 
fully equipped tag might look something like this (only the first three 
attributes would be required):


    <zmi:factoryFromClass
        name="Job"
        class=.Job+"
        permission_id="Zope.Public"

        title="Job" # optional (use name if absent)
        description="A job to be used in the JobBoard" # optional
        for_container=".IJobBoard+" # optional (default: IContainer)
        creation_markers=".IJob.IJobCreateMarker" # optional
	    # (default: ZMI.IGenericCreateMarker)
    />

(notice also I'm proposing a change from "marker_interface" to 
"creation_marlers" for the pre-create view stuff)

If for_container is not specified, IContainer is assumed.

This would allow addables to be cleanly associated with a container interface,
so that things like the JobBoard example, for instance, would easily have only
the one appropriate addable available to them; and so that addables like Job
would not appear in the standard addables list for a basic container.

I think this should also be used for the services "factoryFromClass"--this 
would allow ObjectHub plugins (or any other service plugins) to use the
addable/factory system, for instance. The default for_container value for the
service version would be IServiceManager, or ILocalServiceManager, using my 
naming system from a previous email.

It would also make sense to go ahead and implement the creation_markers 
system for service factories and addables as well, I think.  That will be 
virtually a non-task.

If I haven't heard any negatives or alternate suggestions on this in a couple 
of days then I'll proceed, both in adding for_container and in renaming 
creator_markers.

Gary