Diff for /cdli/cdli_files.py between versions 1.80.2.13 and 1.81

version 1.80.2.13, 2008/01/04 17:27:39 version 1.81, 2008/01/21 17:19:01
Line 99  def formatAtfFullLineNum(txt, nolemma=Tr Line 99  def formatAtfFullLineNum(txt, nolemma=Tr
     ret = []      ret = []
     surf = ""      surf = ""
     col = ""      col = ""
     for line in txt.split("\n"):      for line in txt.splitlines():
         line = unicodify(line)          line = unicodify(line)
         if line and line[0] == '@':          if line and line[0] == '@':
             # surface or column              # surface or column
Line 108  def formatAtfFullLineNum(txt, nolemma=Tr Line 108  def formatAtfFullLineNum(txt, nolemma=Tr
                 surf = line.replace(words[0],surfaces[words[0]]).strip()                  surf = line.replace(words[0],surfaces[words[0]]).strip()
                           
             elif words[0] == '@column':              elif words[0] == '@column':
                 col = words[1]                  col = ' '.join(words[1:])
                           
         elif line and line[0] in '123456789':          elif line and line[0] in '123456789':
             # ordinary line -> add line number              # ordinary line -> add line number
Line 632  class CDLIBasketContainer(OrderedFolder) Line 632  class CDLIBasketContainer(OrderedFolder)
                             ret+=str(object[0].getData())+"\n"                              ret+=str(object[0].getData())+"\n"
             elif current=="yes":              elif current=="yes":
                             #search current object                              #search current object
                             logging.info("crrent: %s"%object[1].getId().split(".")[0])                              logging.debug("current: %s"%object[1].getId().split(".")[0])
                             founds=self.CDLICatalog.search({'title':object[1].getId().split(".")[0]})                              founds=self.CDLICatalog.search({'title':object[1].getId().split(".")[0]})
                             if len(founds)>0:                                    if len(founds)>0:      
                                 ret+=str(founds[0].getObject().getLastVersion().getData())+"\n"                                  ret+=str(founds[0].getObject().getLastVersion().getData())+"\n"
Line 1512  class CDLIFileObject(CatalogAware,extVer Line 1512  class CDLIFileObject(CatalogAware,extVer
           
     security.declareProtected('manage','index_html')      security.declareProtected('manage','index_html')
   
       security.declarePublic('view')
       view = PageTemplateFile('zpt/viewCDLIFile.zpt', globals())
   
       security.declarePublic('editATF')
       editATF = PageTemplateFile('zpt/editATFFile.zpt', globals())
   
     def PrincipiaSearchSource(self):      def PrincipiaSearchSource(self):
            """Return cataloguable key for ourselves."""             """Return cataloguable key for ourselves."""
            return str(self)             return str(self)
Line 1526  class CDLIFileObject(CatalogAware,extVer Line 1532  class CDLIFileObject(CatalogAware,extVer
     def makeThisVersionCurrent(self,comment,author,RESPONSE=None):      def makeThisVersionCurrent(self,comment,author,RESPONSE=None):
         """copy this version to current"""          """copy this version to current"""
         parent=self.aq_parent          parent=self.aq_parent
         newversion=parent.manage_addCDLIFileObject('',comment,author)          parent.manage_addVersionedFileObject(id=None,vC=comment,author=author,file=self.getData(),RESPONSE=RESPONSE)
         newversion.manage_upload(self.getData())          #newversion=parent.manage_addCDLIFileObject('',comment,author)
           #newversion.manage_upload(self.getData())
                                                                                   
         if RESPONSE is not None:          #if RESPONSE is not None:
             RESPONSE.redirect(self.aq_parent.absolute_url()+'/history')          #    RESPONSE.redirect(self.aq_parent.absolute_url()+'/history')
   
         return True          return True
           
Line 1540  class CDLIFileObject(CatalogAware,extVer Line 1547  class CDLIFileObject(CatalogAware,extVer
 #        return re.sub("\s\#lem"," #lem",data) #remove return vor #lem  #        return re.sub("\s\#lem"," #lem",data) #remove return vor #lem
         return re.sub("#lem","       #lem",data) #remove return vor #lem          return re.sub("#lem","       #lem",data) #remove return vor #lem
                   
     security.declarePublic('view')  
     def view(self):  
         """view file"""  
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','viewCDLIFile.zpt')).__of__(self)  
         return pt()  
           
     security.declarePublic('getPNumber')      security.declarePublic('getPNumber')
     def getPNumber(self):      def getPNumber(self):
Line 1574  class CDLIFileObject(CatalogAware,extVer Line 1576  class CDLIFileObject(CatalogAware,extVer
         except:          except:
             return "ERROR"              return "ERROR"
                   
           
 manage_addCDLIFileObjectForm=DTMLFile('dtml/fileAdd', globals(),Kind='CDLIFileObject',kind='CDLIFileObject', version='1')  manage_addCDLIFileObjectForm=DTMLFile('dtml/fileAdd', globals(),Kind='CDLIFileObject',kind='CDLIFileObject', version='1')
   
 def manage_addCDLIFileObject(self,id,vC='',author='', file='',title='',versionNumber=0,  def manage_addCDLIFileObject(self,id,vC='',author='', file='',title='',versionNumber=0,
Line 1789  def splitatf(fh,dir=None,ext=None): Line 1792  def splitatf(fh,dir=None,ext=None):
     nf=None      nf=None
     i=0      i=0
   
       #ROC: why split \n first and then \r???
     if (type(fh) is StringType) or (type(fh) is UnicodeType):      if (type(fh) is StringType) or (type(fh) is UnicodeType):
         iter=fh.split("\n")          iter=fh.split("\n")
     else:      else:
Line 1860  class CDLIFileFolder(extVersionedFileFol Line 1864  class CDLIFileFolder(extVersionedFileFol
   
         setattr(self,name,value)          setattr(self,name,value)
                                                                                   
       deleteFileForm = PageTemplateFile("zpt/doDeleteFile", globals())
                                                                                 
     def delete(self,ids):      def delete(self,ids,REQUEST=None):
         """delete these files"""          """delete these files"""
         if type(ids) is not ListType:          if type(ids) is not ListType:
             ids=[ids]              ids=[ids]
   
         self.manage_delObjects(ids)          self.manage_delObjects(ids)
   
           if REQUEST is not None:
               return self.index_html()
   
   
     def getVersionNumbersFromIds(self,ids):      def getVersionNumbersFromIds(self,ids):
         """get the numbers of the current versions of documents described by their ids"""          """get the numbers of the current versions of documents described by their ids"""
Line 2185  class CDLIRoot(Folder): Line 2193  class CDLIRoot(Folder):
         # compile into regexp objects and escape parens          # compile into regexp objects and escape parens
         wordlist = [re.compile(splitexp%re.escape(w)) for w in word.split(' ')]          wordlist = [re.compile(splitexp%re.escape(w)) for w in word.split(' ')]
                           
         for line in file.split("\n"):          for line in file.splitlines():
             for word in wordlist:              for word in wordlist:
                 #logging.debug("showwordinfile: searching for %s in %s"%(word.pattern,ignoreable.sub('',line)))                  #logging.debug("showwordinfile: searching for %s in %s"%(word.pattern,ignoreable.sub('',line)))
                 if word.search(ignorable.sub('',line)):                  if word.search(ignorable.sub('',line)):
Line 2230  class CDLIRoot(Folder): Line 2238  class CDLIRoot(Folder):
         # split search terms again (for grapheme search with words)          # split search terms again (for grapheme search with words)
         splitwords = dict(((w,self.splitter[indexName].process([w])) for w in words))          splitwords = dict(((w,self.splitter[indexName].process([w])) for w in words))
                           
         for line in file.split("\n"):          for line in file.splitlines():
             line = unicodify(line)              line = unicodify(line)
             # ignore lemma lines              # ignore lemma and other lines
             if line.lstrip().startswith('#lem:'):              if line.lstrip().startswith('#lem:'):
                 continue                  continue
               # ignore p-num line
               if line.startswith('&P'):
                   continue
               # ignore version lines
               if line.startswith('#version'):
                   continue
               # ignore atf type lines
               if line.startswith('#atf:'):
                   continue
   
             # first scan              # first scan
             hitwords = []              hitwords = []

Removed from v.1.80.2.13  
changed lines
  Added in v.1.81


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