[CMF-checkins] CVS: CMF/CMFDefault/skins/content - document_edit.py:1.3 metadata_edit.py:1.3
Andrew Sawyers
andrew@zope.com
Mon, 26 Nov 2001 14:00:19 -0500
Update of /cvs-repository/CMF/CMFDefault/skins/content
In directory cvs.zope.org:/tmp/cvs-serv25607/CMFDefault/skins/content
Modified Files:
document_edit.py metadata_edit.py
Log Message:
*Fixed support for webDAV locking on Document. Added edit method
to handle TTW edits, while PUT calls _edit.
*Added editMetadata method for TTW edits to handle checks and
ensure TTW can't edit the metadata of a webDAV locked document.
*Made necessary skin changes to implement these new methods.
*Added failIfLocked method to PortalContent to handle the TTW
checks if a document has a webDAV lock.
=== CMF/CMFDefault/skins/content/document_edit.py 1.2 => 1.3 ===
##parameters=text_format, text, file='', SafetyBelt='', choice=' Change '
##title=Edit a document
-
-context.edit( text_format
- , text
- , file
- , safety_belt=SafetyBelt
- )
+try:
+ context.edit( text_format
+ , text
+ , file
+ , safety_belt=SafetyBelt
+ )
+ qst='portal_status_message=Document+changed.'
-qst='portal_status_message=Document+changed.'
+ if choice == ' Change and View ':
+ target_action = context.getTypeInfo().getActionById( 'view' )
+ else:
+ target_action = context.getTypeInfo().getActionById( 'edit' )
-if choice == ' Change and View ':
- target_action = context.getTypeInfo().getActionById( 'view' )
-else:
- target_action = context.getTypeInfo().getActionById( 'edit' )
-
-context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
+ context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url()
, target_action
, qst
) )
-
+except Exception, msg:
+ target_action = context.getTypeInfo().getActionById( 'edit' )
+ context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % (
+ context.absolute_url()
+ , target_action
+ , msg
+ ))
=== CMF/CMFDefault/skins/content/metadata_edit.py 1.2 => 1.3 ===
rights = context.Rights()
-context.editMetadata( title=title
- , description=description
- , subject=subject
- , contributors=contributors
- , effective_date=effective_date
- , expiration_date=expiration_date
- , format=format
- , language=language
- , rights=rights
- )
+try:
+ context.editMetadata( title=title
+ , description=description
+ , subject=subject
+ , contributors=contributors
+ , effective_date=effective_date
+ , expiration_date=expiration_date
+ , format=format
+ , language=language
+ , rights=rights
+ )
+ if context.REQUEST.get( 'change_and_edit', 0 ):
+ action_id = 'edit'
+ elif context.REQUEST.get( 'change_and_view', 0 ):
+ action_id = 'view'
+ else:
+ action_id = 'metadata'
-if context.REQUEST.get( 'change_and_edit', 0 ):
- action_id = 'edit'
-elif context.REQUEST.get( 'change_and_view', 0 ):
- action_id = 'view'
-else:
- action_id = 'metadata'
-
-action_path = context.getTypeInfo().getActionById( action_id )
-
-context.REQUEST['RESPONSE'].redirect(
- '%s/%s?portal_status_message=Metadata+changed.'
- % ( context.absolute_url(), action_path ) )
+ action_path = context.getTypeInfo().getActionById( action_id )
+ context.REQUEST['RESPONSE'].redirect(
+ '%s/%s?portal_status_message=Metadata+changed.'
+ % ( context.absolute_url(), action_path ) )
+except Exception, msg:
+ target_action = context.getTypeInfo().getActionById( 'metadata' )
+ context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % (
+ context.absolute_url()
+ , target_action
+ , msg
+ ))