@@ -251,24 +251,28 @@ def update(self, name, value, separator="||", parse_index="$", _isDebug_=True):
251251 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
252252
253253
254- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
255- # # # # # # # # # # # # # # # delete # # # # # # # # # # # # #
256- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
257- # def delete(self, name, separator="||", parse_index="$"):
258- # import re
254+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
255+ # # # # # # # # # # # # # # delete # # # # # # # # # # # # #
256+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
257+ def delete (self , name , separator = "||" , parse_index = "$" , _isDebug_ = True ):
258+ import re
259259
260- # if self.get(name, separator=separator, parse_index=parse_index) != "JSON_DUPLICATE_KEYS_NOT_FOUND":
261- # exec_expression = "del self.getObject()"
262- # for k in name.split(separator):
263- # if re.search("^"+re.escape(parse_index)+"\d+"+re.escape(parse_index)+"$", k):
264- # exec_expression += "["+k.split(parse_index)[1]+"]"
265- # else:
266- # exec_expression += "["+repr(k)+"]"
260+ if self .get (name , separator = separator , parse_index = parse_index , _isDebug_ = _isDebug_ ) != "JSON_DUPLICATE_KEYS_NOT_FOUND" :
261+ try :
262+ exec_expression = "del self.getObject()"
267263
268- # exec(exec_expression)
269- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
270- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
271- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
264+ for k in name .split (separator ):
265+ if re .search ("^" + re .escape (parse_index )+ "\d+" + re .escape (parse_index )+ "$" , k ):
266+ exec_expression += "[" + k .split (parse_index )[1 ]+ "]"
267+ else :
268+ exec_expression += "[" + repr (k )+ "]"
269+
270+ exec (exec_expression )
271+ except Exception as e :
272+ if _isDebug_ : print ("\x1b [31m[-] ExceptionError: {}\x1b [0m" .format (e ))
273+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
274+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
275+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
272276
273277
274278 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
0 commit comments