[Zope] ZClass wierdness
Kevin Dangoor
kid@kendermedia.com
Tue, 12 Oct 1999 13:21:46 -0400
-----Original Message-----
From: Cayce Ullman <c_ullman@yahoo.com>
To: zope@zope.org <zope@zope.org>
Date: Tuesday, October 12, 1999 1:21 PM
Subject: [Zope] ZClass wierdness
>Here is my code :
>
><!--#var standard_html_header-->
>
><dtml-with "_.getattr(AllPlayers,player)">
><dtml-call
>"setAttr('Drafted',_.getattr(AllPlayers,'draft_round'))">
></dtml-with>
>
><dtml-with
>"_.getattr(Teams,AUTHENTICATED_USER.getUserName())">
><dtml-call
>"manage_clone(_.getattr(AllPlayers,player),_['player'],
>REQUEST)">
></dtml-with>
>
><!--#var standard_html_footer-->
>
>The setAttr method is an external method I wrote
>for setting attributes, since I can't seem to
>get the manage_changeProperties to work for a ZClass.
>(I've heard others are having the same problem)
>The Drafted property is set on the original object
>and unset on the cloned one. I can't figure this
>out.
To use manage_changeProperties with a ZClass, you need to call the method on
the propertysheet itself... like:
<dtml-call "propertysheets.properties.manage_changeProperties({'Drafted' :
_.getattr(AllPlayers,'draft_round')})">
I believe the reason that you're not seeing the changed property in the
cloned object is that you are trying to clone in the same transaction.
Therefore, the changed to the Drafted property has not actually been
committed yet. The easiest thing to do might be to do a changeProperties on
the new object after cloning. Or maybe it's possible to write an external
method to commit the transaction (I don't know much about the transaction
machinery though).
Good luck!
Kevin