Diff for /MPIWGWeb/Attic/MPIWGTemplate.py between versions 1.1.2.4 and 1.1.2.13

version 1.1.2.4, 2008/09/03 11:13:43 version 1.1.2.13, 2012/01/13 10:01:28
Line 8  import logging Line 8  import logging
 from OFS.Folder import Folder  from OFS.Folder import Folder
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
 from MPIWGHelper import *  from MPIWGHelper import *
   from ZODB import FileStorage, DB
   import transaction
   
   # dummy definitions for backwards compatibility
   import MPIWGFeature
   
 def getBreadcrumbs(self):  class MPIWGFeature(MPIWGFeature.MPIWGFeature):
     """return list of breadcrumbs from here to the root"""      """deprecated! use class in MPIWGFeature.py"""
     crumbs = [(self.title, self.absolute_url(), self)]  
     parent = self.aq_parent  
     if hasattr(parent, 'getBreadcrumbs'):  
         if self.title:  
             return parent.getBreadcrumbs() + crumbs  
         else:  
             # if there's no title, skip this level  
             return parent.getBreadcrumbs()  
           
     return crumbs  
   
   import MPIWGFolder
   
 def getSection(self):  class MPIWGFolder(MPIWGFolder.MPIWGFolder):
     """returns the current section name"""      """deprecated! use class in MPIWGFolder.py"""
     p = self  
     sec = None  
     # descend parents to the root (and remember the last id)  
     while p is not None and p.meta_type != 'MPIWGRoot':  
         sec = p.getId()  
         p = p.aq_parent  
           
     return sec  
   
   
 class MPIWGTemplate(ZopePageTemplate):  class MPIWGTemplate(ZopePageTemplate):
Line 75  class MPIWGTemplate(ZopePageTemplate): Line 63  class MPIWGTemplate(ZopePageTemplate):
             return ""              return ""
           
     getBreadcrumbs = getBreadcrumbs      getBreadcrumbs = getBreadcrumbs
       
     getSection = getSection      getSection = getSection
       getSubSection = getSubSection
   
     def harvest_page(self):      def harvest_page(self,mode="normal"):
         """harvest main"""          """harvest main"""
           
          
   
           # Ensure that a 'userdb' key is present
           # in the root
          
           templates = self.en.getHarvestCache()
           #templates = getattr(self,'getHarvestCache',self.en.getHarvestCache)()
         try:          try:
             return self.pt_render()             
               rendered = self.pt_render()
               templates[self.absolute_url()]=rendered
               logging.debug("harvest:"+self.absolute_url())
               transaction.commit()
               return rendered
         except:          except:
             logging.error("cannot harvest: %s"%self.absolute_url())              logging.error("cannot harvest: %s"%self.absolute_url())
                   
                   
                                             
           
           
                        
 def manage_addMPIWGTemplateForm(self):  def manage_addMPIWGTemplateForm(self):
     """Form for adding"""      """Form for adding"""
     pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/AddMPIWGTemplate.zpt')).__of__(self)      pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/AddMPIWGTemplate.zpt')).__of__(self)
Line 135  def manage_addMPIWGTemplate(self, MPIWGT Line 139  def manage_addMPIWGTemplate(self, MPIWGT
     REQUEST.RESPONSE.redirect(u+'/manage_main')      REQUEST.RESPONSE.redirect(u+'/manage_main')
     return ''      return ''
   
   
   
 class MPIWGFolder(Folder):  
     """special Folder object for MPIWG website """  
   
     meta_type="MPIWGFolder"  
   
     manage_options=Folder.manage_options+(  
         {'label':'Change Weight','action':'changeWeightForm'},  
         {'label':'Main Config','action':'changeForm'},  
         )  
   
     changeWeightForm = PageTemplateFile('zpt/MPIWGFolderChangeWeight', globals())  
     changeForm = PageTemplateFile('zpt/MPIWGFolderConfig', globals())  
   
     def __init__(self, id, title=None, weight=0, canonicalName=None):  
         self.id = str(id)  
         self.weight = weight  
         if title is None:  
             self.title = id  
         else:  
             self.title = title  
               
         if canonicalName is None:  
             self.canonicalName = self.id  
         else:  
             self.canonicalName = canonicalName  
   
     def changeWeight(self,weight,RESPONSE=None):  
         """change weight"""  
         self.weight=weight  
         if RESPONSE is not None:  
             RESPONSE.redirect('manage_main')  
   
     def changeMPIWGFolder(self, title=None, weight=None, canonicalName=None, RESPONSE=None):  
         """change everything"""  
         if title is not None:  
             self.title = title  
         if weight is not None:  
             self.weight = weight  
         if canonicalName is not None:  
             self.canonicalName = canonicalName  
         if RESPONSE is not None:  
             RESPONSE.redirect('manage_main')  
          
     getBreadcrumbs = getBreadcrumbs  
       
     getSection = getSection  
       
   
 def manage_addMPIWGFolderForm(self):  
     """Form for adding"""  
     pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/AddMPIWGFolder.zpt')).__of__(self)  
     return pt()  
   
 def manage_addMPIWGFolder(self, id, title=None,weight=0,RESPONSE=None):  
     "Add a MPIWG Folder."  
     newObj=MPIWGFolder(id,title,weight)  
     self.Destination()._setObject(id,newObj)  
     if RESPONSE is not None:  
         RESPONSE.redirect('manage_main')  
   
       
   

Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.13


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>