[ZPatterns] _v_dm_ KeyError calling get_transaction().abort()
Itai Tavor
[email protected]
Tue, 9 Oct 2001 09:33:58 +1000
Steve Alexander wrote:
>Itai Tavor wrote:
>
>>
>>So I'm still stuck. I need to roll back the transaction before I
>>render the html method (or in this case, PT), because otherwise the
>>method shows false attributes...
>>
>>Any ideas how to get around this?
>
>
>Ok. I think I understand what you want to do.
>
>To clear the values by aborting the transaction, you'll need to get
>your "self" object again from wherever you got it originally. This
>will probably mean getting it from its Rack again.
>
>I don't think I'd solve this problem they way you're approaching it.
Thanks, Steve.
Not quite sure what you mean by "get your self object again" - do you
mean do self=self.getItem(self.id)? This trickery is a bit over my
head...
Could you please describe how you would solve this problem? I'd
really like to know if there is a better approach.
Just to make sure you understood my problem correctly: The edit
method modifies the object, and possibly modifies and creates other
related objects, with values submitted in a form. If any of these
actions cause errors, these are added to an 'errors' dictionary. I
then roll back all the changes and display the errors by rendering
the original form. The need to abort came from the fact that the form
is rendered while the object is in its new, invalid state, because
the changes have not been rolled back yet.
Thanks again,
Itai
--
--
Itai Tavor -- "Je sautille, donc je suis." --
[email protected] -- - Kermit the Frog --
-- --
-- "If you haven't got your health, you haven't got anything" --