[Zope] setting icon w/o registering

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Jun 17 13:06:16 EDT 2004



I have a class in my zope product that is derived from Folder that I
use to restrict the meta types that users of the folder can add

class ExperimentFolder(Folder):
    meta_type="IRB Experiment Folder"
    _allowed_meta_types = ('IRB Experiment',)
InitializeClass(ExperimentFolder)

I am not registering this class because the user will never add it
themselves - it will be added automatically by some other code in the
product.  Normally the icon for the object is set in the register call

def initialize(registrar):
    registrar.registerClass(
        ExperimentFolder, 
        constructors = (addForm, addFunction),
        icon = 'www/myicon.gif'
        )

but I am not currently registering it.  I could register it, but I
prefer not to populate the 'Add' list in normal folders with lots of
objects that I never intend to add from that interface.  Is there a
way to set the icon otherwise?

What would happen if I tried to register it with an empty constructor
list?


    registrar.registerClass(
        ExperimentFolder, 
        constructors = (,),
        icon = 'www/myicon.gif'
        )

Thanks!
JDH

zope 2.7



More information about the Zope mailing list