Ticket #78 (defect)
Opened 4 years ago
Last modified 3 years ago
addtests for objectmapping bug
Status: closed (fixed)
| Reported by: | remco.boerma@gmail.com | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.0-final |
| Component: | CherryPy code | Keywords: | object mapping |
| Cc: |
at your request:
Source used:
class Root: def __init__(self): self.recursive = self def test(self,test='test',*p): return `test`,`p` test.exposed = True def default(self,test='test',*p): return 'default:',`test`,`p` default.exposed = True
| 1 | http://localhost:9000/ | Unexpected error | Not Found Error |
| 2 | http://localhost:9000/test | test: ok | ("'test'", '()') |
| 3 | http://localhost:9000/test/holyrabbit | test: ok | ('default:', "'test'", "('holyrabbit',)") |
| 4 | http://localhost:9000/test/sub/holyrabbit | test: ok | ('default:', "'test'", "('sub', 'holyrabbit')") |
| 5 | http://localhost:9000/test/sub/holyrabbit?test=foo | test: ok | TypeError?: default() got an unexpected keyword argument 'test' But this is ok, i can't handle any |
| 6 | http://localhost:9000/foo | default: ok | ('default:', "'foo'", '()') |
| 7 | http://localhost:9000/foo/test/ | default: ok | ('default:', "'foo'", "('test',)") |
| 8 | http://localhost:9000/recursive/foo/test/ | default: ok | ('default:', "'foo'", "('test',)") |
| 9 | http://localhost:9000/recursive/test | test: ok | ("'test'", '()') |
| 10 | http://localhost:9000/recursive/test/holyrabit | Default: ERROR | ('default:', "'test'", "('holyrabbit',)") This should be done by the test routine |
| 11 | http://localhost:9000/recursive/test/holyrabbit/someval | same | ('default:', "'test'", "('holyrabbit', 'someval')") Same |
| 12 | http://localhost:9000/recursive/foo | default: OK | ('default:', "'foo'", '()') |
| 13 | http://localhost:9000/recursive/foo/some | default: OK | ('default:', "'foo'", "('some',)") |
| 14 | http://localhost:9000/recursive/ | default: OK but not from the right reference | ('default:', "'recursive'", '()') this ought to be default. |
test 1 and 14 have a direct relationship. . In test 1 it fails, because in the _cphttptools.py on line 485 we test on objectPathList not to be empty. . and on line 494 the following block is never executed, because it is the first call. If it is skipped, it will not test for deafault, and after that the list is empty: so it will raise an error. So that explains 1 and 14
10 and 11 are the same error of course. . but i don't get it. Why is 10 not allowed, when 2,3,4 and 9 are all ok? it mapes to root.default instead of root.recursive.test
Attachments
Change History
02/01/05 09:35:54: Modified by rboerma
04/12/05 12:06:48: Modified by rdelon
- milestone set to 2.0-final.
04/14/05 17:46:58: Modified by rboerma
- attachment cp2bugtest.py added.
cp2bugtest ver 0.1
04/19/05 15:09:10: Modified by anonymous
04/24/05 12:33:36: Modified by rdelon
- status changed from new to closed.
- resolution set to fixed.
- Case 1 fixed in changeset #159
- Cases 10 and 11 are not bug. Only "default" can ever be called with extra parameters from the path.
- Case 14 could be debated but I think that the current behavior is fine: the trailing slash only tells CP to try recursive.index, not recursive.default
04/25/05 03:22:17: Modified by anonymous
That's changeset [159]


Be sure to reflect changes in SpecialFunctionLookup?