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

2004-02-09 Thread Lennart Regebro
From: Dieter Maurer [EMAIL PROTECTED]
 Maybe, we have a memory corruption.
 I have seen objects magically becoming None in
 Python versions with memory corruption problems (Python 2.1.1).

Also, loads of objects can become None when you do a refresh, because of
some strange bug in the refresh support that has been there since it got
integrated into the core and which nobody seems to understand.

But I guess that's not the case here, because that problem would go away
when you restart the server.



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2004-02-09 Thread Paul Winkler
On Mon, Feb 09, 2004 at 11:04:21AM +0100, Lennart Regebro wrote:
 From: Dieter Maurer [EMAIL PROTECTED]
  Maybe, we have a memory corruption.
  I have seen objects magically becoming None in
  Python versions with memory corruption problems (Python 2.1.1).
 
 Also, loads of objects can become None when you do a refresh, because of
 some strange bug in the refresh support that has been there since it got
 integrated into the core and which nobody seems to understand.

Ugh, yes, I got bit badly by that one with a product that was
on auto-refresh. A restart would *sometimes* fix the problem
for a day or a month or five minutes. Maddening.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's NANO DAEMON FUNGUS!
(random hero from isometric.spaceninja.com)

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2004-02-09 Thread Tony McDonald
Thanks again for the reply Dieter,

On 6 Feb 2004, at 21:14, Dieter Maurer wrote:

REQUEST.RESPONSE is set up in
ZServer.HTTPServer.zhttp_handler.continue_request.
It should be impossible that is is None.

Agreed.

Maybe, we have a memory corruption.
I have seen objects magically becoming None in
Python versions with memory corruption problems (Python 2.1.1).
--
Dieter


Could be memory perhaps, but this is python2.3.3.

Christian Heimes wrote:
[...]
And the next one:

Python2.3.3/Zope2.70rc2/Plone2rc5.

Exception Type
AttributeError
Exception Value
'str' object has no attribute 'RESPONSE'
[...]
Module Products.CMFPhoto.Photo, line 510, in clearCache
AttributeError: 'str' object has no attribute 'RESPONSE'
The relevant code line is self.REQUEST.RESPONSE.setHeader(). The error
occured at object creation.
Something really bad is going on!

Christian


The problem I'm having is that these are all stock Zope products from a 
Zope2.7.0rc2 release. The traceback is coming from the Zope core.

Traceback (innermost last):
...
  Module Shared.DC.Scripts.Bindings, line 320, in
__render_with_namespace__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module App.special_dtml, line 175, in _exec
  Module DocumentTemplate.DT_Util, line 201, in eval
   - __traceback_info__: RESPONSE
  Module string, line 0, in ?
AttributeError: 'NoneType' object has no attribute 'setHeader'
This also seems different from what Christian is reporting;

Christian Heimes wrote at 2004-2-6 23:01 +0100:
And the next one:
Python2.3.3/Zope2.70rc2/Plone2rc5.

Exception Type
AttributeError
Exception Value
'str' object has no attribute 'RESPONSE'
[...]
Module Products.CMFPhoto.Photo, line 510, in clearCache
AttributeError: 'str' object has no attribute 'RESPONSE'
The relevant code line is self.REQUEST.RESPONSE.setHeader(). The error
occured at object creation.
Something really bad is going on!
So, I'm still baffled by this.

Many thanks to all those providing more data points. I *think* this is 
a 'Zope' thing and not a 'Tone' thing, but I've been wrong in that area 
before ;)

cheers
tone.
--
Dr Tony McDonald, Asst Director, FMSC. 0191 245 4223
Project Manager, FDTL-4 ePortfolios http://www.eportfolios.ac.uk/
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


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

2004-02-09 Thread Dieter Maurer
Lennart Regebro wrote at 2004-2-9 11:04 +0100:
From: Dieter Maurer [EMAIL PROTECTED]
 ... objects turned into None ...

Also, loads of objects can become None when you do a refresh, because of
some strange bug in the refresh support that has been there since it got
integrated into the core and which nobody seems to understand.

I think I understand it.

   When Python delete a module it lets the objects in the module become
   None.

   Refresh works by deleting the product modules from sys.modules
   and then forcing the ZODB caches to be reset when a ZODB
   connection is opened the next time.

This turning into None is not unintelligent.
Without it, you could use an old and no longer current object
without noticing it...

-- 
Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Adapters in Zope 2

2004-02-09 Thread Santi Camps
Hi all,

I know that adaptors are introduced in zope3 but, anybody knows if this
technique can be used in zope2 ?

I've been trying to add some extra functionallity to a Folder object
without inheriting, but I'm not able to make it work.  To maintain the
adapted object publishable I've rewrited __getattr__, but then some
extra problems appears.  

Anybody knows if there is a way to use adapters in zope2 ?  Or, if not,
there is some other way to add functionallity on-the-fly, without
inheriting ?

Thanks in advance

-- 
Santi Camps
http://zetadb.sourceforge.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2004-02-09 Thread Shane Hathaway
On Mon, 9 Feb 2004, Lennart Regebro wrote:

 From: Dieter Maurer [EMAIL PROTECTED]
  Maybe, we have a memory corruption.
  I have seen objects magically becoming None in
  Python versions with memory corruption problems (Python 2.1.1).
 
 Also, loads of objects can become None when you do a refresh, because of
 some strange bug in the refresh support that has been there since it got
 integrated into the core and which nobody seems to understand.

It's actually a behavior of Python itself.  When Zope's Refresh calls
Python's reload() builtin, reload() twiddles the old functions and methods
in such a way that all old globals are set to None.  If you have the
misfortune of calling an old function or method, it's likely to fail in
the manner Dieter described.  It is not memory corruption.  It is the
intended behavior.

Therefore, reload() only works if you can reliably sever all references to
functions or methods in the old module.  Zapping the ZODB cache
accomplishes most of that, but there are still cases that bite people.

I think the only way to make Refresh work reliably is to create a special 
kind of module that's explicitly refreshable.  The module would obey some 
special rules.  Fortunately, that's just what Zope 3's persistent modules 
will do.  For now, you just have to be aware that Refresh is designed only 
for simple products that do not create or use module-level registries.

Shane

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )