[Zope] a question about aq_base

2006-11-28 Thread Yuri

Hi!

here: http://docs.neuroinf.de/programming-plone/ate we can read:



   obj = brain.getObject().aq_base

why .aq_base and not only brain.getObject()? :)


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] a question about aq_base

2006-11-28 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 28 Nov 2006, at 14:23, Yuri wrote:


Hi!

here: http://docs.neuroinf.de/programming-plone/ate we can read:


   obj = brain.getObject().aq_base

why .aq_base and not only brain.getObject()? :)


You are not presenting this one line in its context. No one will be  
able to tell you whether that is necessary wherever it is mentioned,  
because no one knows the stuff you omitted.


In normal situations getObject is all you need. I don't know any  
standard situation where you would not want the returned object  
acquisition-wrapped.


jens


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFFbHEyRAx5nvEhZLIRAnC3AJ9bwRC7ca3l+1KKA1F1M6cN9972RACglzQI
QaSWjPJb6566aB1AHY+kZAI=
=HOTR
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] a question about aq_base

2006-11-28 Thread Dieter Maurer
Yuri wrote at 2006-11-28 14:23 +0100:
 here: http://docs.neuroinf.de/programming-plone/ate we can read:

 

obj = brain.getObject().aq_base

why .aq_base and not only brain.getObject()? :)

Usually, it is a bad idea to use aq_base in Zope applications
(there are special cases where it is the right thing though).
The reason: Zope usually expects to work with acquisition wrapped objects.
aq_base discards the acquisition context.


You should carefully examine the context of the code fragment above.
Maybe, the context is one of the rare situations where aq_base
is called for...



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )