Re: weird Page Template / ZODB history problem with Zope 2.12.7
Marius Gedminas <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <20100927231252.GB1218@platonas> |
On Mon, Sep 27, 2010 at 11:37:11PM +0100, Chris Withers wrote:
> Hi All,
>
> Try this:
>
> - edit a page template
>
> - edit it again
>
> - go to the history tab, and use the "Copy to present" button to bring
> back your first edit.
>
> On the edit tab, you will correctly see the text you brought back.
> However, if you render the template, the old text will be used.
>
> It's only if you "Save changes" that the copied-to-present text will
> actually be used.
>
> Anyone got any ideas why and how to fix this?
Why? Because the precompiled TAL bytecode is sitting there in a
_v_program attribute that's not stored in the ZODB, so it's not reverted
when you undo things.
How to fix? Make the "Copy to present" button drop all _v_* attributes
from the object it modifies.
This is OFS.History.Historical.manage_historyCopy, right? Quick
untested patch:
--- ./OFS/History.py.orig 2010-09-28 02:11:56.535745440 +0300
+++ ./OFS/History.py 2010-09-28 02:12:00.043764683 +0300
@@ -151,6 +151,9 @@
base = aq_base(self)
base._p_activate() # make sure we're not a ghost
base.__setstate__(state) # change the state
+ for attr in dir(base):
+ if attr.startswith('_v_'):
+ delattr(base, attr)
base._p_changed = True # marke object as dirty
self.manage_afterHistoryCopy()
Marius Gedminas
--
http://pov.lt/ -- Zope 3/BlueBream consulting and development
_______________________________________________
Zope-Dev maillist - [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )
signature.asc
(application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkyhJPQACgkQkVdEXeem149ckwCeIXsYBXZIOBxk+kkVszfZTd6c q98An2ykg+62aFYaxE9Rvc9q5C8sYJ5t =PfD/ -----END PGP SIGNATURE-----