Diff for /ZSQLExtend/ZSQLExtend.py between versions 1.65 and 1.66

version 1.65, 2005/10/10 15:36:40 version 1.66, 2005/10/11 13:15:01
Line 345  class ZSQLExtendFolder(Folder,Persistent Line 345  class ZSQLExtendFolder(Folder,Persistent
         """inlinesearch"""          """inlinesearch"""
         qs=[]          qs=[]
                   
       
           
         #print "INLINE:",query          #print "INLINE:",query
         return self.ZSQLSimpleSearch(query)          return self.ZSQLSimpleSearch(query)
           
Line 368  class ZSQLExtendFolder(Folder,Persistent Line 366  class ZSQLExtendFolder(Folder,Persistent
                 if sys.exc_info()[0]=="Database Error":                  if sys.exc_info()[0]=="Database Error":
                     try:                      try:
                         getattr(self,self.connection_id).manage_open_connection()                          getattr(self,self.connection_id).manage_open_connection()
                     except: pass                      except:
                           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
Line 378  class ZSQLExtendFolder(Folder,Persistent Line 377  class ZSQLExtendFolder(Folder,Persistent
                 if sys.exc_info()[0]=="Database Error":                  if sys.exc_info()[0]=="Database Error":
                     try:                      try:
                         getattr(self,self.connection_id).manage_open_connection()                          getattr(self,self.connection_id).manage_open_connection()
                     except: pass                      except:
                           zLOG.LOG("ZSQLSimpleSearch",zLOG.ERROR, '%s %s'%sys.exc_info()[:2])
   
                                           
     def ZSQLSimpleSearch2(self,query=None):      def ZSQLSimpleSearch2(self,query=None):
         """ returrn SQLSearch"""          """ returrn SQLSearch"""
         #print "hi",query         
         if not query:          if not query:
             query=self.query              query=self.query
         if getattr(self,'_v_search',None):          if getattr(self,'_v_search',None):
Line 406  class ZSQLExtendFolder(Folder,Persistent Line 407  class ZSQLExtendFolder(Folder,Persistent
           
                   
                   
     def ZSQLAdd(self):      def ZSQLAdd(self,format=None,RESPONSE=None,**argv):
         """Neuer Eintrag"""          """Neuer Eintrag"""
         qs=self.REQUEST['QUERY_STRING']              
           qs_temp=[]
       
           for a in self.REQUEST.form.keys():
               qs_temp.append(a+"="+urllib.quote(str(self.REQUEST.form[a])))
   
           qs=string.join(qs_temp,",")
           
           for field in argv.keys():
                      if field[0]=="_":
                          fieldTmp="-"+field[1:]
                      else:
                          fieldTmp=field
                          
                      qs+=",%s=%s"%(fieldTmp,argv[field])
           
           
         addList={}          addList={}
         for q in qs.split("&"):          for q in qs.split(","):
             name=re.sub("r'+'"," ",q.split("=")[0].lower())              name=re.sub("r'+'"," ",q.split("=")[0].lower())
             value=q.split("=")[1]              value=q.split("=")[1]
         value=re.sub(r'\+'," ",value)          value=re.sub(r'\+'," ",value)
Line 419  class ZSQLExtendFolder(Folder,Persistent Line 436  class ZSQLExtendFolder(Folder,Persistent
                 table=urllib.unquote(value)                  table=urllib.unquote(value)
             elif name=="-format":              elif name=="-format":
                 format=urllib.unquote(value)                  format=urllib.unquote(value)
             elif (not name[0]=="-") and (not len(value)==0):              elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0):
                 addList[urllib.unquote(name)]=urllib.unquote(value)                  addList[urllib.unquote(name)]=urllib.unquote(value)
   
         keyList=[]          keyList=[]
Line 432  class ZSQLExtendFolder(Folder,Persistent Line 449  class ZSQLExtendFolder(Folder,Persistent
         valueString=string.join(valueList,",")          valueString=string.join(valueList,",")
                   
         queryString="INSERT INTO %s (%s) VALUES (%s)"%(table,keyString,valueString)          queryString="INSERT INTO %s (%s) VALUES (%s)"%(table,keyString,valueString)
   
         self.ZSQLSimpleSearch(queryString)          self.ZSQLSimpleSearch(queryString)
         return self.REQUEST.RESPONSE.redirect(format)          
           if RESPONSE and format:
               return RESPONSE.redirect(format)
           else:
               return True
                   
     def ZSQLChange(self,format=None,RESPONSE=None,**argv):      def ZSQLChange(self,format=None,RESPONSE=None,**argv):
         """change entries"""          """change entries"""
Line 471  class ZSQLExtendFolder(Folder,Persistent Line 493  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]=="-") 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 1341  class ZSQLBibliography(Folder,ZSQLExtend Line 1364  class ZSQLBibliography(Folder,ZSQLExtend
         else:          else:
             return ""              return ""
           
     def getMetaDataXML2(self):      def getXML2(self):
         """crate index meta"""          """crate index meta"""
   
         fn=os.path.splitext(self.REQUEST['fn'])[0]+"."          fn=os.path.splitext(self.REQUEST['fn'])[0]+"."

Removed from v.1.65  
changed lines
  Added in v.1.66


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