Diff for /cdli/cdli_files.py between versions 1.52 and 1.53

version 1.52, 2006/11/15 13:57:13 version 1.53, 2006/12/22 11:56:08
Line 21  from ZPublisher.HTTPRequest import HTTPR Line 21  from ZPublisher.HTTPRequest import HTTPR
 from ZPublisher.HTTPResponse import HTTPResponse  from ZPublisher.HTTPResponse import HTTPResponse
 from ZPublisher.BaseRequest import RequestContainer  from ZPublisher.BaseRequest import RequestContainer
 import threading  import threading
       from BTrees.OOBTree import OOBTree
   
 class BasketContent(SimpleItem):  class BasketContent(SimpleItem):
     """classe fuer den Inhalt eines Baskets"""      """classe fuer den Inhalt eines Baskets"""
Line 1862  class CDLIRoot(Folder): Line 1862  class CDLIRoot(Folder):
     meta_type="CDLIRoot"      meta_type="CDLIRoot"
     downloadCounterBaskets=0# counts the current basket downloads if counter > 10 no downloads are possible      downloadCounterBaskets=0# counts the current basket downloads if counter > 10 no downloads are possible
           
       def showInLineIndex(self):
           """get the index for debug purposes"""
           print "show"
           for x in self.lineIndex.iterkeys():
               print "word:",x
               for y in self.lineIndex[x].iterkeys():
                   print "doc",y,self.lineIndex[x][y]
                   
           return self.lineIndex
           
       def searchInLineIndexDocs(self,word):
           """search occurences"""
           return list(self.lineIndex.get(word.upper()).keys())
   
       def getLinesFromIndex(self,word,doc):
           """get lines"""
           return self.lineIndex[word][doc]
   
       def cleanInLineIndex(self):
           """delete InlineIndex"""
           for x in list(self.lineIndex.keys()):
               del(self.lineIndex[x])
           print [x for x in self.lineIndex.keys()]
        
           return "ok"
       
       def storeInLineIndex(self,key,value):
           """store in index"""
        
           if (not hasattr(self,'lineIndex')) or (type(self.lineIndex) is DictType):
               self.lineIndex=OOBTree()
           li=self.lineIndex
           
           if li.has_key(key):
               
               if li[key].has_key(value[0]) and (not (value[1] in li[key][value[0]])):
                   li[key][value[0]].append(value[1]) # add it if now in the array
               else:
                   li[key][value[0]]=[value[1]] # new array for lines
                   
           else:
               
               li[key]=OOBTree()# new btree for lines
               li[key][value[0]]=[value[1]] 
                       
           
           self.lineIndex=li
        
           get_transaction().commit()
           
   
     def showFile(self,fileId):      def showFile(self,fileId):
         """show a file"""          """show a file"""

Removed from v.1.52  
changed lines
  Added in v.1.53


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