[Zope] Acquisition not working as expected

Roman Klesel roman_plonemail at lotuseyes.de
Wed Mar 1 07:24:59 EST 2006


Hello,

sorry to come up with this again. I startet 2 pretty confused threads on the same problem allready:

[Zope] Error Value: 'File'	object	has	no	attribute	'manage_fixupOwnershipAfterAdd'
Re: [Zope] context in fs product

Unfortunatly I'm still not getting it right.
I implemeted the good advices I got in the 2 Threads, slept over it a couple of nights. Looked at the code again,
cleaned it up ... still: no success.

Here is what I'm doing:

I'm about to write a fs product to report on data generated by the "grinder load test tool"
The load tests produce various log files and sar outputs that will have to be parsed and imported into Zope.

The instance of the product is created:

def manage_addZLTMS(self,id,title='',REQUEST=None,submit=None):
	"Add a ZLMTS to a folder."
	id=id.replace(' ','_')
	zltmsObj=ZLTMS(id,title)
	id=self._setObject(id, zltmsObj)
	folder=getattr(self, id)
	folder.manage_addFolder(id='LoadTests',title='Collection')

The LoadTest folder is the place where the imported data will be stored.

The base class ...

class ZLTMS(Lasttest,Implicit, Persistent, PropertyManager, ObjectManager, SimpleItem):
	"""ZLMTS object"""

... has an import method

	def newLasttest(self, REQUEST=None):
		""" new """
		ltc=getattr(self,'LoadTests')
		ltid = self.genId(ltc)
		lt=Lasttest()
		lt.id=ltid
		ltc._setObject(ltid,lt)
		self.lt = getattr(ltc,ltid)
		self.lt.importData(self.manage_targets)

This generates and instance of the Lasttest() class and imports the data.
Lasttest() subclasses from Folder() and store all imported data in a folder hirarchy under itself.

This all works fine and I can browse the imported data in the ZMI. The problems start when I want to access the data.

eg.:

In the base class I created a test3() method:

	def test3(self):
		"""dsaf"""
		return self.getId()

I can call this method on whatever folder inside the product instance I want, it will always return the id of the
product and not the id of the product I call it on.

Why is that?

So I thought for some reasons the objects in the folder hirarchy are not acquisition wrapped. So I created another
testspace() method in the base class:

 	def testspace(self,REQUEST=None):
		"""tests"""
		if hasattr(self, 'aq_base'):
			return 'aq wraped'
		return 'not aq wraped'

I can call this on any object in the folder hirarchy and it returns:
'aq wrapped'.

Can so. please help me get this straight or hint towards further analysis that I can do.

Thanks in advance.

Greetings Roman

BTW: I did not post any code of the Lattest() class since the problem is allready present in the folder that holds its
instances. Of course I will post any part of the code you want me to.


More information about the Zope mailing list