Skip to content

Commit

Permalink
Try to make SQLAlchemy 1.4.0b1 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
epandurski committed Nov 3, 2020
1 parent 77aa44c commit 3e7fb8e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flask_signalbus/signalbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
_FLUSH_SIGNALS_LIMIT = 50000


def _get_class_registry(base):
return base.registry._class_registry if hasattr(base, 'registry') else base._decl_class_registry


def _chunks(l, size):
"""Yield successive `size`-sized chunks from the list `l`."""

Expand Down Expand Up @@ -136,7 +140,7 @@ def get_signal_models(self):

base = self.db.Model
return [
cls for cls in base._decl_class_registry.values() if (
cls for cls in _get_class_registry(base).values() if (
isinstance(cls, type)
and issubclass(cls, base)
and hasattr(cls, 'send_signalbus_message')
Expand Down Expand Up @@ -373,7 +377,7 @@ class Meta(object):
return type(schema_class_name, (SQLAlchemyAutoSchema,), {'Meta': Meta})

def setup_schema_fn():
for model in Base._decl_class_registry.values():
for model in _get_class_registry(Base).values():
if hasattr(model, '__tablename__'):
if model.__name__.endswith("Schema"):
raise ModelConversionError(
Expand Down

0 comments on commit 3e7fb8e

Please sign in to comment.