[Zope] A quick zope/python question
Jonathan
dev101 at magma.ca
Tue May 9 11:18:25 EDT 2006
I have a short python script:
gc = context.restrictedTraverse('coup/temp_folder/GarbageCollector', None)
print 'gc=',str(gc)
if gc:
print 'GarbageCollector exists'
else:
print 'No GarbageCollector'
which, when run produces:
gc= <TransientObjectContainer at GarbageCollector>
No GarbageCollector
Which is really strange because 'gc' was just reported to be a TOC!
When the script is changed to:
gc = context.restrictedTraverse('coup/temp_folder/GarbageCollector', None)
print 'gc=',str(gc)
if gc is not None:
print 'GarbageCollector exists'
else:
print 'No GarbageCollector'
I get the expected response:
gc= <TransientObjectContainer at GarbageCollector>
GarbageCollector exists
I think I am misunderstanding something basic about python/zope here. Why
does a TOC object evaluate to false?
Thanks,
Jonathan
More information about the Zope
mailing list