[Zope] Help: simple python method goes wrong

Julian Knight juliank@wrdc.com
Wed, 5 Jun 2002 09:39:24 +0100


I have a Python method as follows:


results=[]
for object in context.objectValues('DTML Document'):
  results=results.append(object)
return results


Calling this (from the test tab) results in: 

Error Type: AttributeError
Error Value: 'None' object has no attribute 'append'

And yet this is the same as the example on page 170/171 of the Zope
book!

Have I gone mad, or stupid? I'm using the latest version of Zope


Traceback (innermost last):
  File C:\PROGRA~1\JulianK\lib\python\ZPublisher\Publish.py, line 150,
in publish_module
  File C:\PROGRA~1\JulianK\lib\python\ZPublisher\Publish.py, line 114,
in publish
  File C:\PROGRA~1\JulianK\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook
    (Object: list)
  File C:\PROGRA~1\JulianK\lib\python\ZPublisher\Publish.py, line 98, in
publish
  File C:\PROGRA~1\JulianK\lib\python\ZPublisher\mapply.py, line 88, in
mapply
    (Object: entryListEntries)
  File C:\PROGRA~1\JulianK\lib\python\ZPublisher\Publish.py, line 39, in
call_object
    (Object: entryListEntries)
  File C:\PROGRA~1\JulianK\lib\python\Shared\DC\Scripts\Bindings.py,
line 252, in __call__
    (Object: entryListEntries)
  File C:\PROGRA~1\JulianK\lib\python\Shared\DC\Scripts\Bindings.py,
line 283, in _bindAndExec
    (Object: entryListEntries)
  File
C:\PROGRA~1\JulianK\lib\python\Products\PythonScripts\PythonScript.py,
line 291, in _exec
    (Object: entryListEntries)
    (Info: ({'script': <PythonScript instance at 015545B0>,
'context': <Folder instance at 016B8360>, 'container': <Folder
instance at 016B8360>, 'traverse_subpath': []}, (), {}, None))
  File Script (Python), line 4, in entryListEntries
  File C:\PROGRA~1\JulianK\lib\python\AccessControl\ZopeGuards.py, line
47, in guarded_getattr
AttributeError: (see above)


--
Julian Knight, Senior Consultant
WRDC Ltd, Leeds, UK.  +44 (0) 113 245 4788
http://www.wrdc.com