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
6 changes: 3 additions & 3 deletions pymess/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.db import transaction
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _l
from django.utils.translation import ugettext
from django.utils.translation import gettext
from django.utils.timezone import now

from pymess.config import settings
Expand Down Expand Up @@ -47,10 +47,10 @@ def is_turned_on_batch_sending(self):
def publish_or_retry_message(self, message):
backend = self.get_backend(recipient=message.recipient)
if message.number_of_send_attempts > backend.get_batch_max_number_of_send_attempts():
backend._set_message_as_failed(message, error=ugettext('the number of send attempts exceeded the limit'))
backend._set_message_as_failed(message, error=gettext('the number of send attempts exceeded the limit'))
return False
elif message.created_at < now() - timedelta(seconds=self.get_batch_max_seconds_to_send()):
backend._set_message_as_failed(message, error=ugettext('the age of the message exceeds the send limit'))
backend._set_message_as_failed(message, error=gettext('the age of the message exceeds the send limit'))
return False
else:
backend.publish_message(message)
Expand Down
2 changes: 1 addition & 1 deletion pymess/backend/dialer/daktela.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re

from django.utils import timezone as tz
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from pymess.backend.dialer import DialerBackend
from pymess.config import settings
Expand Down
8 changes: 4 additions & 4 deletions pymess/backend/emails/mandrill.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from enum import Enum

from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext

import mandrill

Expand Down Expand Up @@ -97,9 +97,9 @@ def publish_message(self, message):
state = self.MANDRILL_STATES_MAPPING.get(mandrill_state)
error = None
if mandrill_state == MandrillState.INVALID:
error = ugettext('invalid')
error = gettext('invalid')
elif mandrill_state == MandrillState.REJECTED:
error = ugettext('rejected, mandrill message: "{}"').format(result['reject_reason'])
error = gettext('rejected, mandrill message: "{}"').format(result['reject_reason'])

extra_sender_data = message.extra_sender_data or {}
extra_sender_data['result'] = result
Expand Down
2 changes: 1 addition & 1 deletion pymess/backend/sms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.utils import timezone
from django.utils.module_loading import import_string
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from chamber.exceptions import PersistenceException

Expand Down
2 changes: 1 addition & 1 deletion pymess/backend/sms/ats_sms_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum

from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string

Expand Down
2 changes: 1 addition & 1 deletion pymess/backend/sms/sms_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum

from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.template.loader import render_to_string

from enumfields import IntegerChoicesEnum
Expand Down
2 changes: 1 addition & 1 deletion pymess/backend/sms/twilio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import gettext_lazy as _l

from pymess.backend.sms import SMSBackend
from pymess.enums import OutputSMSMessageState
Expand Down
2 changes: 1 addition & 1 deletion pymess/enums.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from enumfields import IntegerChoicesEnum

Expand Down
2 changes: 1 addition & 1 deletion pymess/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.db.models.functions import Cast
from django.template import Context, Template
from django.template.exceptions import TemplateDoesNotExist, TemplateSyntaxError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from chamber.models import SmartModel

Expand Down
6 changes: 3 additions & 3 deletions pymess/models/dialer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _

from pymess.config import settings
from pymess.enums import DialerMessageState
Expand Down Expand Up @@ -45,7 +45,7 @@ def clean(self):
super().clean()

def clean_recipient(self):
self.recipient = normalize_phone_number(force_text(self.recipient))
self.recipient = normalize_phone_number(force_str(self.recipient))

@property
def failed(self):
Expand Down
4 changes: 2 additions & 2 deletions pymess/models/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.core.files.base import ContentFile
from django.utils.functional import cached_property
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.translation import gettext, gettext_lazy as _
from django.template import Template, Context
from django.template.exceptions import TemplateSyntaxError, TemplateDoesNotExist

Expand Down Expand Up @@ -176,7 +176,7 @@ def clean_subject(self, context_data=None):
try:
self.render_subject(context_data or {})
except (TemplateSyntaxError, TemplateDoesNotExist) as ex:
raise ValidationError(ugettext('Error during template subject rendering: "{}"').format(ex))
raise ValidationError(gettext('Error during template subject rendering: "{}"').format(ex))

def get_subject(self):
return self.subject
Expand Down
2 changes: 1 addition & 1 deletion pymess/models/push.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from pymess.config import settings
from pymess.enums import PushNotificationMessageState
Expand Down
6 changes: 3 additions & 3 deletions pymess/models/sms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from chamber.utils import remove_accent
from django.db import models
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _

from pymess.config import settings
from pymess.utils import normalize_phone_number
Expand Down Expand Up @@ -36,7 +36,7 @@ class Meta(BaseMessage.Meta):
verbose_name_plural = _('output SMS')

def clean_recipient(self):
self.recipient = normalize_phone_number(force_text(self.recipient))
self.recipient = normalize_phone_number(force_str(self.recipient))

def clean_content(self):
if not settings.SMS_USE_ACCENT:
Expand Down
6 changes: 3 additions & 3 deletions pymess/templatetags/pymess.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.conf import settings
from django.template.base import Node, TemplateSyntaxError, render_value_in_context
from django.template.loader import render_to_string
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.html import format_html

register = template.Library()
Expand All @@ -24,9 +24,9 @@ def render(self, context):
value = self.variable_name.resolve(context)
if not value and not self.check_variable.resolve(context):
raise ValueError('Email with slug {} missing variable named {}'.format(self.email_slug.resolve(context),
force_text(self.variable_name)))
force_str(self.variable_name)))
if not value:
value = '{{{{ {} }}}}'.format(force_text(self.variable_name))
value = '{{{{ {} }}}}'.format(force_str(self.variable_name))

if self.assign_to:
context[self.assign_to] = render_value_in_context(value, context)
Expand Down
2 changes: 1 addition & 1 deletion pymess/utils/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pymess.config import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _


def find_banned_tag(html_body: str, banned_tags: Sequence[str] = None) -> Optional[str]:
Expand Down
2 changes: 1 addition & 1 deletion pymess/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (0, 7, 8)
VERSION = (0, 8, 0)


def get_version():
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def read(fname):
'Topic :: Internet :: WWW/HTTP',
],
install_requires=[
'django>=3.1',
'skip-django-chamber>=0.6.16.3',
'django>=4.2',
'skip-django-chamber>=0.7.2',
'beautifulsoup4==4.8.0',
'skip-django-choice-enumfields>=1.1.3.2',
],
Expand Down