Zope factory uses the file name not the instance method
I have two versions of an manage_addSomeForm. # zmi version manage_addTopicForm = PageTemplateFile('zpt/Topic_manage_addTopicForm', globals()) # edit version manage_addTopic = PageTemplateFile('zpt/Topic_manage_addTopic', globals()) The zmi version worked nicely. The product gets added etc. But the edit version, which is for the custom editing interface, did NOT work when I called it from a form: <input type="submit" name="/manage_addProduct/ots_Forum/manage_addTopic:method" class="button" tal:attributes="value i18n/new"> But if I call it with the filename of the Page Template instead, I get the behaviour I want. <input type="submit" name="/manage_addProduct/ots_Forum/Topic_manage_addTopic:method" class="button" tal:attributes="value i18n/new"> It is defined correctly in the constructors: constructors = (manage_addTopicForm, manage_addTopicAction, manage_addTopic, ) Does anybody know why it has this behaviour? Zope never ceases to surprise me ... regards Max M
Max M wrote at 2003-10-9 18:04 +0200:
... The zmi version worked nicely. The product gets added etc. But the edit version, which is for the custom editing interface, did NOT work when I called it from a form:
What does "did NOT work" mean? You must be very precise when you want that we can help you.
<input type="submit" name="/manage_addProduct/ots_Forum/manage_addTopic:method" class="button" tal:attributes="value i18n/new">
The leading "/" before "manage_addProduct" is strange. You are sure that the object should be created in the Root Folder? Dieter
Dieter Maurer wrote:
Max M wrote at 2003-10-9 18:04 +0200:
... The zmi version worked nicely. The product gets added etc. But the edit version, which is for the custom editing interface, did NOT work when I called it from a form:
What does "did NOT work" mean?
I get a 404. Zope cannot find the PageTemplate. Normally I don't have this problem, as I usually call the file the same name as the callable instance. Like: manage_addSomeForm = PageTemplateFile('zpt/manage_addSomeForm', globals()) Bu in this case where the filename and the instance are different I get the problem.
<input type="submit" name="/manage_addProduct/ots_Forum/manage_addTopic:method" class="button" tal:attributes="value i18n/new">
The leading "/" before "manage_addProduct" is strange. You are sure that the object should be created in the Root Folder?
No, and it doesn't. The rest of the url is in the action part of the form. Besides I have tried it both with and without the leading '/'. It doesn't matter. I don't believe that Zope uses urlparse.urljoin() when adding the action and a method button in a form. So the leading '/' doesn't get parsed as the root of the site. Also it reports the url i expect when I get the 404. regards Max M
participants (2)
-
Dieter Maurer -
Max M