Re: [Zope] if object does not exist in python

2006-12-14 Thread Chris Withers
Garito wrote: Checks for named object inside the container that the script is in. hasattr(container, 'id') NO! This is bad for two reasons: 1. It'll acquire id from other places 2. It'll swallow any exceptions found in trying to get hold of 'id', inlcuding ConflictErrors, which is "bad"

Re: [Zope] if object does not exist in python

2006-12-13 Thread Jonathan
- Original Message - From: "Andrew Milton" <[EMAIL PROTECTED]> To: "Garito" <[EMAIL PROTECTED]> Cc: "zope" Sent: Wednesday, December 13, 2006 9:40 AM Subject: Re: [Zope] if object does not exist in python +---[ Garito ]

Re: [Zope] if object does not exist in python

2006-12-13 Thread Andrew Milton
+---[ Garito ]-- | Andrew Milton escribi?: | >+---[ David Bear ]-- | >| Can anyone show me code examples of a script that checks for the | >| existences of a named object? | > | >if namedObject in container.objectIds(): | > # object exists | >else: |

Re: [Zope] if object does not exist in python

2006-12-13 Thread Garito
Andrew Milton escribió: +---[ David Bear ]-- | Can anyone show me code examples of a script that checks for the | existences of a named object? if namedObject in container.objectIds(): # object exists else: # doesn't Checks for named object inside the container that

Re: [Zope] if object does not exist in python

2006-12-12 Thread Andrew Milton
+---[ David Bear ]-- | Can anyone show me code examples of a script that checks for the | existences of a named object? if namedObject in container.objectIds(): # object exists else: # doesn't Checks for named object inside the container that the script is in. -- An