--- ZSQLExtend/ZSQLExtend.py 2008/03/31 13:31:34 1.126 +++ ZSQLExtend/ZSQLExtend.py 2008/06/19 11:46:29 1.127 @@ -579,9 +579,9 @@ class ZSQLExtendFolder(Folder,Persistent @param str: string der Formatiert werden soll. @param url: (optional) default ist "None", sonderfall erzeugt einen Link aus String mit unterliegender url """ - #logging.debug("formatascii str=%s url=%s"%(repr(str),repr(url))) + #logging.debug("formatascii str=%s url=%s"%(repr(str),repr(url))) - if not str: + if not str: return "" str=str.rstrip().lstrip() @@ -662,6 +662,7 @@ class ZSQLExtendFolder(Folder,Persistent @param _value: String der gesucht werden soll, gesucht wird nach allen Worten des Strings, die durch " "-getrennt sind. @param _idField: Feld mit id fŸr die identifikation gleicher EintrŠge @param _additionalStatement: (optional) Zusaetzliches SQL Statement, dass zwischen dem ersten "select from" und dem ersten "where" eingegefŸgt wird. + @param _subselectAddition: (optiona) Zusaetliche SQL Statement die hinter das select statement der subselects eingefuegt werde. @param _select: (optional) Alternativer Wert fŸr den ersten SELECT Aufruf. @param _storename: (optional) Name fuer die Zwischenspeicherung von Werten in der Session """ @@ -873,7 +874,7 @@ class ZSQLExtendFolder(Folder,Persistent #print "INLINE:",argv for a in argTmp.keys(): - aFiltered=re.sub(r"^-","_",a) # beginning of a command should always be "_" + aFiltered=re.sub(r"^-","_",a) # beginning of a command should always be "_" qs.append(aFiltered+"="+urllib.quote(str(argTmp[a]))) #return [] ret = self.parseQueryString(string.join(qs,","),"_",storename=storename) @@ -1036,18 +1037,19 @@ class ZSQLExtendFolder(Folder,Persistent - def ZSQLAdd(self,format=None,RESPONSE=None,args=None,**argv): + def ZSQLAdd(self,format=None,RESPONSE=None,args=None,_useRequest=True,**argv): """Neuer Eintrag""" - if args: + if args: argTmp=args else: argTmp=argv qs_temp=[] - for a in self.REQUEST.form.keys(): - qs_temp.append(a+"="+urllib.quote(str(self.REQUEST.form[a]))) + if _useRequest: + for a in self.REQUEST.form.keys(): + qs_temp.append(a+"="+urllib.quote(str(self.REQUEST.form[a]))) qs=string.join(qs_temp,",") @@ -1062,7 +1064,10 @@ class ZSQLExtendFolder(Folder,Persistent addList={} for q in qs.split(","): + if len(q.split("="))<2: + continue name=re.sub("r'+'"," ",q.split("=")[0].lower()) + value=q.split("=")[1] value=re.sub(r'\+'," ",value) value=urllib.unquote(value) @@ -1137,10 +1142,10 @@ class ZSQLExtendFolder(Folder,Persistent #elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0): elif (not (name[0]=="-" or name[0]=="_")): - if value=="": - changeList.append("\""+name+"\"=null") - else: - changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value))) + if value=="": + changeList.append("\""+name+"\"=null") + else: + changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value))) changeString=string.join(changeList,",")