forked from pool/python-SQLAlchemy-Utils
SQLAlchemy>=2.0.22, gh#kvesteri/sqlalchemy-utils#725 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-SQLAlchemy-Utils?expand=0&rev=77
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
From 712aabaefc5c8ca3680751c705cf5a5984c74af1 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
|
|
Date: Thu, 18 Jan 2024 11:02:54 +0100
|
|
Subject: [PATCH] Update GenericAttributeImpl to work with SqlAlchemy 2.0.22
|
|
|
|
Fix https://github.com/kvesteri/sqlalchemy-utils/issues/719
|
|
---
|
|
sqlalchemy_utils/generic.py | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
Index: SQLAlchemy-Utils-0.41.1/sqlalchemy_utils/generic.py
|
|
===================================================================
|
|
--- SQLAlchemy-Utils-0.41.1.orig/sqlalchemy_utils/generic.py
|
|
+++ SQLAlchemy-Utils-0.41.1/sqlalchemy_utils/generic.py
|
|
@@ -13,6 +13,13 @@ from .functions.orm import _get_class_re
|
|
|
|
|
|
class GenericAttributeImpl(attributes.ScalarAttributeImpl):
|
|
+ def __init__(self, *args, **kwargs):
|
|
+ # arguments received (class, key, dispatch)
|
|
+ # The attributes.AttributeImpl requires (class, key, default_function, dispatch)
|
|
+ # Setting None as default_function here
|
|
+ args = args[:2] + (None, ) + args[2:]
|
|
+ super().__init__(*args, **kwargs)
|
|
+
|
|
def get(self, state, dict_, passive=attributes.PASSIVE_OFF):
|
|
if self.key in dict_:
|
|
return dict_[self.key]
|