diff --git a/nau_openedx_extensions/filters/definition.py b/nau_openedx_extensions/filters/definition.py index 96ed8bf..cb850f8 100644 --- a/nau_openedx_extensions/filters/definition.py +++ b/nau_openedx_extensions/filters/definition.py @@ -1,10 +1,9 @@ """Filters definition module.""" +from django.db.models.query import QuerySet from openedx_filters.exceptions import OpenEdxFilterException from openedx_filters.tooling import OpenEdxPublicFilter -from django.db.models.query import QuerySet - class ScheduleQuerySetRequested(OpenEdxPublicFilter): """ diff --git a/nau_openedx_extensions/filters/pipeline.py b/nau_openedx_extensions/filters/pipeline.py index d4b584e..850c455 100644 --- a/nau_openedx_extensions/filters/pipeline.py +++ b/nau_openedx_extensions/filters/pipeline.py @@ -102,7 +102,7 @@ class FilterUsersWithAllowedNewsletter(PipelineStep): ``` """ - def run_filter(self, schedules: QuerySet) -> dict: + def run_filter(self, schedules: QuerySet) -> dict: # pylint: disable=arguments-differ """ Execute filter that filters users with allowed newsletter. @@ -122,9 +122,9 @@ def run_filter(self, schedules: QuerySet) -> dict: return { "schedules": filtered_schedules, } - except FieldError: - raise ScheduleQuerySetRequested.PreventScheduleQuerysetRequest( + except FieldError as exc: + raise ScheduleQuerySetRequested.PreventScheduleQuerySetRequest( "The filter can't be applied because the user model " "doesn't have the attribute 'nauuserextendedmodel'.", schedules, - ) + ) from exc