KeyError when HTMLFile returned from subobject of main instance
I have a product that takes various 'plugins' to actually provide the functionality for the system. Essentially, the main class provides an API (along with various management methods and forms) that the plugins actually implement. I've based it on exUserFolder code. I want to have TTW configuration of each plugin, which will necessarily be different for each one. To do so, I defined a method of the main class: def manage_editConverterForm(self, REQUEST): """ """ return self.currentConverter.manage_editConverterForm(self, REQUEST) The problem is, I get 'KeyError' raised when zope reaches <dtml-var manage_tabs> in the HTMLFile ('manage_editForm') defined in the currentConverter object. I presume it's because I'm not passing in the correct arguments, but I don't know what they should be if not what I've got. Anyone with enlightenment? tim
Following up to myself. If I change to a DTMLFile, I get an AttributeError: aq_parent error reported. Don't know if that aids others in helping. tim ps. Am not really clear on the difference between DTMLFile and HTMLFile except to guess that HTMLFile may behave like a DTML Document, while DTMLFile is like a DTML Method. ----- Original Message ----- From: Tim Hicks To: zope Sent: Tuesday, July 02, 2002 12:19 PM Subject: [Zope] KeyError when HTMLFile returned from subobject of main instance I have a product that takes various 'plugins' to actually provide the functionality for the system. Essentially, the main class provides an API (along with various management methods and forms) that the plugins actually implement. I've based it on exUserFolder code. I want to have TTW configuration of each plugin, which will necessarily be different for each one. To do so, I defined a method of the main class: def manage_editConverterForm(self, REQUEST): """ """ return self.currentConverter.manage_editConverterForm(self, REQUEST) The problem is, I get 'KeyError' raised when zope reaches <dtml-var manage_tabs> in the HTMLFile ('manage_editForm') defined in the currentConverter object. I presume it's because I'm not passing in the correct arguments, but I don't know what they should be if not what I've got. Anyone with enlightenment? tim
<dtml-var manage_tabs> are taken from the manage_options portion of your python code and set up the tabs across the top of the management window. The following is taken from DTMLDocument.py: manage_options=( DTMLMethod.manage_options[:2] + PropertyManager.manage_options + DTMLMethod.manage_options[2:] ) and to create your own tabs use Key:Value pairs: manage_options = ( {'label':'Edit', 'action': 'editContentForm'}, {'label':'View', 'action': 'index_html'}, {'label':'Properties', 'action': 'viewProperties'}, Where the actions are dtml files in my_product folder. I am not sure if this answers your question or not (I'm still a Zope/Python newbie) but it would seem that your KeyError would mean that Zope can not access one of the items in the manage_options code. Tim Hicks wrote:
Following up to myself.
If I change to a DTMLFile, I get an AttributeError: aq_parent error reported. Don't know if that aids others in helping.
tim
ps. Am not really clear on the difference between DTMLFile and HTMLFile except to guess that HTMLFile may behave like a DTML Document, while DTMLFile is like a DTML Method.
----- Original Message ----- From: Tim Hicks To: zope Sent: Tuesday, July 02, 2002 12:19 PM Subject: [Zope] KeyError when HTMLFile returned from subobject of main instance
I have a product that takes various 'plugins' to actually provide the functionality for the system. Essentially, the main class provides an API (along with various management methods and forms) that the plugins actually implement. I've based it on exUserFolder code.
I want to have TTW configuration of each plugin, which will necessarily be different for each one. To do so, I defined a method of the main class:
def manage_editConverterForm(self, REQUEST): """ """ return self.currentConverter.manage_editConverterForm(self, REQUEST)
The problem is, I get 'KeyError' raised when zope reaches <dtml-var manage_tabs> in the HTMLFile ('manage_editForm') defined in the currentConverter object. I presume it's because I'm not passing in the correct arguments, but I don't know what they should be if not what I've got.
Anyone with enlightenment?
tim
_______________________________________________ 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 )
-- Jason Bush --- jason@nol.org Nebraska Online http://www.nol.org
----- Original Message ----- From: "Jason Bush" <jason@nol.org> To: "Tim Hicks" <tim@sitefusion.co.uk> Cc: "zope" <zope@zope.org> Sent: Tuesday, July 02, 2002 3:23 PM Subject: Re: [Zope] KeyError when HTMLFile returned from subobject of main instance
<dtml-var manage_tabs> are taken from the manage_options portion of your python code and set up the tabs across the top of the management window.
The following is taken from DTMLDocument.py: manage_options=( DTMLMethod.manage_options[:2] + PropertyManager.manage_options + DTMLMethod.manage_options[2:] ) and to create your own tabs use Key:Value pairs: manage_options = ( {'label':'Edit', 'action': 'editContentForm'}, {'label':'View', 'action': 'index_html'}, {'label':'Properties', 'action': 'viewProperties'}, Where the actions are dtml files in my_product folder. I am not sure if this answers your question or not (I'm still a Zope/Python newbie) but it would seem that your KeyError would mean that Zope can not access one of the items in the manage_options code.
Jason, thanks for the reply. You're right, zope cannot access manage_options, but it doesn't seem to be able to access *anything* called using <dtml-var foo>. I think the problem is that I'm not calling the template correctly as HTMLFile instances that are attached to the main class (i.e. not the plugin) are rendered perfectly. cheers tim
Tim Hicks wrote:
Following up to myself.
If I change to a DTMLFile, I get an AttributeError: aq_parent error reported. Don't know if that aids others in helping.
tim
ps. Am not really clear on the difference between DTMLFile and HTMLFile except to guess that HTMLFile may behave like a DTML Document, while DTMLFile is like a DTML Method.
----- Original Message ----- From: Tim Hicks To: zope Sent: Tuesday, July 02, 2002 12:19 PM Subject: [Zope] KeyError when HTMLFile returned from subobject of main instance
I have a product that takes various 'plugins' to actually provide the functionality for the system. Essentially, the main class provides an API (along with various management methods and forms) that the plugins actually implement. I've based it on exUserFolder code.
I want to have TTW configuration of each plugin, which will necessarily be different for each one. To do so, I defined a method of the main class:
def manage_editConverterForm(self, REQUEST): """ """ return self.currentConverter.manage_editConverterForm(self, REQUEST)
The problem is, I get 'KeyError' raised when zope reaches <dtml-var manage_tabs> in the HTMLFile ('manage_editForm') defined in the currentConverter object. I presume it's because I'm not passing in the correct arguments, but I don't know what they should be if not what I've got.
Anyone with enlightenment?
tim
_______________________________________________ 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 )
-- Jason Bush --- jason@nol.org Nebraska Online http://www.nol.org
_______________________________________________ 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 (2)
-
Jason Bush -
Tim Hicks