What's the error? Works for me.
On Friday, 31 August 2012 16:00:24 UTC-5, Paolo wrote:
>
> Hi Massimo,
> I made a simple app, accordingly this example the error seems related
> to the cache, because without the cache all works fine.
>
> The model:
> db.define_table('reviews_like_s',
> Field('review_id', 'reference reviews'),
> Field('helpful', 'boolean'))
>
> db.define_table('reviews_s',
> Field('title'))
> db.reviews_s.pos = Field.Lazy(lambda row:
> db((db.reviews_like_s.review_id == row.reviews_s.id) &
> (db.reviews_like_s.helpful == True)).count() )
> db.reviews_s.neg = Field.Lazy(lambda row:
> db((db.reviews_like_s.review_id == row.reviews_s.id) &
> (db.reviews_like_s.helpful == False)).count() )
>
>
> Function:
> def test():
> id = db.reviews_s.insert(title='xxx')
> db.reviews_like_s.insert(review_id=id, helpful=True)
> rows = db(db.reviews_s.id > 0).select( cache=(cache.ram,3600) )
> return dict(reviews=rows)
>
> The view:
> {{for review in reviews:}}
> <p>{{=review.pos()}}</p>
> {{pass}}
>
> On my side the first time works well, the second rises the error.
>
> Best,
> Paolo
>
>
> 2012/8/30 [email protected] <javascript:>
> <[email protected]<javascript:>>:
>
> > Hi Massimo,
> > no, I do not have multiple models, I have defined the string
> > connection only once in db.py, that's all.
> > I have a few try...except but in other places, I do not thing they are
> > connected.
> > I will try to make a simple app ables to reproduce the problem as soon
> > as possible.
> >
> > Paolo
> >
> > 2012/8/30 Massimo Di Pierro <[email protected] <javascript:>>:
> >> Can you make a simple app to reproduce this?
> >>
> >> Do you have try .... except anywhere? Do you have multiple models wich
> >> define the same db = DAL(...) connection?
> >>
> >>
> >> On Thursday, 30 August 2012 15:49:01 UTC-5, Paolo wrote:
> >>>
> >>> Hi Bruno, a simple db with sqlite without modules
> >>>
> >>> db = DAL('sqlite://storage.sqlite', lazy_tables=True )
> >>>
> >>> sorry, but I've just discovered that the same problem is happened even
> >>> with lazy_tables=False
> >>> Paolo
> >>>
> >>> 2012/8/30 Bruno Rocha <[email protected]>:
> >>> > How are you defining the db connection? are you using models or
> modules?
> >>> > which db?
> >>> >
> >>> > --
> >>> >
> >>> >
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Paolo
> >>
> >> --
> >>
> >>
> >>
> >
> >
> >
> > --
> > Paolo
>
>
>
> --
> Paolo
>
--