Jonathan wrote:
I am trying to catch a 'BadRequest' exception in the following python script excerpt:


for item in itemList:
  try:
     context.afolder.manage_delObjects([item])
  except BadRequest:
     continue


NameError: global name 'BadRequest' is not defined

The following would normally be required, but it fails with an ImportError:

   from zExceptions import BadRequest

So you could try this instead:

   for item in itemList:
      try:
         context.afolder.manage_delObjects([item])
      except:
         continue

In general, TTW coding is very limited; you can use External Methods (a.k.a. Extensions) or Products to avoid this.

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to