openlibhums / apc

APC management plugin for Janeway
GNU Affero General Public License v3.0
0 stars 1 forks source link

Default APC plugin settings not being populated #24

Open alainna opened 1 year ago

alainna commented 1 year ago

Describe the bug

The APC Plugin's "Settings" page is inaccessible. It appears to be that default settings are not being created if an admin access the "Settings" page and the journal has no settings already set.

Janeway version 1.4.4-RC-6

To Reproduce Steps to reproduce the behavior:

  1. Log into a Janeway journal with an account assigned Superuser/Admin permissions
  2. Navigate to the journal's APC Plugin page (/plugins/apc/settings/)
  3. Notice error
  4. Review Sentry report:

    DoesNotExist: SettingValue matching query does not exist.
     File "utils/setting_handler.py", line 109, in get_setting
       journal=journal,
     File "django/db/models/manager.py", line 85, in manager_method
       return getattr(self.get_queryset(), name)(*args, **kwargs)
     File "django/db/models/query.py", line 380, in get
       self.model._meta.object_name
    
    DoesNotExist: ('SettingValue matching query does not exist.', enable_apcs, 'plugin:apc')
     File "django/core/handlers/exception.py", line 41, in inner
       response = get_response(request)
     File "django/core/handlers/base.py", line 249, in _legacy_get_response
       response = self._get_response(request)
     File "django/core/handlers/base.py", line 187, in _get_response
       response = self.process_exception_by_middleware(e, request)
     File "django/core/handlers/base.py", line 185, in _get_response
       response = wrapped_callback(request, *callback_args, **callback_kwargs)
     File "security/decorators.py", line 739, in wrapper
       return func(request, *args, **kwargs)
     File "security/decorators.py", line 64, in wrapper
    return func(request, *args, **kwargs)
     File "security/decorators.py", line 190, in wrapper
       return func(request, *args, **kwargs)
     File "/apps/eschol/janeway/src/plugins/apc/views.py", line 137, in settings
       pretty='Enable APCs',
     File "utils/setting_handler.py", line 204, in get_plugin_setting
       default=True,
     File "utils/setting_handler.py", line 125, in get_setting
       create,
     File "utils/setting_handler.py", line 131, in get_setting
       raise e
     File "utils/setting_handler.py", line 109, in get_setting
       journal=journal,
     File "django/db/models/manager.py", line 85, in manager_method
       return getattr(self.get_queryset(), name)(*args, **kwargs)
     File "django/db/models/query.py", line 380, in get
       self.model._meta.object_name
  5. Review admin/core_setting to view enable_apc settings; note lack of setting for demo:

image

  1. Add new setting for enable_apc for journal demo.
  2. Review other apc plugin items and add new setting for each for journal demo where missing
  3. Return to /plugins/apc/settings/ ; the page should successfully load.
alainna commented 1 year ago

@hardyoyo has since done some initial testing in a local environment, in which journals are in domain mode -- unlike CDL's stg server, which are in path mode. In addition, the three journals which did have APC plugin settings were all originally set up in domain mode. The two may be related.