Well seems adding
DBSession.refresh(request.user)
at the beginning of each view relying on `request.user` voids the
problem.
Now I wonder what's the benefit form having such attribute rather than
querying each time for it in views.
Thanks for your support
neurino
On Oct 17, 3:41 pm, neurino <[email protected]> wrote:
> I implemented the procedure [explained here][1] to always have a User
> Object available as a request attribute.
>
> It always worked good in development until I deployed it with Ubuntu -
> MySQL
>
> Using SQLAlchemy User object has a `items` relationship like this:
>
> mapper(User, users,
> properties={
> 'items': relationship(Item, backref='user')
> })
>
> The crazy thing is that if I delete one or more `user.items` elements
> in a view I get it back refreshing the page even if item has been
> actually removed from db.
>
> Digging a bit and printing hex(id(request.user)) in templates I can
> see there are 2 or more instances of User where only in one item has
> been removed while it's still present in others.
>
> I can't understand where's the problem and how to solve it.
>
> Any help is really much appreciated.
>
> Thanks for your support
> neurino
>
> [1]http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/authentic...
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.