[Zope-dev] Re: Zope2.7.0rc2 AttributeError: 'NoneType' object has no attribute 'setHeader'

Leonardo Rochael Almeida leo at hiper.com.br
Sat Feb 7 21:10:01 EST 2004


On Sat, 2004-02-07 at 22:47, Christian Heimes wrote:
> Chris McDonough wrote:
>  > FWIW, this often happens when "self" isn't ultimately wrapped in a
>  > RequestContainer (as it always should be when dealing with TTW code or
>  > code that depends on REQUEST).  The string is likely something like
>  > "<Special Object Used To Force Acqusition>", which is the string that
>  > represents something when it is declared as "Acquisition.Acquired" in a
>  > class definition.
>  >
>  > The trick is finding out where the thing loses its context.  No clue in
>  > this case.
> 
> If it's "<Special Object Used To Force Acqusition>" then it's (maybe) 
> partly my fault.

That's it alright,

> type(self.REQUEST) is "<Special Object Used To Force 
> Acqusition>" when the object hasn't a real acquisition context. That's 
> for example when we are still in the __init__() part of object creation.

That's it alright :-)

> I was pretty shure that upload_data is called in an acquisition context. 
> It seems that it isn't called in a context under *every* circumstances.

In this case it's being callet by Photo.__init__ -> OFS.Image.__init__ -> Photo.update_data

Here's the traceback:

Traceback (innermost last):
  File /opt/zope/sw/Zope-264rc2/lib/python/ZPublisher/Publish.py, line 98, in publish
  File /opt/zope/sw/Zope-264rc2/lib/python/ZPublisher/mapply.py, line 88, in mapply
    (Object: PUT)
  File /opt/zope/sw/Zope-264rc2/lib/python/ZPublisher/Publish.py, line 39, in call_object
    (Object: PUT)
  File /opt/zope/sw/Zope-264rc2/lib/python/webdav/NullResource.py, line 108, in PUT
    (Object: dcp_0996.jpg)
  File /home/leo/zopes/lra.com.br/Products/CMFPhotoAlbum/PhotoAlbum.py, line 69, in PUT_factory
    (Object: unisa-congresso-brooklin)
  File /home/leo/zopes/lra.com.br/Products/CMFCore/PortalFolder.py, line 361, in invokeFactory
    (Object: unisa-congresso-brooklin)
  File /home/leo/zopes/lra.com.br/Products/CMFCore/TypesTool.py, line 709, in constructContent
    (Object: portal_types)
  File /home/leo/zopes/lra.com.br/Products/CMFCore/TypesTool.py, line 398, in constructInstance
    (Object: Photo)
  File /home/leo/zopes/lra.com.br/Products/CMFPhoto/Photo.py, line 110, in addPhoto
    (Object: unisa-congresso-brooklin)
  File /home/leo/zopes/lra.com.br/Products/CMFPhoto/Photo.py, line 174, in __init__
    (Object: dcp_0996.jpg)
  File /home/leo/zopes/lra.com.br/Products/CMFDefault/Image.py, line 147, in __init__
    (Object: dcp_0996.jpg)
  File /opt/zope/sw/Zope-264rc2/lib/python/OFS/Image.py, line 124, in __init__
    (Object: dcp_0996.jpg)
  File /home/leo/zopes/lra.com.br/Products/CMFPhoto/Photo.py, line 400, in update_data
    (Object: dcp_0996.jpg)
  File /home/leo/zopes/lra.com.br/Products/CMFPhoto/Photo.py, line 510, in clearCache
    (Object: dcp_0996.jpg)
AttributeError: 'str' object has no attribute 'RESPONSE'


Cheers, Leo




More information about the Zope-Dev mailing list