Michael Bayer wrote: > > it seems from symptom 1 and symptom 2 that your objects are not > finding their way into Sessions, or are getting removed. if you > stick with the simpler pattern above, it should be clear what Session > your objects are a part of. symptom 2 also should be raising an > error instead of returning None/blank list; you should use the latest > trunk until i release 0.2.4 which fixes this issue. >
I can't use the simple pattern. I'm using a RESTful pattern in which the data record's ID is taken from the URL and looked up before the requested action is taken. So in this case, _get_item looks up the project and passes it to the save method. So how do I operate on 'project' after it is received by the saved method? I thought I could retrieve the session and go from there. def _get_item(self, atom): session = create_session(engine) query = session.query(Project) project = query.get(int(atom)) return project def save(self, project, **data): session = sqlalchemy.object_mapper(project).get_session() project.title = data['title'] session.flush() tg.flash("Changes saved!") raise tg.redirect("/") The simple patterns never seem to suffice past the tutorial stage. Requirements get complicated really quickly. Randall Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users