Until now I was running trunk r660 with MySQL with few problems. With
1.56.1 a few new issues popped up. Code below works OK with 1.56.1 and
sqlite, but not with MySQL. Sessions are on the file system (default
settings), not in the DB.
If I submit the form without making any changes to it, I get a "no
such record" error from sql.py (see error msg below). If I DO make any
trivial change to field values in the form, it submits OK and is
stored in the database. If I pass t2.person_id to SQLFORM instead of
'pers' , the result is the same.
Could this be some dependency on the old t2 module I still use?
Cheers,
-Peter
# default.py:
def testmysql():
pers = db(db.t2_person.id==t2.person_id).select()[0]
form = SQLFORM(db.t2_person,pers)
if form.accepts(request.vars,session):
redirect(URL(r=request,f='index'))
return dict(form=form)
# db.py:
db.define_table('t2_person',
SQLField('name',length=40,label='MoemID',requires=IS_NOT_EMPTY
(),unique=True),
SQLField('password','password',requires=CRYPT()),
SQLField('email',requires=IS_EMAIL()),
SQLField('registration_key',length=64),
SQLField('voornaam',default=''),
SQLField('achternaam',default='',length=50),
SQLField('adres',length=100,label='Straat en huisnr',default=''),
SQLField('postcode',length=10,default=''),
SQLField('plaats',length=50,default=''),
SQLField('land',requires=IS_IN_SET
( COUNTRIES ),default='Nederland' ),
SQLField('telnr',length=20,label=T('06-nummer'),default=''),
SQLField('foto','upload',default=''),
SQLField('wiebenik','text',label='Over jou', default=''),
SQLField('created_by_ip',default='10.0.0.1'),
SQLField('created_on','datetime',default="1900-01-01 00:00:00"))
# validation business rules and widgets all disabled for this test
# error message:
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/web2py-1.56.1/gluon/
restricted.py", line 98, in restricted
exec ccode in environment
File "/Library/Python/2.5/site-packages/web2py-1.56.1/applications/
mijnmoem/controllers/default.py", line 296, in <module>
File "/Library/Python/2.5/site-packages/web2py-1.56.1/gluon/
globals.py", line 74, in <lambda>
self._caller = lambda f: f()
File "/Applications/web2py.app/Contents/Resources/applications/
mijnmoem/modules/t2.py", line 1039, in h
return f(*a,**b)
File "/Library/Python/2.5/site-packages/web2py-1.56.1/applications/
mijnmoem/controllers/default.py", line 79, in testmysql
if form.accepts(request.vars,session):
File "/Library/Python/2.5/site-packages/web2py-1.56.1/gluon/
sqlhtml.py", line 529, in accepts
self.table[record_id] = fields
File "/Library/Python/2.5/site-packages/web2py-1.56.1/gluon/sql.py",
line 982, in __setitem__
raise SyntaxError, 'No such record'
SyntaxError: No such record
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---