Skip to content

Commit

Permalink
pre-commit update
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Mar 14, 2023
1 parent 4742ea3 commit 94af174
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 67 deletions.
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
rev: v2.0.2
hooks:
- id: autoflake
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.2
rev: v2.1.3
hooks:
- id: pycln
args: [--config=pyproject.toml]
Expand All @@ -26,11 +26,10 @@ repos:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/rtts/djhtml
rev: v1.5.2
rev: 3.0.5
hooks:
- id: djhtml
args: ["--in-place"]
1 change: 0 additions & 1 deletion canaille/oidc/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def get_issuer():


def get_jwt_config(grant):

with open(current_app.config["JWT"]["PRIVATE_KEY"]) as pk:
return {
"key": pk.read(),
Expand Down
6 changes: 3 additions & 3 deletions canaille/templates/firstlogin.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ <h3 class="ui top attached header">
</div>
<div class="ui attached clearing segment">
<form method="POST"
id="{{ reset }}"
action="{{ url_for('account.firstlogin', uid=uid) }}"
role="form"
id="{{ reset }}"
action="{{ url_for('account.firstlogin', uid=uid) }}"
role="form"
>

{{ form.hidden_tag() if form.hidden_tag }}
Expand Down
8 changes: 4 additions & 4 deletions canaille/templates/forgotten-password.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ <h3 class="ui top attached header">
</div>
<div class="ui attached clearing segment">
<form method="POST"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
>

{{ form.hidden_tag() if form.hidden_tag }}
Expand Down
8 changes: 4 additions & 4 deletions canaille/templates/group.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ <h2 class="ui center aligned header">
</h2>

<form method="POST"
id="{{ form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
id="{{ form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
>
{{ form.hidden_tag() if form.hidden_tag }}
{{ sui.render_field(form.display_name) }}
Expand Down
8 changes: 4 additions & 4 deletions canaille/templates/invite.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ <h2 class="ui center aligned header">

<div class="ui attached segment">
<form method="POST"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
>
{{ form.hidden_tag() if form.hidden_tag }}
{% block uid_field scoped %}
Expand Down
8 changes: 4 additions & 4 deletions canaille/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ <h2 class="ui center aligned header">
{{ flask.messages() }}

<form method="POST"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
>

{{ form.hidden_tag() if form.hidden_tag }}
Expand Down
28 changes: 14 additions & 14 deletions canaille/templates/macro/fomanticui.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
{% set field_visible = field.type != 'HiddenField' and field.type !='CSRFTokenField' %}
{% if container and field_visible %}
<div class="field {{ kwargs.pop('class_', '') }}
{%- if field.errors %} error{% endif -%}
{%- if field.render_kw and "disabled" in field.render_kw %} disabled{% endif -%}"
{% if not display %}style="display: none"{% endif %}
{%- if field.errors %} error{% endif -%}
{%- if field.render_kw and "disabled" in field.render_kw %} disabled{% endif -%}"
{% if not display %}style="display: none"{% endif %}
>
{% endif %}

Expand All @@ -32,12 +32,12 @@
{% set labeled = suffix_text or corner_indicator %}
{% if field_visible %}
<div class="ui
{% if suffix_text %}right{% endif %}
{% if corner_indicator %}corner{% endif %}
{% if labeled %}labeled{% endif %}
{% if icon %}left icon {% endif %}
{% if field.type not in ("BooleanField", "RadioField") %}input{% endif %}
">
{% if suffix_text %}right{% endif %}
{% if corner_indicator %}corner{% endif %}
{% if labeled %}labeled{% endif %}
{% if icon %}left icon {% endif %}
{% if field.type not in ("BooleanField", "RadioField") %}input{% endif %}
">
{% endif %}
{% if icon %}<i class="{{ icon }} icon"></i>{% endif %}

Expand Down Expand Up @@ -124,11 +124,11 @@
action=none,
id=none) -%}
<form method="POST"
id="{{ id or form.__class__.__name__|lower }}"
action="{{ action or form.action }}"
role="form"
enctype="multipart/form-data"
class="ui form {{ class_ }}"
id="{{ id or form.__class__.__name__|lower }}"
action="{{ action or form.action }}"
role="form"
enctype="multipart/form-data"
class="ui form {{ class_ }}"
>
{% if caller %}
{{ caller() }}
Expand Down
10 changes: 5 additions & 5 deletions canaille/templates/oidc/admin/client_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ <h3 class="ui top attached header">
</div>

<form method="POST"
id="{{ form.__class__.__name__|lower }}"
action="{{ form.action }}"
role="form"
enctype="multipart/form-data"
class="ui form"
id="{{ form.__class__.__name__|lower }}"
action="{{ form.action }}"
role="form"
enctype="multipart/form-data"
class="ui form"
>

