It would appear that there's a slight error or two in Chapter 7 in section
7.2.3
In the controller the book has:
def display_form():
record = db.person(request.args(0)) or redirect(URL('index'))
form = SQLFORM(db.person, record, deletable=True,
upload=URL('download'))
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
return dict(form=form)
def download():
return response.download(request, db)
And instructs the reader:
*Now, insert a new record at the URL:
http://127.0.0.1:8000/test/default/display_form*
However, if you visit that URL, you are automatically redirected to the
apps index page because of the 1st directive under display_form(), and you
are never able to actually insert a new record. You can insert a new record
with appadmin, but that's not according to the directions, and confusion
may likely result.
Also, the image preview displayed in the book on p.365 refers to a previous
db model from p.358 which included the extra fields "married", "gender",
and "profile" in addition to "name" and "image". The example in question is
utilizing a later db model mentioned on the previous page (p.364) which has
only "name" and "image" fields:
*As an example, consider the following model:*
db.define_table('person',
Field('name', requires=IS_NOT_EMPTY()),
Field('image', 'upload'))
Again, confusion may result from this discrepancy.
Thanks!
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.