[Zope-dev] ZPatterns Attribute Provider Problem

Christian Scholz cs@comlounge.net
Mon, 9 Apr 2001 19:31:41 +0200


Hi everybody!

I am trying to write some attribute provider for storing data inside
an SQL table as I am bored of typing parameter lists over and over
again (e.g. in every ZSQL method, in every SkinScript method etc.)

The problem now is that adding a new row to the table (and thus adding
a new object to the rack) is working well but updating an object does not.
Basically the main problem is that _objectChanged is not called in my provider.

What I did is the following:

- If an attribute of the propsheet is changed, _SetAttributeFor is called
  and stores it into the cache (as I don't want to update the database for
  every attribute change).

- _objectChanged is then supposed to create an sql query and execute it.
  This - as said - is actually not happening, as the whole method is not called.

- My namesForRegistration looks like this:

    def namesForRegistration(self,container):
	""" return names for registration """
	return {
	    'provides':('handlers','attributes'),
	    'getattr': self._attribs.keys(),
	    'setattr': self._attribs.keys(),
	    'delattr': self._attribs.keys()
	    }

  with self._attribs containing the attributes my provider is responsible for.

So is there any reason why _objectChanged is not called? Actually I am a bit
confused when reading the ZPatterns source which should call it.. ;-)
So which are the conditions under which it's supposed to be called?
(_objectAdded() as said before is called actually..)

I hope someone can help me :)

cheers,
  Christian

-- 
COM.lounge                                          http://comlounge.net/
communication & design                                 info@comlounge.net