This repository has been archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge master branch into juniper-rebase branch.
- Loading branch information
Showing
85 changed files
with
1,246 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
Configuration for edx_notifications Django app | ||
""" | ||
|
||
import logging | ||
|
||
from django.apps import AppConfig | ||
from django.conf import settings | ||
|
||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class EdxNotificationsConfig(AppConfig): | ||
""" | ||
Configuration class for edx_notifications Django app | ||
""" | ||
name = 'edx_notifications' | ||
verbose_name = "Notification subsystem" | ||
|
||
def ready(self): | ||
if settings.FEATURES.get('ENABLE_NOTIFICATIONS', False): | ||
startup_notification_subsystem() | ||
|
||
|
||
def startup_notification_subsystem(): | ||
""" | ||
Initialize the Notification subsystem | ||
""" | ||
try: | ||
from openedx.core.djangoapps.course_groups.scope_resolver import CourseGroupScopeResolver # pylint: disable=import-error | ||
from student.scope_resolver import CourseEnrollmentsScopeResolver, StudentEmailScopeResolver # pylint: disable=import-error | ||
from edx_solutions_projects.scope_resolver import GroupProjectParticipantsScopeResolver # pylint: disable=import-error | ||
from edx_notifications.scopes import register_user_scope_resolver | ||
from edx_notifications.namespaces import register_namespace_resolver | ||
from util.namespace_resolver import CourseNamespaceResolver # pylint: disable=import-error, no-name-in-module | ||
from edx_notifications import startup | ||
|
||
startup.initialize() | ||
|
||
# register the scope resolvers that the runtime will be providing to edx-notifications. | ||
register_user_scope_resolver('course_enrollments', CourseEnrollmentsScopeResolver()) | ||
register_user_scope_resolver('course_group', CourseGroupScopeResolver()) | ||
register_user_scope_resolver('group_project_participants', GroupProjectParticipantsScopeResolver()) | ||
register_user_scope_resolver('group_project_workgroup', GroupProjectParticipantsScopeResolver()) | ||
register_user_scope_resolver('user_email_resolver', StudentEmailScopeResolver()) | ||
|
||
# register namespace resolver | ||
register_namespace_resolver(CourseNamespaceResolver()) | ||
except Exception as ex: # pylint: disable=broad-except | ||
# Note this will fail when we try to run migrations as manage.py will call startup.py | ||
# and startup.initialze() will try to manipulate some database tables. | ||
# We need to research how to identify when we are being started up as part of | ||
# a migration script | ||
log.error( | ||
'There was a problem initializing notifications subsystem. ' | ||
'This could be because the database tables have not yet been created and ' | ||
'./manage.py lms syncdb needs to run setup.py. Error was "%s". Continuing...', str(ex) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.