Commit cecaaacc authored by laurent doreille's avatar laurent doreille

issue #30 + adaptation for python 3.8

parent 438b38f1
......@@ -3,4 +3,4 @@ import flask
blueprint = flask.Blueprint("account", __name__, template_folder="templates")
from hiboo.account import login, home, settings
\ No newline at end of file
from hiboo.account import login, home, settings, controllers
\ No newline at end of file
from hiboo.account import blueprint
from hiboo import models, security
from flask_babel import lazy_gettext as _
import flask
import flask_login
@blueprint.route("profiles/delete/<uuid>", methods=["GET", "POST"])
def profile_delete(uuid):
profile = models.Profile.query.filter_by(uuid=uuid).first()
flask.flash(_("Profile is correctly deleted."), "success")
return flask.render_template("account_profiles.html")
......@@ -15,6 +15,7 @@
<th>{% trans %}Status{% endtrans %}</th>
<th>{% trans %}Created on{% endtrans %}</th>
<th>{% trans %}Comment{% endtrans %}</th>
<th>{% trans %}Delete{% endtrans %}</th>
{% for profile in current_user.profiles %}
{% set status=profile.STATUSES[profile.status] %}
......@@ -24,6 +25,7 @@
<td><span class="badge bg-{{ status[0] }}">{{ status[1] }}</span></td>
<td>{{ }}</td>
<td>{{ profile.comment }}</td>
<td><a href="{{ url_for('account.profile_delete',uuid=profile.uuid) }}">{% trans %}Delete{% endtrans %}</a></td>
{% endfor %}
......@@ -62,10 +62,13 @@ class ImageCaptchaField(fields.CaptchaField):
png = io.BytesIO()
self.make_image(self.context["challenge"]).save(png, "PNG")
output = base64.b64encode(png.getvalue()).decode("ascii")
return widgets.HTMLString(
captchaImg = widgets.HTMLString(
'<p><img src="data:image/png;base64,{}"></p>'.format(output)
+ super(ImageCaptchaField, self).__call__(**kwargs)
inputFields = widgets.HTMLString(super(ImageCaptchaField, self).__call__(**kwargs))
return captchaImg + inputFields
def make_char(self, char, rotation_range=15):
""" Renders a character
  • le module python ne propose plus sa version contrib werkzeug.contrib utilisé par flask d'où le "downgrade" Pillow remplace PIL et nécessite une adaptation pour le captcha

    issue #30 corrigée

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