[Zope] Acquisition not working as expected

Roman Klesel roman_plonemail at lotuseyes.de
Thu Mar 2 09:45:42 EST 2006


Hello,

Roman Klesel schrieb:
 > 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.

In order to make my problem more obvious I created a minimal product. See attachmet.

It displays exactly the problem I'm facing:

A method in the base class that returns self.id, returns the id of the base class on all subfolders it is called.

Code:

 __doc__="""This is Minimal"""
__version__='0.1'

from Globals import InitializeClass, Persistent
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from AccessControl import ClassSecurityInfo
from Acquisition import Implicit
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
import OFS


class minimal(Persistent,Implicit,ObjectManager,SimpleItem):
	"minimal object"
	security = ClassSecurityInfo()
	meta_type = 'minimal'
	
	def __init__(self, id):
		"initialise a new instance of Minimal"
		self.id = id

	index_html=PageTemplateFile('zpt/index.html',globals())

	security.declarePublic('sayHello')
	def sayHello(self):
		"""just says hello"""
		return 'Hello'
	def showId(self):
		return self.id
	
def manage_addMinimal(self, REQUEST=None):
	"Add a Minimal to a folder."
	self._setObject('minimal_id', minimal('minimal_id'))
	min_obj = getattr(self,'minimal_id')
	min_obj.manage_addFolder('tfolder')
	if REQUEST is not None:
		try:
			destURL=self.DestinationURL()
		except:
			destURL=REQUEST['URL1']

	REQUEST.RESPONSE.redirect(destURL+'/manage_main')			
	return ''	

InitializeClass(minimal)


Any ideas anyone?

Greetings Roman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal.tar.gz
Type: application/x-gzip
Size: 2307 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20060302/20a83a41/minimal.tar.bin


More information about the Zope mailing list