I'm having problems with CherryPy's argument matching - here's my code:
------------------------
class Root(controllers.RootController):
Project = ProjectCTR()
class ProjectCTR(identity.SecureResource):
require = identity.not_anonymous()
@expose()
def default(self,proj='New',sect='Edit',*args,**kargs):
self.project = model.Project.selectBy(id=proj)
if sect == 'Edit':
return self.Edit()
@expose(template="organizer.templates.project_edit")
def Edit(self):
pass
-----------------------
I want the Edit method to handle any arguments passed beyond the
project and section arguments, but for some reason it seems to be
assigining duplicate keyword indexes to positional arguments.
requesting the URL '/Project/1/Edit/Subsection' produces the following
error:
------------------------
Page handler: <function _wrapper at 0x2aaaaabb68c0>
Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 105, in _run
self.main()
File
"/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 254, in main
body = page_handler(*virtual_path, **self.params)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg/turbogears/identity/conditions.py",
line 275, in _wrapper
return fn( *args, **kw )
File "<string>", line 3, in default
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg/turbogears/controllers.py",
line 326, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg/turbogears/database.py",
line 246, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg/turbogears/controllers.py",
line 343, in <lambda>
mapping, fragment, args, kw)))
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg/turbogears/controllers.py",
line 367, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg/turbogears/errorhandling.py",
line 71, in try_call
return func(self, *args, **kw)
TypeError: default() got multiple values for keyword argument 'proj'
--------------------
Am i overlooking something or is this a bug?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---