Skip to content

Commit

Permalink
base: fixed admin view name.
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandromumo authored and kpsherva committed Sep 1, 2022
1 parent f23bacf commit 4319381
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions invenio_administration/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from invenio_administration.menu import AdminMenu

from .views.base import AdminBaseView
from .views.base import AdminView


class Administration:
Expand Down Expand Up @@ -91,8 +91,8 @@ def views(self):
def add_view(self, view, view_instance, *args, **kwargs):
"""Add a view to admin views."""
# Validate view's class and name's uniqueness.
if not issubclass(view.view_class, AdminBaseView):
raise TypeError(f"View class must be of type {AdminBaseView.__name__}")
if not issubclass(view.view_class, AdminView):
raise TypeError(f"View class must be of type {AdminView.__name__}")
if any(v.view_class.name == view.view_class.name for v in self.views):
raise ValueError(f"View name already registered: {view.view_class.name}")

Expand Down
8 changes: 4 additions & 4 deletions invenio_administration/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from . import config
from .admin import Administration
from .views.base import AdminBaseView
from .views.base import AdminView


class InvenioAdministration:
Expand Down Expand Up @@ -54,10 +54,10 @@ def load_entry_point_group(self, app):
app.register_blueprint(self.administration.blueprint)

def _load_entry_point(self, entry_point):
"""Loads one entry point. Validates whether its view is an AdminBaseView."""
"""Loads one entry point. Validates whether its view is an AdminView."""
ep = entry_point.load()
if not issubclass(ep, AdminBaseView):
raise TypeError(f"View class must be of type {AdminBaseView.__name__}")
if not issubclass(ep, AdminView):
raise TypeError(f"View class must be of type {AdminView.__name__}")
return ep

def register_view(self, view_class, extension_name, app, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from mock_module.administration.mock import MockView, MockViewAlternate

from invenio_administration.views.base import AdminBaseView
from invenio_administration.views.base import AdminView


class TestCustomView(AdminBaseView):
class TestCustomView(AdminView):
name = "Test Custom View"
extension_name = "test-custom-view"
category = "Test category"
Expand Down

0 comments on commit 4319381

Please sign in to comment.