[Zope-CMF] HELP-cannot publish folder as manager-HTTPResponse.py

Carl Rendell cer@sol43.com
Wed, 18 Sep 2002 09:24:06 -0700


On Wednesday, September 18, 2002, at 06:51  AM, Tres Seaver wrote:

> On Tue, 2002-09-17 at 18:20, Florent Guillaume wrote:
>> Hmmm I thought I mentionned that somewhere in the past.
>>
>> '/view' has to be inserted for contentish types otherwise images and
>> files (whose base url has the meaning "download") would not be treated
>> correctly.
>
> I have a workaround for this problem, which I will probably land on the
> head RSN:
>
>   - Add a new (FS)PythonScript, 'search_suffix', which tests the
>     'portal_type' of its context and returns either '/view' (for Image,
>     File, etc.) or '' (the default).
>
>   - Add 'search_suffix' to the catalog's schema.
>
>   - Reindex the catalog.
>
>   - Modify the 'search' template to concatenate the absolute URL with
>     the value of the brain's 'search_suffix'.
>
> Perhaps a better implementation would be to add a 'search_suffix'
> property to the TypeInformation base class, and then have the method
> return the property from its context's type.

Damn, I just realized that the content_status_modify.py script can 
be much more generic by testing for isPrincipiaFolderish

## Script (Python) "content_status_modify"
##parameters=workflow_action, comment=''
##title=Modify the status of a content object

context.portal_workflow.doActionFor(
     context,
     workflow_action,
     comment=comment)

if workflow_action == 'reject':
	redirect_url = context.portal_url() + '/search?review_state=pending'
else:
	if context.isPrincipiaFolderish:
		redirect_url = '%s?%s' % ( context.absolute_url()
                                   , 
'portal_status_message=Status+changed.'
                                   )
	else:
		redirect_url = '%s/view?%s' % ( context.absolute_url()
		                              , 
'portal_status_message=Status+changed.'
		                              )

context.REQUEST[ 'RESPONSE' ].redirect( redirect_url )

This removes any dependency on types.

~C

Carl E. Rendell
Solution43
Information Distribution Consulting        |   "Ahhhh the power of
cer@sol43.com                              |    acquisition"  - Chef Z