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:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user