[Zope-CMF] Moving CMF product from DTML to ZPT

Greg Ward gward@python.net
Wed, 12 Feb 2003 11:44:50 -0500


Well, I managed to create a simple Product that implements a new CMF
content type for multilingual documents.  I used DTML for the skin data,
because that's what I knew (and because that's what CMFBoringProduct
uses, and I was using it as an example).

Seems like the modern thing to do, of course, is use page templates, so
I sat down and RTFM'd yesterday, and now I'm trying to convert my DTML
skin to ZPT.  Here's what I had before starting the conversion:

Products/MLDocument/__init__.py
Products/MLDocument/LocDublinCore.py
Products/MLDocument/MLDocument.py
Products/MLDocument/skins/MLDocument/mldocument_view.dtml
Products/MLDocument/skins/MLDocument/mldocument_edit_form.dtml
Products/MLDocument/skins/MLDocument/mldocument_edit.py

(LocDublinCore.py is a copy of Rainer Thaden's LocDefaultDublinCore.py,
renamed and slightly tweaked.)

Here's the skin layout I'm moving towards:

Products/MLDocument/skins/MLDocument/mldocument_view.pt
Products/MLDocument/skins/MLDocument/mldocument_edit_form.pt
Products/MLDocument/skins/MLDocument/mldocument_edit.py

I managed to get the view PT sort-of working -- it doesn't crash, at
least.  But the edit_form PT is broken and I'm quite mystified; here's
the traceback I get when I try to edit an instance of MLDocument:

  Traceback (innermost last):

      * Module ZPublisher.Publish, line 98, in publish
      * Module ZPublisher.mapply, line 56, in mapply

  AttributeError: func_code

Yes, that's all there is -- probably the shortest Zope traceback on
record.  From reading the code in ZPublisher/mapply.py, it looks as
though some object somewhere has an 'im_func' attribute but no
'func_code' attribute -- but mapply() assumes the presence of 'im_func'
implies the presence of 'func_code'.  Apparently something I've done is
violating some low-level assumption in Zope -- but how?!?  Anyone have a
clue what's going on here?

Thanks --

        Greg
-- 
Greg Ward <gward@python.net>                         http://www.gerg.ca/
Those of you who think you know everything really annoy those of us who do.