Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add improperly configured exception in load permissions function #274

Merged
merged 7 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ Please do not update the unreleased notes.

<!-- Content should be placed here -->

## [v10.5.1](https://github.com/eduNEXT/eox-core/compare/v10.5.0...v10.5.1) - (2024-07-19)

### Fixed

- **Redwood Compatibility**: Corrected a build-time error, ensuring full
compatibility with the Redwood release. For this, a new `ImproperlyConfigured`
exception is handled when loading the API permissions.

### Changed

- **Improve Documentation**: Update the README to include a more detailed
description of the project and its features. A new how-to section was
included with information about API, Middlewares, and pipelines.

## [v10.5.0](https://github.com/eduNEXT/eox-core/compare/v10.4.0...v10.5.0) - (2024-07-08)

### Added
Expand All @@ -21,7 +35,7 @@ Please do not update the unreleased notes.

### Changed

- **Redwood Support**: Upgrade requirements base on edx-platform redwood
- **Redwood Support**: Upgrade requirements base on edx-platform Redwood
release, update GitHub workflows with new actions version, and update
integration test to use new Redwood release with Tutor.

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Compatibility Notes
+------------------+--------------+
| Quince | >= 10.0 |
+------------------+--------------+
| Redwood | >= 10.5.0 |
| Redwood | >= 10.5.1 |
magajh marked this conversation as resolved.
Show resolved Hide resolved
+------------------+--------------+

⚠️ The Maple version does not support Django 2.2 but it does support Django 3.2 as of eox-core 7.0.
Expand Down
2 changes: 1 addition & 1 deletion eox_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Init for main eox-core app
"""
__version__ = '10.5.0'
__version__ = '10.5.1'
11 changes: 7 additions & 4 deletions eox_core/api/v1/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.conf import settings
from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import ProgrammingError
from rest_framework import exceptions, permissions

Expand All @@ -18,14 +19,16 @@ def load_permissions():
if settings.EOX_CORE_LOAD_PERMISSIONS:
try:
content_type = ContentType.objects.get_for_model(User)
obj, created = Permission.objects.get_or_create( # pylint: disable=unused-variable
Permission.objects.get_or_create(
codename='can_call_eox_core',
name='Can access eox-core API',
content_type=content_type,
)
except ProgrammingError:
# This code runs when the app is loaded, if a migration has not been done a ProgrammingError exception is raised
# we are bypassing those cases to let migrations run smoothly.
except (ProgrammingError, ImproperlyConfigured):
# This code runs when the app is loaded. If a migration has not been done, a
# ProgrammingError is raised. The ImproperlyConfigured exception typically
# indicates a configuration issue. We are bypassing these exceptions to allow
# the migrations to run smoothly when building the Open edX image.
pass


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 10.5.0
current_version = 10.5.1
commit = False
tag = False

Expand Down
Loading