Absolutely sure. Here's the deal though, I can't get it fail running
the nosetests. However, IF I run the server and manually call it in a
browser, the part that I claim never executes, well it executes just
fine. I altered my test to verify that the referenced DB object is in
fact absent before invoking the controller method, still nada. So, it
works in development.ini but not test.ini. That may well be my problem
as development.ini is pointing to a PostgresDB and test.ini is a
sqlite db. Does sqlite not support foreign key refs or something?
Thanks in advance...

On Mar 11, 3:50 am, Christoph Zwerschke <[email protected]> wrote:
> 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