diff --git a/src/palace/manager/api/admin/controller/lanes.py b/src/palace/manager/api/admin/controller/lanes.py index d8de53c6c..eafe7a906 100644 --- a/src/palace/manager/api/admin/controller/lanes.py +++ b/src/palace/manager/api/admin/controller/lanes.py @@ -215,9 +215,10 @@ def hide_lane(self, lane_identifier): return Response(str(_("Success")), 200) def reset(self): - self.require_library_manager(get_request_library()) + library = get_request_library() + self.require_library_manager(library) - create_default_lanes(self._db, get_request_library()) + create_default_lanes(self._db, library) return Response(str(_("Success")), 200) def change_order(self): diff --git a/src/palace/manager/api/admin/controller/work_editor.py b/src/palace/manager/api/admin/controller/work_editor.py index 2adc7110c..1ef68f412 100644 --- a/src/palace/manager/api/admin/controller/work_editor.py +++ b/src/palace/manager/api/admin/controller/work_editor.py @@ -63,13 +63,14 @@ def details(self, identifier_type, identifier): :return: An OPDSEntryResponse """ - self.require_librarian(get_request_library()) + library = get_request_library() + self.require_librarian(library) - work = self.load_work(get_request_library(), identifier_type, identifier) + work = self.load_work(library, identifier_type, identifier) if isinstance(work, ProblemDetail): return work - annotator = AdminAnnotator(self.circulation, get_request_library()) + annotator = AdminAnnotator(self.circulation, library) # single_entry returns an OPDSEntryResponse that will not be # cached, which is perfect. We want the admin interface @@ -137,7 +138,8 @@ def rights_status(self): def edit(self, identifier_type, identifier): """Edit a work's metadata.""" - self.require_librarian(get_request_library()) + library = get_request_library() + self.require_librarian(library) # TODO: It would be nice to use the metadata layer for this, but # this code handles empty values differently than other metadata @@ -146,7 +148,7 @@ def edit(self, identifier_type, identifier): # db so that it can overrule other data sources that set a value, # unlike other sources which set empty fields to None. - work = self.load_work(get_request_library(), identifier_type, identifier) + work = self.load_work(library, identifier_type, identifier) if isinstance(work, ProblemDetail): return work @@ -434,9 +436,10 @@ def unsuppress( def refresh_metadata(self, identifier_type, identifier, provider=None): """Refresh the metadata for a book from the content server""" - self.require_librarian(get_request_library()) + library = get_request_library() + self.require_librarian(library) - work = self.load_work(get_request_library(), identifier_type, identifier) + work = self.load_work(library, identifier_type, identifier) if isinstance(work, ProblemDetail): return work @@ -465,9 +468,10 @@ def refresh_metadata(self, identifier_type, identifier, provider=None): def classifications(self, identifier_type, identifier): """Return list of this work's classifications.""" - self.require_librarian(get_request_library()) + library = get_request_library() + self.require_librarian(library) - work = self.load_work(get_request_library(), identifier_type, identifier) + work = self.load_work(library, identifier_type, identifier) if isinstance(work, ProblemDetail): return work @@ -503,9 +507,10 @@ def classifications(self, identifier_type, identifier): def edit_classifications(self, identifier_type, identifier): """Edit a work's audience, target age, fiction status, and genres.""" - self.require_librarian(get_request_library()) + library = get_request_library() + self.require_librarian(library) - work = self.load_work(get_request_library(), identifier_type, identifier) + work = self.load_work(library, identifier_type, identifier) if isinstance(work, ProblemDetail): return work @@ -671,9 +676,8 @@ def edit_classifications(self, identifier_type, identifier): return Response("", 200) def custom_lists(self, identifier_type, identifier): - self.require_librarian(get_request_library()) - library = get_request_library() + self.require_librarian(library) work = self.load_work(library, identifier_type, identifier) if isinstance(work, ProblemDetail): return work