There was a bug and I just fixed it in trunk. Also do not use
posts = db(db.posts.id == 1).select()
on GAE because ids are not sequential but random uuid.
On Sep 1, 6:24 am, "Martin.Mulone" <[email protected]> wrote:
> *********************
> /models/db.py
> ******************
>
> db.define_table('posts',
> db.Field('id', 'id'),
> db.Field('keywords', 'list:string'), #tags
> db.Field('fulltext', 'list:string'), migrate=True)
>
> posts=db(db.posts.id>0).select()
> if not posts:
>
> db.posts.insert(keywords=['key1','key2','key3'],fulltext=['full1','full2','full3'])
>
> db.posts.insert(keywords=['key10','key20','key30'],fulltext=['full10','full20','full30'])
>
> **************************
> /controllers/default.py
> **************************
>
> def index():
> response.flash = T('Welcome to web2py')
>
> keywords=[]
> fulltext=[]
> posts = db(db.posts.id == 1).select()
> if posts:
> post = posts[0]
> keywords = post.keywords
> fulltext = post.fulltext
>
> return dict(message=T('Hello
> World'),keywords=keywords,fulltext=fulltext)
>
> ****************************
> /views/default/index.html
> *****************************
>
> {{extend 'layout.html'}}
>
> {{if 'message' in globals():}}{{=H2(message)}}{{else:}}
> {{=BEAUTIFY(response._vars)}}{{pass}}
>
> <hr />
> <h1>List Problem</h1>
> <p>The problem is only on gae... correct: full1,full2,full3 ....
> key1,key2,key3</p>
>
> {{=BEAUTIFY(response._vars)}}
>
> *************************************************************
>
> And show this:
>
> In local sqlite:http://yfrog.com/0tcorrectsqlitep
>
> But in local-gae:http://yfrog.com/j3problemgaep
>
> On Sep 1, 7:16 am, "Martin.Mulone" <[email protected]> wrote:
>
> > This is a writing mistake, Massimo please take a look to the
> > application, i make it with keywords = ['keywords1','keywords2'] and
> > the problem still there.
>
> > On 1 sep, 00:21, mdipierro <[email protected]> wrote:
>
> > > there is an error right here:
>
> > > post.update_record(keywords = 'keywords1 keywords2')
>
> > > should be
>
> > > post.update_record(keywords = ['keywords1','keywords2'])
>
> > > On Aug 31, 9:45 am, "Martin.Mulone" <[email protected]> wrote:
>
> > > > I don't get the logic of this problem. This problem only ocurrs in
> > > > GAE, local works fine.
>
> > > > I'am using the new introduce features list:string
>
> > > > My db definition is similar to this (only the necesary):
>
> > > > db.define_table('posts',
> > > > db.Field('id', 'id'),
> > > > db.Field('keywords', 'list:string'), #tags
> > > > db.Field('fulltext', 'list:string'), migrate=true)
>
> > > > When i changed the content with this (before i insert the record with
> > > > no problem):
>
> > > > posts = db(db.posts.id == id).select()
> > > > if posts:
> > > > post = posts[0]
> > > > post.update_record(keywords = 'keywords1 keywords2')
>
> > > > I list the db and all is fine.
>
> > > > Then I modified the same record with this
>
> > > > posts = db(db.posts.id == id).select()
> > > > if posts:
> > > > post = posts[0]
> > > > post.update_record(fulltext = 'fulltext1 fulltext2')
>
> > > > I list the db and I have:
>
> > > > ------------> keywords = 'fulltext1 fulltext2'
>
> > > > I am really stuck with this problem.