MCPcopy
hub / github.com/tornadoweb/tornado / post

Method post

demos/blog/blog.py:237–254  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

235 self.render("create_author.html")
236
237 async def post(self):
238 if await self.any_author_exists():
239 raise tornado.web.HTTPError(400, "author already created")
240 hashed_password = await tornado.ioloop.IOLoop.current().run_in_executor(
241 None,
242 bcrypt.hashpw,
243 tornado.escape.utf8(self.get_argument("password")),
244 bcrypt.gensalt(),
245 )
246 author = await self.queryone(
247 "INSERT INTO authors (email, name, hashed_password) "
248 "VALUES (%s, %s, %s) RETURNING id",
249 self.get_argument("email"),
250 self.get_argument("name"),
251 tornado.escape.to_unicode(hashed_password),
252 )
253 self.set_signed_cookie("blogdemo_user", str(author.id))
254 self.redirect_to_next()
255
256
257class AuthLoginHandler(BaseHandler):

Callers

nothing calls this directly

Calls 7

any_author_existsMethod · 0.80
currentMethod · 0.80
get_argumentMethod · 0.80
queryoneMethod · 0.80
set_signed_cookieMethod · 0.80
redirect_to_nextMethod · 0.80
run_in_executorMethod · 0.45

Tested by

no test coverage detected