[Zope-CMF] (no subject)
Kent Polk
kent@goathill.org
13 Jun 2001 20:26:37 GMT
On 13 Jun 2001 14:35:00 -0500, seb bacon wrote:
> I'm just trying to package up my proof of concept for the email-it-in
> proposals. In the __init__.py of my product, which I've based on that
> of CMFCalendar / CMFTopic, I'm calling utils.contentInit().
>
> Everything works fine, apart from the 'Product name' field for the
> Types in portal_types. This says 'CMFDefault' but I want it to say
> 'JamkitTypes'. Where does the tool get this info from? Can I make it
> happen automatically? Did I explain that at all well?
I did it the following way (I think I got this from ExtFile). Note
that this correctly (I think) fills out the tools defaults also...
In my Product module I set the following defaults :
# Factory type information
# with the Types Tool (portal_types)
factory_type_information = {
'id': 'BioSample',
'meta_type': 'BioSample',
'description': 'BioSample Inventory Folder',
'product': 'BioSample',
'icon': 'biosample_icon.gif',
'factory': 'addBioSample',
'immediate_view':'bsample_contents',
'filter_content_types': 0,
'actions': (
{'name': 'View',
'action': '',
'permissions': ('View',),
'category': 'folder'
},
{'name': 'Change Folder',
'id': 'change folder',
'action': 'bsample_edit_form',
'permissions': ('Manage properties',),
'category': 'folder'
},
{'name': 'BioSample contents',
'id': 'bsample contents',
'action': 'bsample_contents',
'permissions' : ('Access contents information',),
'category': 'folder'
},
), # End Actions
}
Then in __init__.py :
-----------------
ftis = (BioSample.factory_type_information, )
then in initialize:
contentClasses = ( BioSample.BioSample, )
contentConstructors = ( BioSample.addBioSample, )
bases = ( contentClasses )
# (Haven't gotten this far yet)
# tools = ( BioSampleTool.BioSampleTool, )
tools = ( )
ftis = (BioSample.factory_type_information, )
import sys
this_module = sys.modules[ __name__ ]
# Make the skins available as DirectoryViews.
registerDirectory('skins', globals())
z_bases = utils.initializeBasesPhase1( bases, this_module )
z_tool_bases = utils.initializeBasesPhase1( tools, this_module )
def initialize(context):
""" Initialize product """
utils.initializeBasesPhase2( z_bases, context )
utils.initializeBasesPhase2( z_tool_bases, context )
utils.ToolInit('BioSample Tool', tools=tools
, product_name='BioSample'
, icon='biosample_icon.gif'
).initialize( context )
utils.ContentInit( 'BioSample Content'
, content_types=contentClasses
, permission=ADD_FOLDERS_PERMISSION
, extra_constructors=contentConstructors
, fti=ftis
).initialize( context )
# register the icon for non-skinned (CMF) views
utils.registerIcon( BioSample.BioSample
, 'biosample_icon.gif'
, globals()
)
------------
Note that I haven't figured out how to get the folder view methods
to automatically use *my* BioSample folder methods instead of the
default folder views. I think I would have to replace the default
folder views with something that could detect when to use mine,
with the current skins for folders, *and* I haven't figure out
exactly how to get folderish items to have a correct workflow,
which is something I eventually need for this, but ... first things
first.