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

Function block_ip_processor

openlibrary/plugins/admin/code.py:515–519  ·  view source on GitHub ↗
(handler)

Source from the content-addressed store, hash-verified

513
514
515def block_ip_processor(handler):
516 if not web.ctx.path.startswith("/admin") and (web.ctx.method == "POST" or web.ctx.path.endswith("/edit")) and web.ctx.ip in get_blocked_ips():
517 return render_template("permission_denied", web.ctx.path, "Your IP address is blocked.")
518 else:
519 return handler()
520
521
522def daterange(startdate: datetime, *slice):

Callers

nothing calls this directly

Calls 2

get_blocked_ipsFunction · 0.85
render_templateFunction · 0.70

Tested by

no test coverage detected