source: cmfdeployment/branches/kenw-p4-wip/transforms/example.py @ 2380

Last change on this file since 2380 was 2380, checked in by kenw, 8 years ago

Committing new branch intended for Plone 4 compatibility; mostly required imports of new zope packages

File size: 978 bytes
Line 
1"""
2an example content transform. content transformss are executed over matched
3rendered content immediately before storage.
4
5$Id: example.py 940 2005-08-16 07:50:44Z hazmat $
6"""
7
8from registry import registerTransform
9
10def example_transform(descriptor, rendered_content, file_path):
11    """
12    descriptor is a content descriptor object, it offers
13    access to the context, the deployed content object, and
14    various deployment metadata about the object.
15
16    rendered content is a string of the content object in
17    rendered form.
18
19    file path, represents the filesystem path that the rendered
20    content will be stored at on the *zope server*, not the
21    deployment server.
22
23    currently only modifications to the rendered content are
24    tracked. changing this is trivial
25    """
26
27    # lets change all 'the's to 'The'
28    return rendered_content.replace('the', 'The')
29
30# register the transform so we can use it
31registerTransform('THE_example', example_transform)
Note: See TracBrowser for help on using the repository browser.