thats the correct behavior (which was broken previous to 0.2.8 or so). remove the "delete-orphan" cascade from the mapping, else you cannot save an Action without a parent Project (thats the definition of an "orphan").
On Oct 24, 2006, at 7:39 AM, saw wrote: > > This may be related. I'm pretty sure this worked in 0.2.6. It's not > working in 0.3. If I create an action without a project (project is > None): > action = Action(title=title, notes=notes, project=project, > context=context, priority=int(priority), closed=0) > action.flush() > > I get "FlushError: instance <xxx> is an unsaved, pending instance and > is an orphan (is not attached to any parent 'Project' instance via > that > classes' 'actions' attribute) > > projectmapper = assign_mapper(session.context, Project, projects, > properties={ > 'actions' : relation(Action, backref='project', > order_by=actions.c.priority, cascade="all, delete-orphan"), > }) > > this doesn't work either: > projectmapper = assign_mapper(session.context, Project, projects, > properties={ > 'actions' : relation(Action, backref=backref > ('project',lazy=False), > order_by=actions.c.priority, cascade="all, delete-orphan"), > }) > > model: > http://kaizen.googlecode.com/svn/trunk/kaizen/model.py > > > cheers, > Sakke Wiik > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy -~----------~----~----~----~------~----~------~--~---