mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-08 23:50:38 +03:00
Update registry.py
This commit is contained in:
parent
ba4d1d6abf
commit
8f8b38d757
|
@ -7,6 +7,7 @@ class Registry(object):
|
||||||
from .types import SQLAlchemyObjectType
|
from .types import SQLAlchemyObjectType
|
||||||
assert issubclass(cls, SQLAlchemyObjectType), 'Only SQLAlchemyObjectType can be registered, received "{}"'.format(cls.__name__)
|
assert issubclass(cls, SQLAlchemyObjectType), 'Only SQLAlchemyObjectType can be registered, received "{}"'.format(cls.__name__)
|
||||||
assert cls._meta.registry == self, 'Registry for a Model have to match.'
|
assert cls._meta.registry == self, 'Registry for a Model have to match.'
|
||||||
|
assert cls._meta.model not in self._registry, 'SQLAlchemy model "{}" already associated with another type "{}".'.format(cls._meta.model, self._registry[cls._meta.model])
|
||||||
self._registry[cls._meta.model] = cls
|
self._registry[cls._meta.model] = cls
|
||||||
|
|
||||||
def get_type_for_model(self, model):
|
def get_type_for_model(self, model):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user