[Zope] __init__.py solution?
Chris Withers
chrisw@nipltd.com
Fri, 05 May 2000 10:57:45 +0100
Hi, the problem turned out to be with mailhost_list below:
context.registerClass(
Squishdot.SquishSite,
meta_type='Squishdot Site',
constructors = (
manage_addSquishdotForm,
Squishdot.manage_addSquishdot,
Squishdot.SquishSite.mailhost_list
)
)
I solved the problem by changing this to:
context.registerClass(
Squishdot.SquishSite,
meta_type='Squishdot Site',
constructors = (
manage_addSquishdotForm,
Squishdot.manage_addSquishdot
)
)
and then adding the following back after initialise:
methods={ 'mailhost_list': Squishdot.SquishSite.mailhost_list }
Which raises two questions:
1. Is it still okay to have a methods dictionary like this. I know it works now
but are there any plans to do away with it? If there is a better/newer way, what
is it?
2. How can I replace mailhost_list so I don't need this in the first place. It's
a very simple member function:
def mailhost_list(self):
""" list of mail hosts """
try: return self.superValues(('Mail Host',))
except: return []
Is there any way I can make it a non-member function? It's used in
manage_addSquishdotForm so get a list of possible mailhosts, if there are any?
cheers,
Chris