Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
Version Fix plus fixes for translations in api endpoints.
Browse files Browse the repository at this point in the history
Fixes for the tests pylint fixes.
  • Loading branch information
hamzamunir7300 committed Dec 5, 2018
1 parent c7d1b51 commit 2baa474
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions edx_notifications/stores/sql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from edx_notifications import const
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.utils.translation import get_language,ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _


class SQLNotificationType(models.Model):
Expand Down Expand Up @@ -124,7 +124,8 @@ def to_data_object(self, options=None): # pylint: disable=unused-argument
deliver_no_earlier_than=self.deliver_no_earlier_than,
expires_at=self.expires_at,
expires_secs_after_read=self.expires_secs_after_read,
payload=self.translate_payload_title(DictField.from_json(self.payload)), # special case, dict<-->JSON string
payload=self.translate_payload_title
(DictField.from_json(self.payload)), # special case, dict<-->JSON string
created=self.created,
resolve_links=DictField.from_json(self.resolve_links), # special case, dict<-->JSON string
object_id=self.object_id
Expand All @@ -133,9 +134,14 @@ def to_data_object(self, options=None): # pylint: disable=unused-argument
return msg

def translate_payload_title(self, payload):
"""
translate a the title of any announcement to the current course language
:param payload:
:return:
"""
if payload and 'notification_type' in payload and payload['notification_type'] == "courseannouncement":
announcement_date = payload['announcement_date']
title = _('Announcement on {annoucement_date}').format(annoucement_date=announcement_date)
title = _('Announcement on {annoucement_date}').format(annoucement_date=announcement_date) # pylint: disable=line-too-long, no-member
payload['title'] = title
return payload

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):

setup(
name='edx-notifications',
version='0.6.8',
version='0.6.9',
description='Notification subsystem for Open edX',
long_description=open('README.md').read(),
author='edX',
Expand Down

0 comments on commit 2baa474

Please sign in to comment.