Hi, I stubled into a strange problem, when I tried to start use the mxm-Product, which is created to help the creation of new Python-based products. I followed the example on http://www.zope.org/Members/maxm/HowTo/easyProduct/ and created mxmItem. It worked -- execpt that my own index_html or summary files are never used. Meaning the output of view is allways the standard output that mxm-product provides. Below is my the code I have. In www-directory I have the index_html.dtml and summary.dtml-files. Zope 2.4.3 and Python 2.1.1. Any help or ideas where could the problem be? Untill then I better start my product from scratch ,-( -huima --- mxmItem --- from Products.mxm import mxmSimpleItem from Globals import HTMLFile class mxmItem(mxmSimpleItem.mxmSimpleItem): meta_type = 'mxmItem' _properties = ( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'Summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, ) __ac_permissions__ = mxmSimpleItem.mxmSimpleItem.__ac_permissions__ + ( # label ('View', # methods ('summary',), # roles ('Anonymous', 'Manager'), ), ) # Used to view content of the object index_html = HTMLFile('www/index_html', globals()) # Used to view content of the object summary = HTMLFile('www/summary', globals()) ##################################################### # Constructor functions, only used when adding class # to objectManager def manage_addAction(self, id=None, REQUEST=None): "Add instance to parent ObjectManager" mxmSimpleItem.addClass(self, id, mxmItem, REQUEST) constructors = (mxmSimpleItem.manage_addForm, manage_addAction)
On Thu, Feb 14, 2002 at 04:38:36PM +0200, Heimo Laukkanen wrote:
It worked -- execpt that my own index_html or summary files are never used. Meaning the output of view is allways the standard output that mxm-product provides.
I think your indentation is off. the index_html and similar entries should be indented further in than the 'class' line. This one bit me the first time I went through it, too. I reported it as a documentation bug when I found this sort of thing in an early version of the howtos, and it's been fixed in at least some places (maybe all of them, I've not gone through both howtos extensively since then). -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
Mike Renfro wrote:
I think your indentation is off. the index_html and similar entries should be indented further in than the 'class' line. This one bit me the first time I went through it, too.
You were rigth. Experience talks I see ,-) What seems to be the cause of this behavior, I am not that familiar with Python syntax that it would be obvious to me.
I reported it as a documentation bug when I found this sort of thing in an early version of the howtos, and it's been fixed in at least some places (maybe all of them, I've not gone through both howtos extensively since then).
Atleast on: http://www.zope.org/Members/maxm/HowTo/easyProduct/ it is still present. -huima
Heimo Laukkanen wrote:
You were rigth. Experience talks I see ,-) What seems to be the cause of this behavior, I am not that familiar with Python syntax that it would be obvious to me.
The indentation tells if it belongs to the module or the class. Your "HTMLFile()" objects should belong to the class so they must be indented like a class method. 1 level deeper than the class declaration..
I reported it as a documentation bug when I found this sort of thing in an early version of the howtos, and it's been fixed in at least some places (maybe all of them, I've not gone through both howtos extensively since then).
Atleast on: http://www.zope.org/Members/maxm/HowTo/easyProduct/
it is still present.
No it isn't ;-) regards Max M
Heimo Laukkanen wrote:
Zope 2.4.3 and Python 2.1.1. Any help or ideas where could the problem be?
Indentation
Untill then I better start my product from scratch ,-(
Well that will be the same there ;-) The Easy product really is nothing elsa than starting from scratch. Just with a few default settings. So any problem you will have in making an Easy product you will have in your own products. but here is how it should look: regards Max M ########################################3 from Products.mxm import mxmSimpleItem from Globals import HTMLFile class mxmItem(mxmSimpleItem.mxmSimpleItem): meta_type = 'mxmItem' _properties = ( {'id':'title', 'type':'string', 'mode':'w'}, {'id':'Summary', 'type':'text', 'mode':'w'}, {'id':'content', 'type':'text', 'mode':'w'}, {'id':'author', 'type':'string', 'mode':'w'}, ) __ac_permissions__ = mxmSimpleItem.mxmSimpleItem.__ac_permissions__ + ( # label ('View', # methods ('summary',), # roles ('Anonymous', 'Manager'), ), ) # Used to view content of the object index_html = HTMLFile('www/index_html', globals()) # Used to view content of the object summary = HTMLFile('www/summary', globals()) ##################################################### # Constructor functions, only used when adding class # to objectManager def manage_addAction(self, id=None, REQUEST=None): "Add instance to parent ObjectManager" mxmSimpleItem.addClass(self, id, mxmItem, REQUEST) constructors = (mxmSimpleItem.manage_addForm, manage_addAction)
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Heimo Laukkanen -
Max M -
Mike Renfro