Beispiel #1
0
 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")
Beispiel #2
0
 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"))
Beispiel #3
0
 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"))