Skip to content

Commit

Permalink
Clean up monkeypatch code
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Dec 2, 2023
1 parent 2a19a42 commit 4580d6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/pretix/helpers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ class PretixHelpersConfig(AppConfig):
label = 'pretixhelpers'

def ready(self):
from .monkeypatching import (
monkeypatch_all_at_ready, monkeypatch_requests_timeout,
)
from .monkeypatching import monkeypatch_all_at_ready
monkeypatch_all_at_ready()
monkeypatch_requests_timeout()
11 changes: 6 additions & 5 deletions src/pretix/helpers/monkeypatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ def monkeypatch_pillow_safer():
Image.ID.remove("EPS")


def monkeypatch_all_at_ready():
monkeypatch_vobject_performance()
monkeypatch_pillow_safer()


def monkeypatch_requests_timeout():
"""
The requests package does not by default set a timeout for outgoing HTTP requests. This is dangerous especially since
Expand All @@ -88,3 +83,9 @@ def httpadapter_send(self, request, timeout=None, **kwargs):
return types.MethodType(old_httpadapter_send, self)(request, timeout=timeout, **kwargs)

HTTPAdapter.send = httpadapter_send


def monkeypatch_all_at_ready():
monkeypatch_vobject_performance()
monkeypatch_pillow_safer()
monkeypatch_requests_timeout()

0 comments on commit 4580d6f

Please sign in to comment.