robneville73 schrieb:
> I've searched around and I see I'm not the first to ask this...
> 
>  try:
>    DBSession.save(order)
>    DBSession.flush()
> except IntegrityError:
>    THIS NEVER EXECUTES....

This works for me, with both TG1 and TG2.

Some things you should check:

- Are you sure you really *have* an IntegrityError
   (because the DBSession maintains unique copies)?
- Did you import IntegrityError from sqlalchemy.exceptions?
- Do you have the latest zope.sqlalchemy?

Btw, I also found that bulk deletes only work with the latest 
zope.sqlalchemy 0.4. Maybe we should make this an requirement in TG2?

You can check that this work with a quickstarted project, after you have 
run paster setup-app, like this:

     from sqlalchemy.exceptions import IntegrityError
     p = model.Permission()
     p.permission_name = u'manage'
     model.DBSession.add(p)
     try:
         model.DBSession.flush()
     except IntegrityError:
         raise ValueError("Manager exists!")

I get the "Manager exists" message in my WebError Traceback.

-- Christoph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to