Hi, As many of you will know, I'm working on modernising the Squishdot product. As part of doing this, I thought I'd bring __init__.py into line with the stuff on the Interfaces Wiki (sorry for missing this earlier, Michel ;-) and in the Boring product. Okay, starting with Squishdot 0.3.4, I changed http://www.bay-c.co.uk/init.py.old to http://www.bay-c.co.uk/init.py.new The restart went fine, but now when I try to 'Add a Squishdot Site' I get the following. I am totally at a loss as to why :( Any ideas gratefully recieved... cheers, Chris Error Type: TypeError Error Value: unbound Python method must be called with SquishSite 1st argument Traceback (innermost last): File E:\Zope\2179E4~1.6\lib\python\ZPublisher\Publish.py, line 214, in publish_module File E:\Zope\2179E4~1.6\lib\python\ZPublisher\Publish.py, line 179, in publish File E:\Zope\2179E4~1.6\lib\python\Zope\__init__.py, line 202, in zpublisher_exception_hook File E:\Zope\2179E4~1.6\lib\python\ZPublisher\Publish.py, line 165, in publish File E:\Zope\2179E4~1.6\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: addSquishdotForm) File E:\Zope\2179E4~1.6\lib\python\ZPublisher\Publish.py, line 102, in call_object (Object: addSquishdotForm) File E:\Zope\2179E4~1.6\lib\python\App\special_dtml.py, line 120, in __call__ (Object: addSquishdotForm) File E:\Zope\2179E4~1.6\lib\python\DocumentTemplate\DT_String.py, line 502, in __call__ (Object: addSquishdotForm) TypeError: (see above)
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
participants (1)
-
Chris Withers