Sending additional parameters to HTMLFile()
In a product I am writing I have defined some lists of options:: formatTypes = ['format1', 'format2', 'format3'] userTypes = ['type1', 'type2', 'type3'] In my manage_addProductForm I need to access these lists. But it seems that it cannot be done as manage_addProductForm is called in the context of the objectmanager it is being added to. And here these attributes naturally does not exist yet. So I just wondered if there is any way to put these lists into the namespace of the objectmanager, or in some way pass them onto the HTMLfile object. I have tried to add them like:: manage_addProductForm = HTMLFile('manage_addProductForm', globals(), {'formatTypes ':['format1', 'format2', 'format3'], 'userTypes':['type1', 'type2', 'type3']}) But it doesn't work as I get an error saying that I am passing on to many parameters. regards Max M Max M. W. Rasmussen, Denmark. New Media Director private: maxmcorp@worldonline.dk work: maxm@normik.dk ----------------------------------------------------- Shipping software is an unnatural act
Max M writes:
... formatTypes = ['format1', 'format2', 'format3']
userTypes = ['type1', 'type2', 'type3'] ...
I have tried to add them like::
manage_addProductForm = HTMLFile('manage_addProductForm', globals(), {'formatTypes ':['format1', 'format2', 'format3'], 'userTypes':['type1', 'type2', 'type3']})
But it doesn't work as I get an error saying that I am passing on to many parameters. You may try (not sure that it works!) to define the names in the module namespace. Then "HTMLFile" might access them via "globals()".
I know that "PageTemplateFile" is stupid enough to use only a few definitions from the passed in "globals()". But maybe, "HTMLFile" is more intelligent. Dieter
On Thursday 03 January 2002 07:09 am, Max M allegedly wrote:
In a product I am writing I have defined some lists of options::
formatTypes = ['format1', 'format2', 'format3']
userTypes = ['type1', 'type2', 'type3']
In my manage_addProductForm I need to access these lists. But it seems that it cannot be done as manage_addProductForm is called in the context of the objectmanager it is being added to. And here these attributes naturally does not exist yet.
So I just wondered if there is any way to put these lists into the namespace of the objectmanager, or in some way pass them onto the HTMLfile object.
I have tried to add them like::
manage_addProductForm = HTMLFile('manage_addProductForm', globals(), {'formatTypes ':['format1', 'format2', 'format3'], 'userTypes':['type1', 'type2', 'type3']})
But it doesn't work as I get an error saying that I am passing on to many parameters.
regards Max M
1. Use DTMLFile instead of HTMLFile. 2. Make manage_addProductForm a regular method that calls the DTMLFile object. Like so: formatTypes = ['format1', 'format2', 'format3'] userTypes = ['type1', 'type2', 'type3'] addProductDTML = DTMLFile('manage_addProductForm') def manage_addProductForm(self, REQUEST=None): return addProductDTML(self, REQUEST, formatTypes=formatTypes, userTypes=userTypes) hth, /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/
participants (3)
-
Casey Duncan -
Dieter Maurer -
Max M