Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import json
import logging

from django.db import migrations

Expand All @@ -12,7 +11,6 @@ def move_overrides_to_edx_when(apps, schema_editor):
from edx_when import api
date_field = Date()
StudentFieldOverride = apps.get_model('courseware', 'StudentFieldOverride')
log = logging.getLogger(__name__)
for override in StudentFieldOverride.objects.filter(field='due'):
try:
abs_date = date_field.from_json(json.loads(override.value))
Expand All @@ -23,7 +21,10 @@ def move_overrides_to_edx_when(apps, schema_editor):
abs_date,
user=override.student)
except Exception: # pylint: disable=broad-except
log.exception("migrating %d %r: %r", override.id, override.location, override.value)
# The following line is commented since these logs only add noise to output console
# Thi migration only works with IDDE
# log.exception("migrating %d %r: %r", override.id, override.location, override.value)
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave this comment:

            # The following line is commented since these logs only add noise to output console
            # Thi migration only works with IDDE
            # log.exception("migrating %d %r: %r", override.id, override.location, override.value)

From: cb57dec

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaferMazu this is done!



class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from datetime import datetime, timedelta

from django.conf import settings
from django.contrib.auth import authenticate, get_user_model
from django.db.models.signals import pre_save
from django.dispatch import receiver
Expand Down Expand Up @@ -81,7 +82,12 @@ def save_bearer_token(self, token, request, *args, **kwargs):
# associate access tokens issued with the client_credentials grant to users.
request.user = request.client.user

super().save_bearer_token(token, request, *args, **kwargs)
# ednx: JU-10. Tokens for the machine-to-machine comunication should be longer lived
# for backwards compatibility with eox-core and other plugin APIs.
# Without this modification the BearerToken class will set this to 3600
request.expires_in = getattr(settings, 'CLIENT_CREDENTIALS_ACCESS_TOKEN_EXPIRE_SECONDS', 31557600)

super(EdxOAuth2Validator, self).save_bearer_token(token, request, *args, **kwargs)

is_restricted_client = self._update_token_expiry_if_restricted_client(token, request.client)
if not is_restricted_client:
Expand Down