Importation initiale.
[PlinnDocument.git] / skins / plinndocument_edit_control.py
1 ## Script (Python) "plinndocument_edit"
2 ##parameters=text='', file='', SafetyBelt='', **kw
3 ##title=Edit a document
4 ##
5
6 from Products.CMFDefault.exceptions import EditingConflict, ResourceLockedError
7
8 if text != context.text :
9 try:
10 context.edit( 'html', text, file, safety_belt = SafetyBelt)
11 return context.setStatus(True, 'Document changed.')
12 except (ResourceLockedError, EditingConflict), msg:
13 return context.setStatus(False, msg)
14 else :
15 return context.setStatus(False, 'Nothing to change.')