Issue #78 resolved

addtests for objectmapping bug

Anonymous created an issue

at your request:

Source used: {{{


class Root: def init(self): self.recursive = self

def test(self,test='test',*p):
    return  `test`,`p` = True

def default(self,test='test',*p):
    return  'default:',`test`,`p` = 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'brBut 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',)")brThis should be done by the test routine|| ||11||http://localhost:9000/recursive/test/holyrabbit/someval ||same||('default:', "'test'", "('holyrabbit', 'someval')")brSame|| ||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'", '()')brthis ought to be default.||

test 1 and 14 have a direct relationship. . In test 1 it fails, because in the 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

Reported by

Comments (6)

  1. Anonymous

    - 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

  2. Log in to comment