python - Working with Beaker Cache and SQLAlchemy -


i'm trying use beaker cache sqlalchemy i've been receiving errors.

here table definitions.

class post(base):   ....   ....    user = relation(user, primaryjoin = user.id == id)   tags = relation('tags', backref = 'posts')   class tags(base):   ...   ...    user = relation(user, primaryjoin = user.id == id)   post = relation(post, primaryjoin = post.id == id) 

beaker cache works other sqlalchemy classes except these ones.

when run program, receive following error;

detachedinstanceerror: parent instance <post @ 0x101f90b10> not bound session; lazy load operation of attribute 'user' cannot proceed. 

i've searched on stackoverflow , have found in thread need disable lazy loading i've changed line

user = relation(user, primaryjoin = user.id == id) 

to

user = relation(user, primaryjoin = user.id == id, lazy='dynamic') 

but occurs following error in template(post.user.fullname);

attributeerror: 'appenderquery' object has no attribute 'fullname' 

what doing wrong?

when grab objects cache, should associate them session object, eg.

obj_from_cache = get_from_cache(key) session.merge(obj_from_cache) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -