示例#1
0
 def _encodeUnicode(params):
     index = 0
     for i in params:
         # params can be a list or a dictonary
         # we need to define k depending if it is a list or a dictonary
         # in order to be able to do such a operation: params[k] = something.
         if isinstance(params, dict):
             param = params[i]
             k = i
         else:
             param = i
             k = index  # since we are  looping a list, we need to increment the index to
             index += 1 # get the correct 'k' in the next iteration.
         if isinstance(param, str) and param != "":
             params[k] = encodeUnicode(param)
             if params[k] == "":
                 raise BadRequest("Your browser is using an encoding which is not recognized by Indico. "
                                  "Please make sure you set your browser encoding to utf-8")
         elif isinstance(param, list) or isinstance(param, dict):
             Sanitization._encodeUnicode(param)
示例#2
0
 def _encodeUnicode(params):
     index = 0
     for i in params:
         # params can be a list or a dictonary
         # we need to define k depending if it is a list or a dictonary
         # in order to be able to do such a operation: params[k] = something.
         if isinstance(params, dict):
             param = params[i]
             k = i
         else:
             param = i
             k = index  # since we are  looping a list, we need to increment the index to
             index += 1 # get the correct 'k' in the next iteration.
         if isinstance(param, str) and param != "":
             params[k] = encodeUnicode(param)
             if params[k] == "":
                 raise BadRequest("Your browser is using an encoding which is not recognized by Indico. "
                                  "Please make sure you set your browser encoding to utf-8")
         elif isinstance(param, list) or isinstance(param, dict):
             Sanitization._encodeUnicode(param)
示例#3
0
 def escapeString(self, text):
     tmp = encodeUnicode(text, self._sourceEncoding)
     return saxutils.escape(tmp)
示例#4
0
 def escapeString(self,text):
     tmp = encodeUnicode(text, self._sourceEncoding)
     return saxutils.escape( tmp )