On 2-mrt-2009, at 05:22, mdipierro wrote:
> Lots of small bug fixes in the last week so I posted 1.57. Please give
> it a try and let me know.
Bought the Web2py book today from Lulu and started going through Image
Blog example (section 3.6, page 51). However I can't get passed the
database /model definition as Web2py is deleting the line with the db
definition.
This is what I do:
- start web2py as: python2.6 web2py -a fubar
- point browser to http://127.0.0.1:8000
- create new app: images
- go to images' design page
- delete the existing (scaffolding) model db.py
- create new one: db.py
- enter:
db=SQLDB("sqlite://storage.db")
db.define_table('image',
SQLField('title'),
SQLField('file','upload'))
db.define_table('comment',
SQLField('image_id',db.image),
SQLField('author'),
SQLField('email'),
SQLField('body','text'))
db.image.title.requires=[IS_NOT_EMPTY(),
IS_NOT_IN_DB(db,db.image.title)]
db.comment.image_id.requires=IS_IN_DB(db,db.image.id,'%
(title)s')
db.comment.author.requires=IS_NOT_EMPTY()
db.comment.email.requires=IS_EMAIL()
db.comment.body.requires=IS_NOT_EMPTY()
- save
- go to: http://127.0.0.1:8000/images/appadmin/index
- Internal Error: NameError: name 'db' is not defined
- back to design page
- edit: db.py
- Here I notice that the previously entered line
'db=SQLDB("sqlite://storage.db")' is now missing
No matter how often I enter this line and save db.py, web2py always
seems to remove it.
I am using Web2py 1.57
Cheers, Guido
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---