Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #917 (closed defect: fixed)

Opened 11 years ago

Last modified 10 years ago

Comment on docs/tutorials/wiki20/page3.html

Reported by: dazza@… Owned by: anonymous
Priority: normal Milestone:
Component: Documentation Version: 0.9a6
Severity: normal Keywords:
Cc:

Description

(NOTE: this is in the preview section of the website)

For the save method I get:

TypeError?: save() got an unexpected keyword argument 'submit'

I changed the function to be:

def save(self, pagename, data, kwds):

to get it to work.

Change History

comment:1 Changed 11 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to invalid

your looking at the wrong docs

there is a folder name newdocs you should be looking at <svnco>/newdocs/docs/tutorials/wiki20

this is also the version at

 http://www.turbogears.org/preview/docs/tutorials/wiki20/page3.html

if you where refering to something else or I'm just wrong please reopen the ticket

comment:2 Changed 11 years ago by barryh

  • Status changed from closed to reopened
  • Version changed from 0.9a5 to 0.9a6
  • Resolution invalid deleted

I don't think this person was looking at the wrong docs. I experienced the same thing in 0.9a6, as did the user in #956. The tutorial calls for a save method with the signature save(self, pagename, data), but you get a TypeError? when you do that:

Page handler: <bound method Root.save of <wiki20.controllers.Root object at 0xa73bdacc>>
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line 105, in _run
    self.main()
  File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in save
  File "/var/lib/python-support/python2.4/turbogears/controllers.py", line 273, in expose
    output = database.run_with_transaction(
  File "/var/lib/python-support/python2.4/turbogears/database.py", line 221, in run_with_transaction
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/var/lib/python-support/python2.4/turbogears/controllers.py", line 290, in <lambda>
    mapping, fragment, *args, **kw)))
  File "/var/lib/python-support/python2.4/turbogears/controllers.py", line 314, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/var/lib/python-support/python2.4/turbogears/errorhandling.py", line 71, in try_call
    return func(self, *args, **kw)
TypeError: save() got an unexpected keyword argument 'submit'

A fourth argument is needed, even though we do nothing with it. A method signature of save(self, pagename, data, submit) allows the save function to work fine; it seems that the submit button is being added to the submission just like the other form fields, so the save method has to allow for that. I have checked the documentation referenced above in Subversion, and it's the same as what's on the site. Please see my comments on #956 and see if the tutorial needs to be udpated for that particular item, the addition of the save action to controllers.py. Thanks in advance for your time.

comment:3 Changed 11 years ago by elvelind

  • Status changed from reopened to closed
  • Resolution set to fixed

This is indeed a problem in the docs. it's fixed in svn now and will be updated as soon as kevin regenerate the docs.

Note: See TracTickets for help on using tickets.