test: Enforce application layering using import linter (#36581)

* test: add import linters to promote clean dependencies

* docs: update a few comments / todos
This commit is contained in:
Braden MacDonald
2025-04-22 21:28:30 -07:00
committed by GitHub
parent 9d45f855d6
commit ce00b16be7
4 changed files with 41 additions and 1 deletions

View File

@@ -131,7 +131,6 @@ class UserClipboard(models.Model):
def clean(self):
""" Check that this model is being used correctly. """
# These could probably be replaced with constraints in Django 4.1+
if self.user.id != self.content.user.id:
raise ValidationError("User ID mismatch.")
if self.content.purpose != CLIPBOARD_PURPOSE:

View File

@@ -81,6 +81,12 @@ class ClipboardEndpoint(APIView):
def post(self, request):
"""
Put some piece of content into the user's clipboard.
FIXME: This API needs to be deprecated and replaced by dedicated APIs
within each learning context (POST /course/foo/bar/copy, POST
/library/foo/bar/copy, etc.) We don't want to encode course- and
library-specific logic in content staging, and it shouldn't import
course or library modules.
"""
# Check if the content exists and the user has permission to read it.
# Parse the usage key: