[Zope-CMF] Historical revisions in CMF (was Re: CMF newbiequestions)

Terry Kerr terry@adroit.net
Thu, 27 Mar 2003 11:36:02 +1100


Yep...I will have a play as soon as I get some free time.

terry

Ausum Studio wrote:

> I'd appreciate more people test this, since I'd like to go into production.
> One of the nicest features that comes up is the ability to enable the
> existing status history page to provide a link to the corresponding
> revision, so that we can get to know what it was the current version of the
> content object, at the time its status was changed, at least up to the
> moment a Data.fs pack was performed. :)
> 
> 
> 
> Ausum
> 
> 
> 
> 
> 
> ----- Original Message -----
> From: "Tres Seaver" <tseaver@zope.com>
> To: "Ausum Studio" <ausum_studio@hotmail.com>
> 
> 
> (...)
> 
> 
>>>I've enabled CMF to handle revisions by allowing it to inherit from
>>>OFS.History, on a experimental basis, and it works fine so far. If you
>>>
> want
> 
>>>to try it, open CMFCore/PortalContent.py with any editor an perform the
>>>changes indicated down below. After you restart Zope, the "History" tab
>>>
> will
> 
>>>appear for all contentish objects, in the management interface. Starting
>>>that point you'll need to provide methods (or modify existing ones) to
>>>access those revisions. I'm including a simple history-viewer script.
>>>
>>>A simple and general workaround in your case is to modify the view
>>>
> methods
> 
>>>of your content types to make them render the closest published revision
>>>
> (or
> 
>>>any other you indicate, based on your site's policy), when the object's
>>>state is 'retracted' (yes, create that one). As currently there's no
>>>relation between revisions and the workflow's review_history, as
>>>
> provided by
> 
>>>'portal_workflow.getInfoFor', one of your to-write methods might be one
>>>
> that
> 
>>>compares timestamps and returns the mentioned revision object.
>>>
>>>I'll publish a How-to on this subject, provided there's no code
>>>
> conflicts
> 
>>>I'm not aware of. :)
>>>
>>>
>>>
>>>Ausum
>>>
>>>
>>>
>>>
>>>Modifications to PortalContent.py:
>>>
>>>....................
>>>    NoWL = 0
>>>except ImportError:
>>>    NoWL = 1
>>>
>>>from OFS.History import Historical        # added line
>>>
>>>class PortalContent(DynamicType, Historical, CMFCatalogAware,
>>>
> SimpleItem):
> 
>>># added 'Historical'
>>>
>>>    """
>>>        Base class for portal objects.
>>>
>>>        Provides hooks for reviewing, indexing, and CMF UI.
>>>.......
>>>
>>>and:
>>>
> 
> (...)
> 
> 
>>>        print k, ":", v
>>>    historical_object = context.HistoricalRevisions[item['key']]
>>>    print historical_object
>>>
>>>return printed
>>>
>>Given a working example, with reasonable testing:  can anyone see /
>>think of a reason not to land this for 1.4?
>>
>>Tres.
>>--
>>
>>
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests
> 



-- 
Terry Kerr (terry@adroit.net)
Adroit Internet Solutions (www.adroit.net)
Phone: +61 3 9563 4461
Fax: +61 3 9563 3856