3
0
Fork 0

fix: allow session injection for ObjectRef constructor

for sake of simpler tests
This commit is contained in:
Lance Edgar 2025-01-06 16:48:42 -06:00
parent 7895ce4676
commit 2de08ad50d

View file

@ -250,12 +250,13 @@ class ObjectRef(colander.SchemaType):
*args, *args,
**kwargs, **kwargs,
): ):
# nb. allow session injection for tests
self.session = kwargs.pop('session', Session())
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.request = request self.request = request
self.config = self.request.wutta_config self.config = self.request.wutta_config
self.app = self.config.get_app() self.app = self.config.get_app()
self.model_instance = None self.model_instance = None
self.session = Session()
if empty_option: if empty_option:
if empty_option is True: if empty_option is True: