예제 #1
0
파일: tindo.py 프로젝트: wsgan001/CodeBase
 def _get_cookies(self):
     """
     HTTP_COOKIE: theme=light; sessionToken=abc123; value=10
     :return:
     """
     if not hasattr(self, '_cookies'):
         cookies = {}
         cookie_str = self._environ.get('HTTP_COOKIE')
         if cookie_str:
             for c in cookie_str.split(';'):
                 pos = c.find('=')
                 if pos > 0:
                     cookies[c[:pos].strip()] = unquote(c[pos+1:])
         self._cookies = cookies
     return self._cookies
예제 #2
0
 def test_handles_normal_string(self):
     assert http.unquote("foo bar").decode("utf-8") == "foo bar"
예제 #3
0
 def test_handles_empty_string(self):
     assert http.unquote("").decode("utf-8") == ""
예제 #4
0
 def test_handles_url_encoding(self):
     assert http.unquote("%23123").decode("utf-8") == "#123"
예제 #5
0
 def test_handles_spaces(self):
     assert http.unquote("foo+bar+baz").decode("utf-8") == "foo bar baz"
예제 #6
0
파일: tindo.py 프로젝트: wsgan001/CodeBase
 def path_info(self):
     """Get request path as str.
     """
     return unquote(self._environ.get('PATH_INFO', ''))