forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add events emitting for Collections
- Loading branch information
1 parent
743291c
commit 3da44d5
Showing
10 changed files
with
103 additions
and
5 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
Empty file.
57 changes: 57 additions & 0 deletions
57
openedx/core/djangoapps/content_libraries/collections/handlers.py
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,57 @@ | ||
""" | ||
Signal handlers for Content Library Collections. | ||
""" | ||
|
||
import logging | ||
|
||
from django.dispatch import receiver | ||
from openedx_events.content_authoring.data import LibraryCollectionData | ||
from openedx_events.content_authoring.signals import ( | ||
LIBRARY_COLLECTION_CREATED, | ||
LIBRARY_COLLECTION_UPDATED, | ||
LIBRARY_COLLECTION_DELETED, | ||
) | ||
|
||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
@receiver(LIBRARY_COLLECTION_CREATED) | ||
def library_collection_created_handler(**kwargs): | ||
""" | ||
Content Library Collection Created signal handler | ||
""" | ||
library_collection_data = kwargs.get("library_collection", None) | ||
if not library_collection_data or not isinstance(library_collection_data, LibraryCollectionData): | ||
log.error("Received null or incorrect data for event") | ||
return | ||
|
||
log.info("Received Collection Created Signal") | ||
|
||
# TODO: Implement handler logic | ||
|
||
|
||
@receiver(LIBRARY_COLLECTION_UPDATED) | ||
def library_collection_updated_handler(**kwargs): | ||
""" | ||
Content Library Collection Updated signal handler | ||
""" | ||
library_collection_data = kwargs.get("library_collection", None) | ||
if not library_collection_data or not isinstance(library_collection_data, LibraryCollectionData): | ||
log.error("Received null or incorrect data for event") | ||
return | ||
|
||
log.info("Received Collection Updated Signal") | ||
|
||
|
||
@receiver(LIBRARY_COLLECTION_DELETED) | ||
def library_collection_deleted_handler(**kwargs): | ||
""" | ||
Content Library Collection Deleted signal handler | ||
""" | ||
library_collection_data = kwargs.get("library_collection", None) | ||
if not library_collection_data or not isinstance(library_collection_data, LibraryCollectionData): | ||
log.error("Received null or incorrect data for event") | ||
return | ||
|
||
log.info("Received Collection Deleted Signal") |
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