[Zope-dev] ZPatterns Attribute Provider Problem

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


Well, sorry for mailing to quickly, but removing 

_objectChanging() from my class solved the problem. My version simply 
wasn't setting the right status to the transaction.

(though I think that I had a reason for adding it some time ago..)

But maybe it's working now.. (but it seems so)

-- christian


On Mon, Apr 09, 2001 at 07:31:41PM +0200, Christian Scholz wrote:
> 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
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )

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