Overwrite ?m=edit behaviour for author, book, work, and people pages.
| 66 | |
| 67 | |
| 68 | class 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 |