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

Class edit

openlibrary/plugins/upstream/code.py:68–85  ·  view source on GitHub ↗

Overwrite ?m=edit behaviour for author, book, work, and people pages.

Source from the content-addressed store, hash-verified

66
67
68class edit(core.edit):
69 """Overwrite ?m=edit behaviour for author, book, work, and people pages."""
70
71 def GET(self, key):
72 page = web.ctx.site.get(key)
73 editable_keys_re = re.compile(r"/(authors|books|works|tags|lists|series|people/[^/]+/lists)/OL.*")
74 if editable_keys_re.match(key):
75 if page is None:
76 return web.seeother(key)
77 else:
78 return addbook.safe_seeother(page.url(suffix="/edit"))
79 else:
80 return core.edit.GET(self, key)
81
82 def POST(self, key):
83 if re.compile("/(people/[^/]+)").match(key) and spamcheck.is_spam():
84 return render_template("message.html", "Oops", "Something went wrong. Please try again later.")
85 return core.edit.POST(self, key)
86
87
88# handlers for change photo and change cover

Callers 1

POSTMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected