Compare commits

..

3 Commits

Author SHA1 Message Date
Mira Weller
ac3a3c2758 TEST 2024-06-24 16:24:25 +02:00
Mira Weller
50ccb9f785 TEST 2024-06-24 16:09:07 +02:00
Raphael Michel
d3fce71b7f Bump version to 2024.7.0.dev0 2024-06-24 11:05:53 +02:00
6 changed files with 32 additions and 13 deletions

View File

@@ -19,4 +19,4 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
__version__ = "2024.6.1"
__version__ = "2024.7.0.dev0"

View File

@@ -38,7 +38,6 @@ from datetime import datetime
from django import forms
from django.utils.formats import get_format
from django.utils.functional import lazy
from django.utils.html import escape
from django.utils.timezone import get_current_timezone, now
from django.utils.translation import gettext_lazy as _
@@ -65,7 +64,7 @@ def format_placeholders_help_text(placeholders, event=None):
placeholders = [(k, v.render_sample(event) if event else v) for k, v in placeholders.items()]
placeholders.sort(key=lambda x: x[0])
phs = [
'<button type="button" class="content-placeholder" title="%s">{%s}</button>' % (escape(_("Sample: %s") % v) if v else "", escape(k))
'<button type="button" class="content-placeholder" title="%s">{%s}</button>' % (_("Sample: %s") % v if v else "", k)
for k, v in placeholders
]
return _('Available placeholders: {list}').format(

View File

@@ -62,7 +62,6 @@ from django.http import (
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.html import escape
from django.utils.http import url_has_allowed_host_and_scheme
from django.utils.timezone import now
from django.utils.translation import gettext, gettext_lazy as _, gettext_noop
@@ -737,7 +736,7 @@ class MailSettingsPreview(EventPermissionRequiredMixin, View):
else:
ctx[p.identifier] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'),
escape(s)
s
)
return ctx
@@ -787,7 +786,7 @@ class MailSettingsRendererPreview(MailSettingsPreview):
def placeholders(self, item):
ctx = {}
for p in get_available_placeholders(self.request.event, MailSettingsForm.base_context[item]).values():
ctx[p.identifier] = escape(str(p.render_sample(self.request.event)))
ctx[p.identifier] = str(p.render_sample(self.request.event))
return ctx
def get(self, request, *args, **kwargs):

View File

@@ -50,7 +50,7 @@ from django.http import (
from django.shortcuts import redirect, render
from django.urls import resolve, reverse
from django.utils.functional import cached_property
from django.utils.html import escape, format_html
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
@@ -562,7 +562,7 @@ class VoucherBulkMailPreview(EventPermissionRequiredMixin, View):
else:
ctx[p.identifier] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'),
escape(s)
s
)
return self.SafeDict(ctx)

View File

@@ -46,7 +46,6 @@ from django.shortcuts import get_object_or_404, redirect
from django.template.loader import get_template
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.html import escape
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _, ngettext
from django.views.generic import DeleteView, FormView, ListView, TemplateView
@@ -194,7 +193,7 @@ class BaseSenderView(EventPermissionRequiredMixin, FormView):
for k, v in get_available_placeholders(self.request.event, self.context_parameters).items():
context_dict[k] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'),
escape(v.render_sample(self.request.event))
v.render_sample(self.request.event)
)
subject = bleach.clean(form.cleaned_data['subject'].localize(l), tags=[])
@@ -609,7 +608,7 @@ class CreateRule(EventPermissionRequiredMixin, CreateView):
'position_or_address']).items():
context_dict[k] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'),
escape(v.render_sample(self.request.event))
v.render_sample(self.request.event)
)
subject = bleach.clean(form.cleaned_data['subject'].localize(l), tags=[])
@@ -685,7 +684,7 @@ class UpdateRule(EventPermissionRequiredMixin, UpdateView):
for k, v in get_available_placeholders(self.request.event, ['event', 'order', 'position_or_address']).items():
placeholders[k] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'),
escape(v.render_sample(self.request.event))
v.render_sample(self.request.event)
)
subject = bleach.clean(self.object.subject.localize(lang), tags=[])

View File

@@ -54,13 +54,35 @@ def test_same_day_english():
assert daterange(df, df, as_html=True) == '<time datetime="2003-02-01">Feb. 1st, 2003</time>'
def test_same_day_spanish():
def test_same_day_spanish_es():
with translation.override('es'):
df = date(2003, 2, 1)
assert daterange(df, df) == "1 de febrero de 2003"
assert daterange(df, df, as_html=True) == '<time datetime="2003-02-01">1 de febrero de 2003</time>'
def test_same_day_spanish_es_AR():
with translation.override('es_AR'):
df = date(2003, 2, 1)
assert daterange(df, df) == "1 de febrero de 2003"
assert daterange(df, df, as_html=True) == '<time datetime="2003-02-01">1 de febrero de 2003</time>'
def test_same_day_spanish_es_MX():
with translation.override('es_MX'):
df = date(2003, 2, 1)
assert daterange(df, df) == "1 de febrero de 2003"
assert daterange(df, df, as_html=True) == '<time datetime="2003-02-01">1 de febrero de 2003</time>'
def test_grep_locales():
import os,sys
print("path",sys.path)
os.system("grep -IR febrero /opt/hostedtoolcache/Python/3.11.9/x64")
os.system("grep -IR Febrero /opt/hostedtoolcache/Python/3.11.9/x64")
assert True == False
def test_same_day_other_lang():
with translation.override('tr'):
df = date(2003, 2, 1)