details: https://code.tryton.org/tryton/commit/941620f8326b
branch: default
user: Cédric Krier <[email protected]>
date: Sat Jan 03 14:06:42 2026 +0100
description:
Defer importing saml2 module only when routes are called
diffstat:
modules/authentication_saml/routes.py | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (43 lines):
diff -r 58b585fad07d -r 941620f8326b modules/authentication_saml/routes.py
--- a/modules/authentication_saml/routes.py Sat Jan 03 14:05:34 2026 +0100
+++ b/modules/authentication_saml/routes.py Sat Jan 03 14:06:42 2026 +0100
@@ -9,10 +9,6 @@
except ImportError:
from http import client as HTTPStatus
-import saml2
-import saml2.client
-import saml2.config
-
import trytond.config as config
from trytond.protocols.dispatcher import register_authentication_service
from trytond.protocols.wrappers import (
@@ -74,6 +70,10 @@
def get_client(database, identity):
+ import saml2
+ import saml2.client
+ import saml2.config
+
settings = {
'entityid': get_url(database, identity, 'metadata'),
'service': {
@@ -125,6 +125,8 @@
@log
@check_identity
def metadata(request, database, identity):
+ import saml2.metadata
+
client = get_client(database, identity)
metadata = saml2.metadata.create_metadata_string(None, client.config)
return Response(metadata, headers={'Content-Type': 'text/xml'})
@@ -138,6 +140,8 @@
@log
@check_identity
def acs(request, pool, identity):
+ import saml2.entity
+
Session = pool.get('ir.session')
User = pool.get('res.user')
client = get_client(pool.database_name, identity)