[Zope-CMF] Accessing the "context"

Charlie Clark charlie at begeistert.org
Tue Oct 30 11:27:29 EDT 2007


Am 30.10.2007 um 15:41 schrieb Andreas Jung:

>> Dear all,
>>
>> a simple question with hopefully a simple answer! How do I access  
>> objects
>> from an object's context or hierarchy?
>
> Acquisition? Traversal using restrictedTraverse()?

Yes, but I'm not sure which.

Say I have a DA, myDA, in my portal root and I have content type that  
needs to access this to store some attributes in an external  
database, how do I get hold of it?

import Aqcuisition

class MyContentType():
	def set_connection(self):
		self.connection = Acquisition.ac_aquire('myDA')

raises an AttributeError

I realise that this is probably down to me not getting Aqcuisition  
but this looks like how it should work going on the description of  
Aquisition.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226





More information about the Zope-CMF mailing list