コード例 #1
0
ファイル: auth.py プロジェクト: wmark/anzuwiki
 def _on_auth(self, user):
     if not user:
         raise HTTPError(500, "Google auth failed")
     print "-----------------------------------------------------------------------"
     print user
     print "-----------------------------------------------------------------------"
     if user['email'] in users:
         self.set_secure_cookie("user", escape.json_encode(user))
         self.redirect("/")
     else:
         raise HTTPError(500, "User unknown - you must be registered by hand by Wais")
コード例 #2
0
ファイル: escape_test.py プロジェクト: genelee/anzu
 def test_json_encode(self):
     # json deals with strings, not bytes, but our encoding function should
     # accept bytes as well as long as they are utf8.
     self.assertEqual(json_decode(json_encode(u"\u00e9")), u"\u00e9")
     self.assertEqual(json_decode(json_encode(utf8(u"\u00e9"))), u"\u00e9")
     self.assertRaises(UnicodeDecodeError, json_encode, b("\xe9"))
コード例 #3
0
ファイル: escape_test.py プロジェクト: wmark/anzu
 def test_json_encode(self):
     # json deals with strings, not bytes, but our encoding function should
     # accept bytes as well as long as they are utf8.
     self.assertEqual(json_decode(json_encode(u"\u00e9")), u"\u00e9")
     self.assertEqual(json_decode(json_encode(utf8(u"\u00e9"))), u"\u00e9")
     self.assertRaises(UnicodeDecodeError, json_encode, b("\xe9"))