From 0186e0d312b92322fa4fc8bebfb38eb6b4bf7046 Mon Sep 17 00:00:00 2001 From: Fabian Schindler <fabian.schindler.strauss@gmail.com> Date: Wed, 3 Aug 2022 11:49:33 +0200 Subject: [PATCH] Make EOxServer ItemBackend conformant to the new ABC --- registrar/backend/eoxserver.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/registrar/backend/eoxserver.py b/registrar/backend/eoxserver.py index 5af2fd0..5e72e4d 100644 --- a/registrar/backend/eoxserver.py +++ b/registrar/backend/eoxserver.py @@ -60,7 +60,7 @@ class ItemToProductTypeMapping(TypedDict): collections: List[str] -class EOxServerBackend(Backend["Item"]): +class ItemBackend(Backend["Item"]): """ EOxServer backend allows registration to be performed on a running EOxServer instance @@ -337,7 +337,7 @@ class EOxServerBackend(Backend["Item"]): return product @transaction.atomic - def register_item(self, source: Optional[Source], item: "Item", replace: bool): + def register(self, source: Optional[Source], item: "Item", replace: bool): """Registers the item to the endpoint Args: @@ -396,8 +396,13 @@ class EOxServerBackend(Backend["Item"]): else: raise RegistrationError(f"{item} not matched to any product_type") + def deregister(self, source: Optional[Source], item: "Item"): + """ Defers to ``deregister_identifier`` with the items identifier + """ + return self.deregister_identifier(item.id) + @transaction.atomic - def deregister_identifier(self, identifier: str) -> Optional[str]: + def deregister_identifier(self, identifier: str): """Attempts to deregister item Args: -- GitLab