MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / POST

Method POST

openlibrary/plugins/openlibrary/code.py:336–349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

334 path = "/addauthor"
335
336 def POST(self):
337 if not (get_current_user()):
338 raise web.unauthorized()
339 i = web.input("name")
340 if len(i.name) < 2:
341 return web.badrequest()
342 key = web.ctx.site.new_key("/type/author")
343 web.ctx.path = key
344 web.ctx.site.save(
345 {"key": key, "name": i.name, "type": {"key": "/type/author"}},
346 comment="New Author",
347 action="create-author",
348 )
349 raise web.HTTPError("200 OK", {}, key)
350
351
352class clonebook(delegate.page):

Callers

nothing calls this directly

Calls 4

get_current_userFunction · 0.90
lenFunction · 0.85
new_keyMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected