From 2de08ad50d2f10efc081bdbf6a7dab89067d1e80 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 6 Jan 2025 16:48:42 -0600 Subject: [PATCH] fix: allow session injection for ObjectRef constructor for sake of simpler tests --- src/wuttaweb/forms/schema.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wuttaweb/forms/schema.py b/src/wuttaweb/forms/schema.py index 0dabf64..3d0e08b 100644 --- a/src/wuttaweb/forms/schema.py +++ b/src/wuttaweb/forms/schema.py @@ -250,12 +250,13 @@ class ObjectRef(colander.SchemaType): *args, **kwargs, ): + # nb. allow session injection for tests + self.session = kwargs.pop('session', Session()) super().__init__(*args, **kwargs) self.request = request self.config = self.request.wutta_config self.app = self.config.get_app() self.model_instance = None - self.session = Session() if empty_option: if empty_option is True: