Commit 926d1557 by Hasnain

i18n for xblock templates. Created a custom Django template tag library which…

i18n for xblock templates. Created a custom Django template tag library which uses the i18n runtime service.

# Conflicts:
#	workbench/settings.py
parent bea31fb8
...@@ -366,10 +366,12 @@ class SiteConfiguration(models.Model): ...@@ -366,10 +366,12 @@ class SiteConfiguration(models.Model):
""" """
key = 'siteconfiguration_access_token_{}'.format(self.id) key = 'siteconfiguration_access_token_{}'.format(self.id)
access_token = cache.get(key) access_token = cache.get(key)
log.info("--------------testing---------------------")
# pylint: disable=unsubscriptable-object # pylint: disable=unsubscriptable-object
if not access_token: if not access_token:
url = '{root}/access_token'.format(root=self.oauth2_provider_url) url = '{root}/access_token'.format(root=self.oauth2_provider_url)
log.info("--------------testing2---------------------")
log.info(url)
access_token, expiration_datetime = EdxRestApiClient.get_oauth_access_token( access_token, expiration_datetime = EdxRestApiClient.get_oauth_access_token(
url, url,
self.oauth_settings['SOCIAL_AUTH_EDX_OIDC_KEY'], self.oauth_settings['SOCIAL_AUTH_EDX_OIDC_KEY'],
...@@ -379,7 +381,8 @@ class SiteConfiguration(models.Model): ...@@ -379,7 +381,8 @@ class SiteConfiguration(models.Model):
expires = (expiration_datetime - datetime.datetime.utcnow()).seconds expires = (expiration_datetime - datetime.datetime.utcnow()).seconds
cache.set(key, access_token, expires) cache.set(key, access_token, expires)
log.info("--------------access token---------------------")
log.info(access_token)
return access_token return access_token
@cached_property @cached_property
...@@ -428,17 +431,6 @@ class SiteConfiguration(models.Model): ...@@ -428,17 +431,6 @@ class SiteConfiguration(models.Model):
@cached_property @cached_property
def commerce_api_client(self): def commerce_api_client(self):
log.info("--------------testing---------------------")
log.info(self.build_lms_url('/api/commerce/v1/'))
try:
return EdxRestApiClient(self.build_lms_url('/api/commerce/v1/'), jwt=self.access_token)
except Exception as e:
log.exception(
'Failed to publish CreditCourse for to LMS. Status was [%d]. Body was [%s].',
e.response.status_code,
e.content
)
return EdxRestApiClient(self.build_lms_url('/api/commerce/v1/'), jwt=self.access_token) return EdxRestApiClient(self.build_lms_url('/api/commerce/v1/'), jwt=self.access_token)
@cached_property @cached_property
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment