Warning

This document hasn't been checked for compatibility with current versions of Plone. Use at your own risk.

How to retrieve cumulative differences between versions when referenced images are involved

by Shivaraj M S last modified Dec 30, 2008 03:03 PM
The CMFEditions performs an important task of retrieving the history and showing differences between various revisions. But when there are reference fields in the content types and the differences between revisions are sought in history section it fails to show them up although retainATRefs modifier is set up for the content type.

Purpose

CMFEdtions currently retrieves the latest version's referenced image for all versions when difference between the versions is sought. There is a portal modifier property retainATRefs which is unable to retain references.

The below mentioned method will help in retaining the references made in a content type.

 

Prerequisities

Create a content type like a document or a page involving a reference field to another content type like an image to it. Try creating different set of revisions with different set of images.

Now retrieve the differences between the revisions. You will find the referenced field showing the latest reference  for all the revisions.

 

Step by step

In the file ArchivistTool.py the

class LazyHistory has a function called

def __getitem__(self, selector):

This function inturn calls this function _modifier.afterRetrieveModifier

from the following function statement

refs_to_be_deleted, attr_handling_references, preserved_data = \ self._modifier.afterRetrieveModifier(self._obj, repo_clone, self._preserve)

which is where the references get deleted. Hence restoring the condition i.e performing the undeletion makes the references to appear when the version differences are sought. Hence instead of calling the above function

  1. assign null containers to refs_to_be_deleted and preserved_data.
  2. attr_handling_references = ['_objects']
 

At the front end it can be retrieved using

python:vdata.object.at_references.items()

and suitable looping mechanism.

 

Further information

The following file gives a  presentation on the architecture of CMFEditions by Alec Mitchell.

http://plone.org/events/conferences/seattle-2006/presentations/versioning-at-last.pdf/view

 

 


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.