[ZPatterns] _v_dm_ KeyError calling get_transaction().abort()
Itai Tavor
[email protected]
Mon, 8 Oct 2001 12:11:33 +1000
Hi Steve,
Thanks! Wild guess it may be, but it seems to be accurate. I changed
the code to:
method = getattr(self, 'edit.html')
get_transaction().abort()
html = method(self, REQUEST, errors=errors)
raise FormError, html
Now the getattr() works, but the html = method() call doesn't, for
the same reason, except that I now get a TAL error:
Error Type: Undefined
Error Value: "_v_dm_" not found in "here/master.html/macros/master"
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?
Steve Spicklemire wrote:
>Hi Itai,
>
> Just a wild guess. Maybe aborting the transaction clears out
>changes to both persistent and non-persistent attributes? (i.e.,
>_v_dm, the DataSkin's Data Manager). Have you tried reversing the
>order of the getattr call and the abort?
>
>-steve
>
>On Sunday, October 7, 2001, at 08:31 PM, Itai Tavor wrote:
>
>>Hi,
>>
>>I have a method of a DataSkin object that looks something like this:
>>
>> def editMe(self, REQUEST, RESPONSE):
>> """ Edit object for customer """
>> ...
>> ...
>> if errors.has_any():
>> get_transaction().abort()
>> html = getattr(self, 'edit.html')(self, REQUEST, errors=errors)
>> raise FormError, html
>>
>>
>>The html = getattr() line causes the following exception. If I
>>remove the abort() line, this does not happen. Using Zope 2.3.2,
>>ZPatterns 0.4.3p2. I never had to abort transactions before, so I
>>might be doing something bad... but I can't see what it might be.
>>Any ideas?
>>
>>
>>Error Type: KeyError
>>Error Value: _v_dm_
>>
>>Traceback (innermost last):
>> File /usr/local/zope/2.3.2/lib/python/ZPublisher/Publish.py, line
>>223, in publish_module
>> File /usr/local/zope/2.3.2/lib/python/ZPublisher/Publish.py, line
>>187, in publish
>> File /usr/local/zope/2.3.2/lib/python/Zope/__init__.py, line 221,
>>in zpublisher_exception_hook
>> (Object: 711)
>> File /usr/local/zope/2.3.2/lib/python/ZPublisher/Publish.py, line
>>171, in publish
>> File /usr/local/zope/2.3.2/lib/python/ZPublisher/mapply.py, line
>>160, in mapply
>> (Object: editMe)
>> File /usr/local/zope/2.3.2/lib/python/ZPublisher/Publish.py, line
>>112, in call_object
>> (Object: editMe)
>> File /Users/itai/Z/Main/Products/PrintShop/Item.py, line 113, in editMe
>> (Object: 711)
>> File /Users/itai/Z/Main/Products/ZPatterns/DataSkins.py, line
>>217, in __get_attr__
>> (Object: 711)
>>KeyError: (see above)
>>
>>
>>-- --
>>Itai Tavor -- "Je sautille, donc je suis." --
>>[email protected] -- - Kermit the Frog --
>>-- --
>>-- "If you haven't got your health, you haven't got anything" --
>>
>>
>>_______________________________________________
>>ZPatterns mailing list
>>[email protected]
>>http://www.eby-sarna.com/mailman/listinfo/zpatterns
--
--
Itai Tavor -- "Je sautille, donc je suis." --
[email protected] -- - Kermit the Frog --
-- --
-- "If you haven't got your health, you haven't got anything" --