Can you try replace SQLField('info','blob'))
with SQLField('info','blob',default='')) On 21 Apr, 16:53, dvid <d...@atlas.cz> wrote: > Hi, > > I'm going to run a web app with database backend. I decided, that I > need something more suitable than Zope, which runs several of my > content-based sites. Pylons interested me and seems to be OK for the > purpose. But finally I decided to give the first try to web2py, which > looks really amazing.. > > So, I'm playing now, with MySQL as a backend. After a few changes in > model, attempts to list data from one of the tables (either using > database administration, or my experimental controller) started to > throw errors: > > row[tablename][fieldname]=base64.b64decode(str(value)) > TypeError: Incorrect padding > > There was nothing precious in the database, so I dropped it, system > have recreated it and the problem has gone. OK > > But now I have another problem. The form for adding record to table > "person" does nothing. No error reported, but, actually, to the db > nothing inserted. The behavior of database administration and SQLFORM > defined in my controller is the same. If I add the line manually, > using db client, it normally appears in the web2py listings, but the > insertion using web2py still does not work. > > And there is the second problem, maybe interrelated? For the foreign > keys, the form does not offer values in select box, but provides only > the regular text input field. This problem was there from the start, > even before the "Incorrect padding". I was able to insert a new > person, if I provided the valid id of a country in the corresponding > input field, but the select box would be better. In the database admin > it was as well. > > This is my tiny sandbox model: > > db = SQLDB('mysql://root:<snip>@localhost:3306/mydb) > > db.define_table('country', > SQLField('code',length=4), > SQLField('name',length=64)) > > db.define_table('person', > SQLField('name','string'), > SQLField('country',db.country), > SQLField('info','blob')) > > db.country.name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB > (db,'country.name')] > db.country.code.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB > (db,'country.code')] > db.person.name.requires = IS_NOT_EMPTY() > db.person.country.requires = [IS_IN_DB > (db,'country.id','country.name')] > > Please, any ideas? > > Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---