Ejemplo n.º 1
0
 def __escape_data(self, path, query_dict, escape_type=None):
     """
     GET/POST参数转义
     """
     data_copy = query_dict.copy()
     new_data = {}
     for _get_key, _get_value in data_copy.items():
         # json串不进行转义
         try:
             json.loads(_get_value)
             is_json = True
         except Exception, e:
             is_json = False
         # 转义新数据
         if not is_json:
             if escape_type is None:
                 use_type = self.__filter_param(path, _get_key)
             else:
                 use_type = escape_type
             if use_type == 'url':
                 new_data[_get_key] = url_escape(_get_value)
             elif use_type == 'texteditor':
                 new_data[_get_key] = texteditor_escape(_get_value)
             else:
                 new_data[_get_key] = html_escape(_get_value)
         else:
             new_data[_get_key] = html_escape(_get_value, True)
Ejemplo n.º 2
0
 def __escape_data(self, path, query_dict, escape_type=None):
     """
     GET/POST参数转义
     """
     data_copy = query_dict.copy()
     new_data = {}
     for _get_key, _get_value in data_copy.items():
         # json串不进行转义
         try:
             json.loads(_get_value)
             is_json = True
         except Exception, e:
             is_json = False
         # 转义新数据
         if not is_json:
             if escape_type is None:
                 use_type = self.__filter_param(path, _get_key)
             else:
                 use_type = escape_type
             if use_type == 'url':
                 new_data[_get_key] = url_escape(_get_value)
             elif use_type == 'texteditor':
                 new_data[_get_key] = texteditor_escape(_get_value)
             else:
                 new_data[_get_key] = html_escape(_get_value)
         else:
             new_data[_get_key] = html_escape(_get_value, True)
Ejemplo n.º 3
0
 def __escape_data(self, path, query_dict, escape_type=None):
     """
     GET/POST参数转义
     """
     data_copy = query_dict.copy()
     for _get_key, _get_value_list in data_copy.lists():
         new_value_list = []
         for _get_value in _get_value_list:
             new_value = _get_value
             # json串不进行转义
             try:
                 json.loads(_get_value)
                 is_json = True
             except:
                 is_json = False
             # 转义新数据
             if not is_json:
                 if escape_type is None:
                     use_type = self.__filter_param(path, _get_key)
                 else:
                     use_type = escape_type
                 if use_type == 'url':
                     new_value = url_escape(_get_value)
                 elif use_type == 'texteditor':
                     new_value = texteditor_escape(_get_value)
                 else:
                     new_value = html_escape(_get_value)
             else:
                 new_value = html_escape(_get_value, True)
             new_value_list.append(new_value)
         data_copy.setlist(_get_key, new_value_list)
     return data_copy
Ejemplo n.º 4
0
 def __escape_data(self, path, query_dict, escape_type=None):
     """
     GET/POST参数转义
     """
     data_copy = query_dict.copy()
     for _get_key, _get_value_list in data_copy.lists():
         new_value_list = []
         for _get_value in _get_value_list:
             new_value = _get_value
             # json串不进行转义
             try:
                 json.loads(_get_value)
                 is_json = True
             except:
                 is_json = False
             # 转义新数据
             if not is_json:
                 if escape_type is None:
                     use_type = self.__filter_param(path, _get_key)
                 else:
                     use_type = escape_type
                 if use_type == 'url':
                     new_value = url_escape(_get_value)
                 elif use_type == 'texteditor':
                     new_value = texteditor_escape(_get_value)
                 else:
                     new_value = html_escape(_get_value)
             else:
                 new_value = html_escape(_get_value, True)
             new_value_list.append(new_value)
         data_copy.setlist(_get_key, new_value_list)
     return data_copy