--- MPIWGWeb/MPIWGProjects.py 2008/09/12 12:28:48 1.47.2.106 +++ MPIWGWeb/MPIWGProjects.py 2008/10/23 07:53:50 1.47.2.107 @@ -20,6 +20,7 @@ from OFS.SimpleItem import SimpleItem from OFS.Folder import Folder from OFS.Image import Image from AccessControl import ClassSecurityInfo +from AccessControl import getSecurityManager from bibliography import * import time from OFS.Cache import Cacheable @@ -750,9 +751,66 @@ class MPIWGProject(CatalogAware,Folder,C return pt() - + def index_html(self,request=True,context=None): """show homepage""" + + bound_names={} + + if not context: + context=self + if request: + if self.REQUEST.has_key('date') and self.REQUEST.SESSION.get('MPI_redirected',None)==None: + self.REQUEST.SESSION['MPI_redirected']=1 + self.REQUEST.RESPONSE.redirect(self.checkDate(self.REQUEST['date'])+"?date="+self.REQUEST['date']) + else: + self.REQUEST.SESSION['MPI_redirected']=None + + #ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"]) + + + request2=getattr(self,'REQUEST',None) + + if request2 is not None: + response = request2.response + if not response.headers.has_key('content-type'): + response.setHeader('content-type', 'text/html') + + security = getSecurityManager() + bound_names['user'] = security.getUser() + + + # Retrieve the value from the cache. + keyset = None + if self.ZCacheable_isCachingEnabled(): + + # Prepare a cache key. + keyset = {'here': self, 'params':request2['QUERY_STRING']} + + result = self.ZCacheable_get(keywords=keyset) + + if result is not None: + # Got a cached value. + return result + + pt = getTemplate(self, "project_main") + # Execute the template in a new security context. + security.addContext(self) + + try: + result = pt.pt_render(extra_context=bound_names) + if keyset is not None: + # Store the result in the cache. + self.ZCacheable_set(result, keywords=keyset) + + return result + finally: + security.removeContext(self) + + + + def index_html_old(self,request=True,context=None): + """show homepage""" if not context: context=self if request: @@ -914,6 +972,7 @@ class MPIWGProject(CatalogAware,Folder,C return self.preview(newcontent) self.copyObjectToArchive() + self.ZCacheable_invalidate() self.WEB_project_description=newcontent[0:] self.REQUEST.RESPONSE.redirect("./index.html") @@ -1146,7 +1205,7 @@ class MPIWGProject(CatalogAware,Folder,C """edit the project and archive the old version""" self.copyObjectToArchive() # archive the object - + self.ZCacheable_invalidate() for x in definedFields: if self.REQUEST.has_key(x):