Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pretix Matrix Inviter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
Pretix Matrix Inviter
Commits
13503e62
Commit
13503e62
authored
1 year ago
by
Felix Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
Gracefully handle non-hostname matrix servers
#16
parent
4e76cc37
No related branches found
No related tags found
No related merge requests found
Pipeline
#171274
passed
1 year ago
Stage: linting
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pretix_matrix_inviter/forms.py
+11
-0
11 additions, 0 deletions
pretix_matrix_inviter/forms.py
with
11 additions
and
0 deletions
pretix_matrix_inviter/forms.py
+
11
−
0
View file @
13503e62
from
django.core.exceptions
import
ValidationError
from
django.forms
import
(
CharField
,
CheckboxSelectMultiple
,
...
...
@@ -7,6 +8,8 @@ from django.forms import (
from
django.utils.translation
import
gettext_lazy
from
i18nfield.forms
import
I18nFormField
,
I18nTextInput
from
pretix.base.forms
import
SettingsForm
from
urllib3.exceptions
import
LocationParseError
from
urllib3.util
import
parse_url
from
.helpers
import
matrix_room_info_for_event
...
...
@@ -58,6 +61,14 @@ class MatrixInviterSettingsForm(SettingsForm):
strip
=
True
,
)
def
clean_matrix_inviter_matrix_server
(
self
):
url
=
self
.
cleaned_data
[
"
matrix_inviter_matrix_server
"
]
try
:
return
parse_url
(
url
).
host
except
LocationParseError
:
raise
ValidationError
(
"
Please enter a valid hostname
"
)
return
url
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
"
matrix_inviter_items
"
].
choices
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment