Diff for /MPIWGWeb/Attic/MPIWGRoot.py between versions 1.1.2.29 and 1.1.2.34

version 1.1.2.29, 2010/09/22 16:06:09 version 1.1.2.34, 2012/01/09 07:33:30
Line 21  from bibliography import * Line 21  from bibliography import *
 import time  import time
 import xml.dom.minidom  import xml.dom.minidom
 import sys  import sys
 from Ft.Xml.XPath import Evaluate  #from Ft.Xml.XPath import Evaluate
 from Ft.Xml.XPath.Context import Context  #from Ft.Xml.XPath.Context import Context
 from Ft.Xml.Domlette import NonvalidatingReader,PrettyPrint, Print  #from Ft.Xml.Domlette import NonvalidatingReader,PrettyPrint, Print
 from Ft.Xml import EMPTY_NAMESPACE  #from Ft.Xml import EMPTY_NAMESPACE
 import copy  import copy
 import updatePersonalWWW  import updatePersonalWWW
 import MPIWGStaff  import MPIWGStaff
 from MPIWGHelper import *  from MPIWGHelper import *
   from BeautifulSoup import BeautifulSoup, Comment
   
 def sortWeight(x,y):  def sortWeight(x,y):
     x1=int(getattr(x[1],'weight','0'))      x1=int(getattr(x[1],'weight','0'))
Line 119  class MPIWGRoot(ZSQLExtendFolder): Line 119  class MPIWGRoot(ZSQLExtendFolder):
         #if not words is ListType:          #if not words is ListType:
         #   words=[words]          #   words=[words]
                           
         txt=obj.harvest_page()          txt=obj.harvest_page(mode="slim")
         if not txt:          if not txt:
             return ret              return ret
         txt=re.sub("<.*?>", "", txt) # loesche alle Tags          
           soup = BeautifulSoup(txt)
           
           comments = soup.findAll(text=lambda text:isinstance(text, Comment))
           [comment.extract() for comment in comments]
           
           txt = ''.join(soup.findAll(text=True))
           
           
           #txt=re.sub("<.*?>", "", txt) # loesche alle Tags
         for word in words:          for word in words:
             word=re.sub("_"," ",word) # ersetze zurueck "_" durch " "              word=re.sub("_"," ",word) # ersetze zurueck "_" durch " "
             pos=0              pos=0
Line 144  class MPIWGRoot(ZSQLExtendFolder): Line 153  class MPIWGRoot(ZSQLExtendFolder):
                         y=max(ranges[nr][1],y)                          y=max(ranges[nr][1],y)
                               
                     str=txt[x:y]                      str=txt[x:y]
                       if x!=0: #add dots if in the middle of text
                           str="..."+str
                       
                       if y!=len(txt): #add dots if in the middle of text
                           str=str+"..."
                           
                           
                                   
                     if nr >=0: # word ist in einer schon gefunden Umgebung                      if nr >=0: # word ist in einer schon gefunden Umgebung
                         ranges[nr]=(x,y) # neue Position der Umgebung                          ranges[nr]=(x,y) # neue Position der Umgebung
Line 600  class MPIWGRoot(ZSQLExtendFolder): Line 616  class MPIWGRoot(ZSQLExtendFolder):
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeMPIWGRootForm')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeMPIWGRootForm')).__of__(self)
         return pt()          return pt()
   
     def changeMPIWGRoot(self,title,disciplineList,themesList,connection_id,lang=None,RESPONSE=None):      def changeMPIWGRoot(self,title,connection_id,coneServiceURL,lang=None,autocommit=None,RESPONSE=None):
         """change"""          """change"""
         self.title=title          self.title=title
         self.connection_id=connection_id          self.connection_id=connection_id
         self.disciplineList=disciplineList          #self.disciplineList=disciplineList
         self.themesList=themesList          #self.themesList=themesList
           self.coneServiceURL=coneServiceURL
           
         if lang is not None:          if lang is not None:
             self.lang = lang              self.lang = lang
   
           self.autocommit = (autocommit == "on")
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('manage_main')              RESPONSE.redirect('manage_main')
   
Line 791  class MPIWGRoot(ZSQLExtendFolder): Line 810  class MPIWGRoot(ZSQLExtendFolder):
         if ignoreEntries is None:          if ignoreEntries is None:
             ignoreEntries = []              ignoreEntries = []
                           
         ignoreEntries.append('current_work') # TODO:updatecurrent work          #ignoreEntries.append('current_work') # TODO:updatecurrent work
         logging.debug("updatePersonEntry: data=%s ignoreEntries=%s"%(repr(data),repr(ignoreEntries)))          logging.debug("updatePersonEntry: data=%s ignoreEntries=%s"%(repr(data),repr(ignoreEntries)))
                   
         if data['date_to']=="": # wenn date_to leer          if data['date_to']=="": # wenn date_to leer
Line 883  class MPIWGRoot(ZSQLExtendFolder): Line 902  class MPIWGRoot(ZSQLExtendFolder):
                 ret+="<table border='1'>"                  ret+="<table border='1'>"
                 for iE in displayIgnored:                  for iE in displayIgnored:
                     ret+="<tr><td>%s</td><td>%s</td><td>%s</td>"%(iE[0].encode('utf-8'),iE[1].encode('utf-8'),iE[2].encode('utf-8'))                      ret+="<tr><td>%s</td><td>%s</td><td>%s</td>"%(iE[0].encode('utf-8'),iE[1].encode('utf-8'),iE[2].encode('utf-8'))
                 ret+="</tabel>"                  ret+="</table>"
                                   
             self.updatePersonEntry(resultSet[conflict],ignoreEntries=ignoreEntries)              self.updatePersonEntry(resultSet[conflict],ignoreEntries=ignoreEntries)
                     
Line 1501  class MPIWGRoot(ZSQLExtendFolder): Line 1520  class MPIWGRoot(ZSQLExtendFolder):
         return "done"          return "done"
           
   
       def sortResults(self,results):
           """search the catalog and give results back sorted by meta_type"""
           ret = {}
           logging.debug(results())
           for result in results():
               metaType = result.meta_type
               resultList= ret.get(metaType,[])
               resultList.append(result)
               ret[metaType]=resultList
           
           logging.debug(ret)
           return ret
           
                           
 def manage_addMPIWGRootForm(self):  def manage_addMPIWGRootForm(self):
     """form for adding the root"""      """form for adding the root"""

Removed from v.1.1.2.29  
changed lines
  Added in v.1.1.2.34


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