External Method-1-0-0 returns 404 Error when module name or function name has a trailing space
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
When filling out the Add External Method form, it is possible to include leading or trailing spaces in the module or function name. If either or both names have a leading/trailing space, the Add External Method returns and error 404 - the function or module cannot be found. It is easy for a user to incorporate a trailing space by either typing the names or cutting and pasting the names from another source.
An example stack trace with a space after the module name:
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.
Module Products.
Module Products.
Module Products.
Module App.Extensions, line 120, in getObject
NotFound: The specified module, <em>WorkflowEma
An example stack trace with a trailing space after the function name:
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.
Module Products.
Module Products.
Module Products.
Module App.Extensions, line 158, in getObject
- __traceback_info__: ('/opt/
NotFound: The specified object, <em>edit_
Suggested Solution:
In Products.
56 module=str(module)
57 function=
should be changed to
56 module=
57 function=
It may be a good idea to make these changes as well:
54 id=str(id)
55 title=str(title)
54 id=str(id).strip()
55 title=str(
This bug is easy to reproduce:
1. Create an python script with one function
2. Add the script to the Extensions directory
3. Go to the ZMI
4. Select Add External Method
5. Type the Id, Title, Module name for the python script, and Function name in the python script
6. Add a trailing or leading space to either the Function name or Module name
7 Click Add, and you will get a 404 error and the stack trace above.
8. Remove the trailing or leading space and the External method will be loaded correctly.
Changed in zope2: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
The zope2 project on Launchpad has been archived at the request of the Zope developers (see https:/ /answers. launchpad. net/launchpad/ +question/ 683589 and https:/ /answers. launchpad. net/launchpad/ +question/ 685285). If this bug is still relevant, please refile it at https:/ /github. com/zopefoundat ion/zope2.