Logo Search packages:      
Sourcecode: zope-i18nlayer version File versions

def zope-i18nlayer-0.5.5::I18NLayer::I18NLayer::index_html (   self,
  REQUEST,
  RESPONSE 
)

return content if subobject has index_html method
or redirect to subobjects index_html when forcing language urls

Definition at line 247 of file I18NLayer.py.

00247                                            :
        """
        return content if subobject has index_html method
        or redirect to subobjects index_html when forcing language urls
        """
        # NOTE: this implies for images and files which are returned directly when
        #       called with index_html.
        # NOTE: files download method is deprecated and not supported

        ob = self.retrieveLanguageContent()
        if ob:
            klass=ob.__class__
            language_tool = getToolByName(self, 'portal_languages', None)
            force_redir = getattr(language_tool, 'force_language_urls', 1)  
            if force_redir:
                url = "%s" % (ob.absolute_url())
                if REQUEST.get('QUERY_STRING', '').strip(): url="%s?%s" % (url, REQUEST.QUERY_STRING)
                REQUEST.RESPONSE.setHeader('Cache-Control', 'no-cache')
                REQUEST.RESPONSE.setHeader('Expires', '-1')
                REQUEST.RESPONSE.setHeader('Pragma', 'no-cache')                                        
                REQUEST.RESPONSE.redirect(url)
                return "redirect index"
            i=getattr(klass,'index_html', None)
            c=getattr(klass,'__call__', None)
            if i and c and i != c:
                # XXX: probably we should set Content-Language somewhere here
                return apply(ob.index_html, (REQUEST, RESPONSE,), {})

        # no object so call us
        return apply(self.__call__, (REQUEST, RESPONSE,), {})

 
    security.declarePublic('allowedContentTypeNames')
    def allowedContentTypeNames(self):


Generated by  Doxygen 1.6.0   Back to index