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

Method handle

openlibrary/plugins/admin/code.py:137–150  ·  view source on GitHub ↗
(self, cls, args=(), librarians=False)

Source from the content-addressed store, hash-verified

135 raise web.notfound()
136
137 def handle(self, cls, args=(), librarians=False):
138 # Use admin theme
139 context.cssfile = "admin"
140
141 m = getattr(cls(), web.ctx.method, None)
142 if not m:
143 raise web.nomethod(cls=cls)
144 else:
145 if context.user and context.user.is_librarian() and web.ctx.path == "/admin/solr":
146 return m(*args)
147 if self.is_admin() or (librarians and context.user and context.user.is_super_librarian()):
148 return m(*args)
149 else:
150 return render.permission_denied(web.ctx.path, "Permission denied.")
151
152 GET = POST = delegate
153

Callers 1

delegateMethod · 0.95

Calls 3

is_adminMethod · 0.95
is_librarianMethod · 0.80
is_super_librarianMethod · 0.80

Tested by

no test coverage detected