Merge branch 'release/v8.70'
This commit is contained in:
@@ -53,6 +53,18 @@ def textify(html):
|
|||||||
# Strip single spaces in the beginning of each line
|
# Strip single spaces in the beginning of each line
|
||||||
return text_only.replace('\n ', '\n').strip()
|
return text_only.replace('\n ', '\n').strip()
|
||||||
|
|
||||||
|
def htmlstripnobr(html):
|
||||||
|
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||||
|
return safe_html
|
||||||
|
|
||||||
|
def htmlstrip(html):
|
||||||
|
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
|
||||||
|
return newlinetobr(safe_html)
|
||||||
|
|
||||||
|
def newlinetobr(html):
|
||||||
|
html = html.replace('\n\n','<br>')
|
||||||
|
return html.replace('\n','<br>')
|
||||||
|
|
||||||
def send_template_email(from_email,to_email,subject,
|
def send_template_email(from_email,to_email,subject,
|
||||||
template,context,
|
template,context,
|
||||||
*args,**kwargs):
|
*args,**kwargs):
|
||||||
@@ -61,6 +73,7 @@ def send_template_email(from_email,to_email,subject,
|
|||||||
|
|
||||||
html_content = htmly.render(context)
|
html_content = htmly.render(context)
|
||||||
text_content = textify(html_content)
|
text_content = textify(html_content)
|
||||||
|
# html_content = newlinetobr(html_content)
|
||||||
|
|
||||||
if 'cc' in kwargs:
|
if 'cc' in kwargs:
|
||||||
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'])
|
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'])
|
||||||
|
|||||||
@@ -692,7 +692,10 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower'):
|
|||||||
|
|
||||||
|
|
||||||
df = df[df['power2k']>0]
|
df = df[df['power2k']>0]
|
||||||
df = df[df['mode']==workoutmode]
|
try:
|
||||||
|
df = df[df['mode']==workoutmode]
|
||||||
|
except TypeError:
|
||||||
|
df = pd.DataFrame()
|
||||||
|
|
||||||
groups = df.groupby(by='date').max()
|
groups = df.groupby(by='date').max()
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ from rowers.models import (
|
|||||||
|
|
||||||
from rowers.courses import get_time_course
|
from rowers.courses import get_time_course
|
||||||
|
|
||||||
|
from rowers.emails import htmlstrip,htmlstripnobr
|
||||||
|
|
||||||
import rowers.mytypes as mytypes
|
import rowers.mytypes as mytypes
|
||||||
|
|
||||||
import metrics
|
import metrics
|
||||||
@@ -616,6 +618,7 @@ def update_plannedsession(ps,cd):
|
|||||||
def update_indoorvirtualrace(ps,cd):
|
def update_indoorvirtualrace(ps,cd):
|
||||||
for attr, value in cd.items():
|
for attr, value in cd.items():
|
||||||
if attr == 'comment':
|
if attr == 'comment':
|
||||||
|
value = htmlstripnobr(value)
|
||||||
value.replace("\r\n", "
");
|
value.replace("\r\n", "
");
|
||||||
value.replace("\n", "
");
|
value.replace("\n", "
");
|
||||||
setattr(ps, attr, value)
|
setattr(ps, attr, value)
|
||||||
@@ -666,6 +669,7 @@ def update_indoorvirtualrace(ps,cd):
|
|||||||
def update_virtualrace(ps,cd):
|
def update_virtualrace(ps,cd):
|
||||||
for attr, value in cd.items():
|
for attr, value in cd.items():
|
||||||
if attr == 'comment':
|
if attr == 'comment':
|
||||||
|
value = htmlstripnobr(value)
|
||||||
value.replace("\r\n", "
");
|
value.replace("\r\n", "
");
|
||||||
value.replace("\n", "
");
|
value.replace("\n", "
");
|
||||||
setattr(ps, attr, value)
|
setattr(ps, attr, value)
|
||||||
|
|||||||
+2
-1
@@ -40,6 +40,7 @@ from django.utils import timezone
|
|||||||
from django.utils.html import strip_tags
|
from django.utils.html import strip_tags
|
||||||
|
|
||||||
from utils import deserialize_list,ewmovingaverage,wavg
|
from utils import deserialize_list,ewmovingaverage,wavg
|
||||||
|
from emails import htmlstrip
|
||||||
|
|
||||||
from HTMLParser import HTMLParser
|
from HTMLParser import HTMLParser
|
||||||
class MLStripper(HTMLParser):
|
class MLStripper(HTMLParser):
|
||||||
@@ -819,7 +820,7 @@ def handle_send_disqualification_email(
|
|||||||
'username':username,
|
'username':username,
|
||||||
'reason':reason,
|
'reason':reason,
|
||||||
'siteurl':siteurl,
|
'siteurl':siteurl,
|
||||||
'message': strip_tags(message),
|
'message': htmlstrip(message),
|
||||||
'racename':racename,
|
'racename':racename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,7 @@
|
|||||||
<p>Dear <strong>{{ username }}</strong>,</p>
|
<p>Dear <strong>{{ username }}</strong>,</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Unfortunately, the result that you have submitted
|
Unfortunately, the result that you have submitted for the virtual race {{ racename }} has been rejected by the race organizer.
|
||||||
for the virtual race
|
|
||||||
{{ racename }}
|
|
||||||
has been rejected by the race organizer.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -22,9 +19,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The decision to reject your result is the sole responsibility of
|
The decision to reject your result is the sole responsibility of the race organizer. If you disagree with the decision, please do contact him or her.
|
||||||
the race organizer. If you disagree with the decision, please do contact
|
|
||||||
him or her.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input class="button green" type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Vendored
+1
File diff suppressed because one or more lines are too long
+1
-1
@@ -186,7 +186,7 @@ import pandas as pd
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
from rowers.emails import send_template_email
|
from rowers.emails import send_template_email,htmlstrip
|
||||||
|
|
||||||
from pytz import timezone as tz,utc
|
from pytz import timezone as tz,utc
|
||||||
from timezonefinder import TimezoneFinder
|
from timezonefinder import TimezoneFinder
|
||||||
|
|||||||
Reference in New Issue
Block a user