{{ sui.render_fields(form) }}
Expand Down
8 changes: 4 additions & 4 deletions canaille/templates/oidc/user/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ <h2 class="ui center aligned icon header">

<div class="ui center aligned container">
<form method="POST"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ form.action }}"
role="form"
class="ui form"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ form.action }}"
role="form"
class="ui form"
>
{{ form.hidden_tag() if form.hidden_tag }}
<div class="ui stackable buttons">
Expand Down
8 changes: 4 additions & 4 deletions canaille/templates/password.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ <h2 class="ui center aligned header">
{{ flask.messages() }}

<form method="POST"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
id="{{ form.id or form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
class="ui form"
>

{{ form.hidden_tag() if form.hidden_tag }}
Expand Down
10 changes: 5 additions & 5 deletions canaille/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ <h2 class="ui center aligned header">
</h2>

<form method="POST"
id="{{ form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
enctype="multipart/form-data"
class="ui form info{% if user.can_manage_users and edited_user and not edited_user.has_password() %} warning{% endif %} profile-form"
id="{{ form.__class__.__name__|lower }}"
action="{{ request.url }}"
role="form"
enctype="multipart/form-data"
class="ui form info{% if user.can_manage_users and edited_user and not edited_user.has_password() %} warning{% endif %} profile-form"
>

{#{ render_field(form.csrf_token) }#}
Expand Down
8 changes: 4 additions & 4 deletions canaille/themes/default/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@
{% endif %}
{% if user.can_edit_self %}
<a class="item {% if menuitem == "profile" %}active{% endif %}"
href="{{ url_for('account.profile_edition', username=user.uid[0]) }}">
href="{{ url_for('account.profile_edition', username=user.uid[0]) }}">
<i class="id card icon"></i>
{% trans %}My profile{% endtrans %}
</a>
{% endif %}
{% if user.can_use_oidc %}
<a class="item {% if menuitem == "consents" %}active{% endif %}"
href="{{ url_for('oidc.consents.consents') }}">
href="{{ url_for('oidc.consents.consents') }}">
<i class="handshake icon"></i>
{% trans %}My consents{% endtrans %}
</a>
{% endif %}
{% if user.can_manage_users %}
<a class="item {% if menuitem == "users" %}active{% endif %}"
href="{{ url_for('account.users') }}">
href="{{ url_for('account.users') }}">
<i class="address book icon"></i>
{% trans %}Users{% endtrans %}
</a>
{% endif %}
{% if user.can_manage_groups %}
<a class="item {% if menuitem == "groups" %}active{% endif %}"
href="{{ url_for('groups.groups') }}">
href="{{ url_for('groups.groups') }}">
<i class="users icon"></i>
{% trans %}Groups{% endtrans %}
</a>
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/themes/test/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@
</div>
{% endif %}
<a class="item {% if menuitem == "profile" %}active{% endif %}"
href="{{ url_for('account.profile_edition', username=user.uid[0]) }}">
href="{{ url_for('account.profile_edition', username=user.uid[0]) }}">
<i class="id card icon"></i>
{% trans %}My profile{% endtrans %}
</a>
<a class="item {% if menuitem == "consents" %}active{% endif %}"
href="{{ url_for('consents.consents') }}">
href="{{ url_for('consents.consents') }}">
<i class="handshake icon"></i>
{% trans %}My consents{% endtrans %}
</a>
{% if user.can_manage_users %}
<a class="item {% if menuitem == "users" %}active{% endif %}"
href="{{ url_for('account.users') }}">
href="{{ url_for('account.users') }}">
<i class="users icon"></i>
{% trans %}Users{% endtrans %}
</a>
{% endif %}
{% if user.can_manage_groups %}
<a class="item {% if menuitem == "groups" %}active{% endif %}"
href="{{ url_for('groups.groups') }}">
href="{{ url_for('groups.groups') }}">
<i class="users cog icon"></i>
{% trans %}Groups{% endtrans %}
</a>
Expand Down
2 changes: 0 additions & 2 deletions tests/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def test_edition_permission(
bar_group,
jpeg_photo,
):

testclient.app.config["ACL"]["DEFAULT"]["PERMISSIONS"] = []
testclient.get("/profile/user", status=403)

Expand Down Expand Up @@ -592,7 +591,6 @@ def test_photo_on_profile_edition(
logged_user,
jpeg_photo,
):

# Add a photo
res = testclient.get("/profile/user", status=200)
res.form["jpegPhoto"] = Upload("logo.jpg", jpeg_photo)
Expand Down

0 comments on commit 94af174

Please sign in to comment.