[Zope] objectValues return value

Paul Winkler pw_lists@slinkp.com
Wed, 4 Dec 2002 09:38:58 -0800


On Wed, Dec 04, 2002 at 10:17:56AM -0700, David Bear wrote:
> I wrote a script the returns a list object of all title_or_id values of objects in a folder.  The problem is when there are no objects in the folder.  The script should return a list contianing the string 'none'.. but doesn't.  In fact, the script seems to either hang or have no return value...  
> 
> Any pointers?
> 
> # returns a python list contained the title of the page templates in this folder
> list = context.objectValues('Page Template')
> if list == None:
>    return ['none']

Nope... objectValues always returns a list. Why do you expect it 
to return None?
Change that to:

if list == []:
    return ['none']

-- 

Paul Winkler
http://www.slinkp.com
"Welcome to Muppet Labs, where the future is made - today!"