Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

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
1http://localhost:9000/ Unexpected errorNot Found Error
2http://localhost:9000/test test: ok("'test'", '()')
3http://localhost:9000/test/holyrabbit test: ok('default:', "'test'", "('holyrabbit',)")
4http://localhost:9000/test/sub/holyrabbit test: ok('default:', "'test'", "('sub', 'holyrabbit')")
5http://localhost:9000/test/sub/holyrabbit?test=foo test: okTypeError?: default() got an unexpected keyword argument 'test'
But this is ok, i can't handle any
6http://localhost:9000/foo default: ok ('default:', "'foo'", '()')
7http://localhost:9000/foo/test/ default: ok('default:', "'foo'", "('test',)")
8http://localhost:9000/recursive/foo/test/ default: ok('default:', "'foo'", "('test',)")
9http://localhost:9000/recursive/test test: ok("'test'", '()')
10http://localhost:9000/recursive/test/holyrabit Default: ERROR('default:', "'test'", "('holyrabbit',)")
This should be done by the test routine
11http://localhost:9000/recursive/test/holyrabbit/someval same('default:', "'test'", "('holyrabbit', 'someval')")
Same
12http://localhost:9000/recursive/foo default: OK('default:', "'foo'", '()')
13http://localhost:9000/recursive/foo/some default: OK('default:', "'foo'", "('some',)")
14http://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

cp2bugtest.py (7.0 kB) - added by rboerma on 04/14/05 17:46:58.
cp2bugtest ver 0.1

Change History

02/01/05 09:35:54: Modified by rboerma

Be sure to reflect changes in SpecialFunctionLookup?

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]

Hosted by WebFaction

Log in as guest/cpguest to create tickets