Diff for /ZSQLExtend/ZSQLExtend.py between versions 1.72 and 1.87

version 1.72, 2005/11/09 10:47:09 version 1.87, 2006/07/27 17:31:50
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 202  class ZSQLExtendFolder(Folder,Persistent Line 207  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
           str=str.rstrip().lstrip()
           
         if url and str:          if url and str:
                           
             retStr=""              retStr=""
Line 353  class ZSQLExtendFolder(Folder,Persistent Line 360  class ZSQLExtendFolder(Folder,Persistent
         if start:          if start:
         if start==' ':          if start==' ':
         start=''          start=''
               
                 if not startValue:                  if not startValue:
                     startValue=start                      startValue=start
                                           
Line 377  class ZSQLExtendFolder(Folder,Persistent Line 385  class ZSQLExtendFolder(Folder,Persistent
         qs=[]          qs=[]
         if storename:          if storename:
             """store"""              """store"""
               storename=storename
         else:          else:
             storename="foundCount"              storename="foundCount"
                           
Line 423  class ZSQLExtendFolder(Folder,Persistent Line 432  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 445  class ZSQLExtendFolder(Folder,Persistent Line 466  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 544  class ZSQLExtendFolder(Folder,Persistent Line 567  class ZSQLExtendFolder(Folder,Persistent
         qs_temp=[]          qs_temp=[]
         if USE_FORM or RESPONSE:          if USE_FORM or RESPONSE:
             for a in self.REQUEST.form.keys():              for a in self.REQUEST.form.keys():
           
                 qs_temp.append(a+"="+urllib.quote(str(self.REQUEST.form[a])))                  qs_temp.append(a+"="+urllib.quote(str(self.REQUEST.form[a])))
   
                   
Line 574  class ZSQLExtendFolder(Folder,Persistent Line 598  class ZSQLExtendFolder(Folder,Persistent
                 identify=identify.split("=")[0]+"="+sql_quote(identify.split("=")[1])                  identify=identify.split("=")[0]+"="+sql_quote(identify.split("=")[1])
             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):
               elif (not (name[0]=="-" or name[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)
           zLOG.LOG("ZSQLExtend",zLOG.INFO,"CHANGE: "+queryString)
                   
         self.ZSQLSimpleSearch(queryString)          self.ZSQLSimpleSearch(queryString)
                   
Line 1038  class ZSQLExtendFolder(Folder,Persistent Line 1066  class ZSQLExtendFolder(Folder,Persistent
         #print "IAMHERE again:", query          #print "IAMHERE again:", query
   
         if storename and (not NoQuery):          if storename and (not NoQuery):
   
             query2="SELECT count(*) FROM %s %s"%(table,where)              query2="SELECT count(*) FROM %s %s"%(table,where)
                           
             #print "QUERYSTRING:",self.REQUEST.SESSION[storename]['queryString2']              #print "QUERYSTRING:",self.REQUEST.SESSION[storename]['queryString2']
Line 1562  class ZSQLBibliography(Folder,ZSQLExtend Line 1591  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.72  
changed lines
  Added in v.1.87


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