Diff for /cdli/cdli_files.py between versions 1.75 and 1.76

version 1.75, 2007/03/23 17:15:36 version 1.76, 2007/04/23 13:07:10
Line 26  import logging Line 26  import logging
 import transaction  import transaction
 import copy  import copy
 import codecs  import codecs
   import sys
   
 def generateXMLReturn(hash):  def generateXMLReturn(hash):
     """erzeugt das xml file als returnwert fuer uploadATFRPC"""      """erzeugt das xml file als returnwert fuer uploadATFRPC"""
Line 886  class CDLIBasket(Folder,CatalogAware): Line 887  class CDLIBasket(Folder,CatalogAware):
     def searchInBasket(self,indexName,searchStr,regExp=False):      def searchInBasket(self,indexName,searchStr,regExp=False):
         """searchInBasket"""          """searchInBasket"""
   
         lst=self.searchInLineIndexDocs(indexName,searchStr,uniq=True,regExp=False)          lst=self.searchInLineIndexDocs(indexName,searchStr,uniq=True,regExp=regExp)
         ret={}          ret={}
                   
         lv=self.getLastVersion()          lv=self.getLastVersion()
         logging.info("searching")  
   
         for obj in lv.content.getContent():          for obj in lv.content.getContent():
             id=obj[1].getId().split(".")[0]              id=obj[1].getId().split(".")[0]
             if id in lst:              if id in lst:
Line 2083  class CDLIRoot(Folder): Line 2085  class CDLIRoot(Folder):
         words=self.findWordRegExp(indexName,searchTerm) # suche nach allen Treffern          words=self.findWordRegExp(indexName,searchTerm) # suche nach allen Treffern
         logging.info("wd:%s"%words)          logging.info("wd:%s"%words)
         for word in words:          for word in words:
   
             ret+=self.searchInLineIndexDocs(indexName,word)              ret+=self.searchInLineIndexDocs(indexName,word)
                   
         return unique(ret)  
           x= unique(ret)
       logging.info("words_done")
           return x
                   
     def showInLineIndex(self):      def showInLineIndex(self):
         """get the index for debug purposes"""          """get the index for debug purposes"""
Line 2209  class CDLIRoot(Folder): Line 2215  class CDLIRoot(Folder):
         """get lines with word  fromFileId"""          """get lines with word  fromFileId"""
                   
         file=self.showFile(fileId)          file=self.showFile(fileId)
       logging.info("regEXP %s"%regExp)
         ret=[]          ret=[]
         if regExp: # wenn regexp dann generiere alle worte aus der list die der regexp entsprechen          if regExp: # wenn regexp dann generiere alle worte aus der list die der regexp entsprechen
             wordlist=self.findWordRegExp(indexName,word)              wordlist=self.findWordRegExp(indexName,word)
Line 2219  class CDLIRoot(Folder): Line 2225  class CDLIRoot(Folder):
         for line in file.split("\n"):          for line in file.split("\n"):
             found=False              found=False
             for word in wordlist:              for word in wordlist:
           try: # just a hack because of possible unicode errors in line
                 if line.find(word)>-1:                  if line.find(word)>-1:
                         if lineList: #liste of moeglichen Zeilennummern                          if lineList: #liste of moeglichen Zeilennummern
                                 num=line.split(".")[0] #Zeilenummer ist alles vor dem . in der Zeile                                  num=line.split(".")[0] #Zeilenummer ist alles vor dem . in der Zeile
Line 2230  class CDLIRoot(Folder): Line 2237  class CDLIRoot(Folder):
                                 ret.append(line)                                  ret.append(line)
                                                   
                         break;                          break;
           except:
               pass
         return ret          return ret
   
     def tagWordInFile(self,fileId,word,lineList=None,regExp=True,indexName=""):      def tagWordInFile(self,fileId,word,lineList=None,regExp=True,indexName=""):

Removed from v.1.75  
changed lines
  Added in v.1.76


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