Diff for /ZSQLExtend/ZSQLExtend.py between versions 1.74 and 1.78

version 1.74, 2005/11/23 17:41:28 version 1.78, 2006/01/16 17:32:40
Line 67  class ZSQLExtendFolder(Folder,Persistent Line 67  class ZSQLExtendFolder(Folder,Persistent
     """Folder"""      """Folder"""
     meta_type="ZSQLExtendFolder"      meta_type="ZSQLExtendFolder"
           
       def ZSQLQuote(self,str):
           """quote str for sql"""
           return sql_quote(str)
       
       
     def importXMLFile(self,table,containerTagName,file,identify=None,RESPONSE=None):      def importXMLFile(self,table,containerTagName,file,identify=None,RESPONSE=None):
         #TODO: finish importXMLFile          #TODO: finish importXMLFile
         '''          '''
Line 166  class ZSQLExtendFolder(Folder,Persistent Line 171  class ZSQLExtendFolder(Folder,Persistent
             return ""              return ""
   
     def getLabel(self):      def getLabel(self):
         """getLabe"""          """getLabel"""
         try:          try:
             return self.label              return self.label
         except:          except:
             return ""              return ""
   
       def getTitle(self):
           """getTitle"""
           try:
               return self.title
           except:
               return ""
   
   
     def getDescription(self):      def getDescription(self):
         """getLabe"""          """getDescription"""
         try:          try:
             return self.description              return self.description
         except:          except:
Line 202  class ZSQLExtendFolder(Folder,Persistent Line 215  class ZSQLExtendFolder(Folder,Persistent
     def formatAscii(self,str,url=None):      def formatAscii(self,str,url=None):
         """ersetze ascii umbrueche durch <br>"""          """ersetze ascii umbrueche durch <br>"""
         #url=None          #url=None
           
           if not str:
               return ""
           
         str=str.rstrip().lstrip()          str=str.rstrip().lstrip()
                   
         if url and str:          if url and str:
Line 427  class ZSQLExtendFolder(Folder,Persistent Line 444  class ZSQLExtendFolder(Folder,Persistent
         return self.ZSQLSimpleSearch(query)          return self.ZSQLSimpleSearch(query)
           
           
       def ZSQLResetConnection(self):
           """reset the connectione"""
           try:
               self.getConnectionObj().manage_close_connection()
           except:
               zLOG.LOG("ZSQLResetConnection",zLOG.ERROR, '%s %s'%sys.exc_info()[:2])
           try:
               self.getConnectionObj().manage_open_connection()
           except:
               zLOG.LOG("ZSQLResetConnection",zLOG.ERROR, '%s %s'%sys.exc_info()[:2])
   
     def ZSQLSimpleSearch(self,query=None,max_rows=1000000):      def ZSQLSimpleSearch(self,query=None,max_rows=1000000):
         """simple search"""          """simple search"""
                   
         if not query:          if not query:
             query=self.query              query=self.query
                   
           
         if (hasattr(self,"_v_searchSQL") and (self._v_searchSQL == None)) or (not hasattr(self,"_v_searchSQL")):          if (hasattr(self,"_v_searchSQL") and (self._v_searchSQL == None)) or (not hasattr(self,"_v_searchSQL")):
                           
             self._v_searchSQL=Shared.DC.ZRDB.DA.DA("_v_searchSQL","_v_searchSQL",self.getConnectionObj().getId(),"var","<dtml-var var>")              self._v_searchSQL=Shared.DC.ZRDB.DA.DA("_v_searchSQL","_v_searchSQL",self.getConnectionObj().getId(),"var","<dtml-var var>")
                           
             self._v_searchSQL.max_rows_=max_rows              self._v_searchSQL.max_rows_=max_rows
             try:              try:
                   
                 return self._v_searchSQL.__call__(var=query)                  return self._v_searchSQL.__call__(var=query)
             except :              except :
   
                 if sys.exc_info()[0]=="Database Error":                  if sys.exc_info()[0]=="Database Error":
                     try:                      try:
                         self.getConnectionObj().manage_open_connection()                          self.getConnectionObj().manage_open_connection()
Line 449  class ZSQLExtendFolder(Folder,Persistent Line 478  class ZSQLExtendFolder(Folder,Persistent
                         zLOG.LOG("ZSQLSimpleSearch",zLOG.ERROR, '%s %s'%sys.exc_info()[:2])                          zLOG.LOG("ZSQLSimpleSearch",zLOG.ERROR, '%s %s'%sys.exc_info()[:2])
         else:          else:
             try:              try:
   
                 self._v_searchSQL.max_rows_=max_rows                  self._v_searchSQL.max_rows_=max_rows
                                   
                 return self._v_searchSQL.__call__(var=query)                  return self._v_searchSQL.__call__(var=query)
             except :              except :
   
                 if sys.exc_info()[0]=="Database Error":                  if sys.exc_info()[0]=="Database Error":
                     try:                      try:
                         self.getConnectionObj().manage_open_connection()                          self.getConnectionObj().manage_open_connection()
Line 579  class ZSQLExtendFolder(Folder,Persistent Line 610  class ZSQLExtendFolder(Folder,Persistent
             elif name=="-format":              elif name=="-format":
                 format=urllib.unquote(value)                  format=urllib.unquote(value)
             elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0):              elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0):
   
                 changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value)))                  changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value)))
                                   
         changeString=string.join(changeList,",")          changeString=string.join(changeList,",")
   
         queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify)          queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify)
                   
         self.ZSQLSimpleSearch(queryString)          self.ZSQLSimpleSearch(queryString)
Line 639  class ZSQLExtendFolder(Folder,Persistent Line 672  class ZSQLExtendFolder(Folder,Persistent
                    if field[0]=="_":                     if field[0]=="_":
                        fieldTmp="-"+field[1:]                         fieldTmp="-"+field[1:]
                    else:                     else:
                        fieldTmp=field                         fieldTmp=urllib.unqoute(field)
                                                 
                    qs+=",%s=%s"%(fieldTmp,argv[field])                     qs+=",%s=%s"%(fieldTmp,argv[field])
                                         
Line 1081  class ZSQLExtendFolder(Folder,Persistent Line 1114  class ZSQLExtendFolder(Folder,Persistent
             self.REQUEST.SESSION[storename]['searchFields']=searchFields              self.REQUEST.SESSION[storename]['searchFields']=searchFields
             self.REQUEST.SESSION[storename]['searchFieldsOnly']=searchFieldsOnly              self.REQUEST.SESSION[storename]['searchFieldsOnly']=searchFieldsOnly
   
           print query
         if not NoQuery:          if not NoQuery:
   
             return self.ZSQLQuery(query)              return self.ZSQLQuery(query)
Line 1567  class ZSQLBibliography(Folder,ZSQLExtend Line 1601  class ZSQLBibliography(Folder,ZSQLExtend
         host_port = self.REQUEST['SERVER_PORT']          host_port = self.REQUEST['SERVER_PORT']
         fix_host = None          fix_host = None
         if http_host and http_host.rfind(host_port) == -1:          if http_host and http_host.rfind(host_port) == -1:
             print "HTTP_HOST needs fixing!"              #print "HTTP_HOST needs fixing!"
             fix_host = http_host + ":" + host_port              fix_host = http_host + ":" + host_port
                   
         ret="""<?xml version="1.0" ?>          ret="""<?xml version="1.0" ?>

Removed from v.1.74  
changed lines
  Added in v.1.78


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