|
1 |
| -import logging |
| 1 | +import warnings |
2 | 2 | from functools import partial
|
3 | 3 |
|
4 | 4 | from promise import Promise, is_thenable
|
|
10 | 10 |
|
11 | 11 | from .utils import get_query
|
12 | 12 |
|
13 |
| -log = logging.getLogger() |
14 |
| - |
15 | 13 |
|
16 | 14 | class UnsortedSQLAlchemyConnectionField(ConnectionField):
|
17 | 15 | @property
|
@@ -100,34 +98,37 @@ def __init__(self, type, *args, **kwargs):
|
100 | 98 | def default_connection_field_factory(relationship, registry, **field_kwargs):
|
101 | 99 | model = relationship.mapper.entity
|
102 | 100 | model_type = registry.get_type_for_model(model)
|
103 |
| - return createConnectionField(model_type, **field_kwargs) |
| 101 | + return __connectionFactory(model_type, **field_kwargs) |
104 | 102 |
|
105 | 103 |
|
106 | 104 | # TODO Remove in next major version
|
107 | 105 | __connectionFactory = UnsortedSQLAlchemyConnectionField
|
108 | 106 |
|
109 | 107 |
|
110 | 108 | def createConnectionField(_type, **field_kwargs):
|
111 |
| - log.warning( |
| 109 | + warnings.warn( |
112 | 110 | 'createConnectionField is deprecated and will be removed in the next '
|
113 |
| - 'major version. Use SQLAlchemyObjectType.Meta.connection_field_factory instead.' |
| 111 | + 'major version. Use SQLAlchemyObjectType.Meta.connection_field_factory instead.', |
| 112 | + DeprecationWarning, |
114 | 113 | )
|
115 | 114 | return __connectionFactory(_type, **field_kwargs)
|
116 | 115 |
|
117 | 116 |
|
118 | 117 | def registerConnectionFieldFactory(factoryMethod):
|
119 |
| - log.warning( |
| 118 | + warnings.warn( |
120 | 119 | 'registerConnectionFieldFactory is deprecated and will be removed in the next '
|
121 |
| - 'major version. Use SQLAlchemyObjectType.Meta.connection_field_factory instead.' |
| 120 | + 'major version. Use SQLAlchemyObjectType.Meta.connection_field_factory instead.', |
| 121 | + DeprecationWarning, |
122 | 122 | )
|
123 | 123 | global __connectionFactory
|
124 | 124 | __connectionFactory = factoryMethod
|
125 | 125 |
|
126 | 126 |
|
127 | 127 | def unregisterConnectionFieldFactory():
|
128 |
| - log.warning( |
| 128 | + warnings.warn( |
129 | 129 | 'registerConnectionFieldFactory is deprecated and will be removed in the next '
|
130 |
| - 'major version. Use SQLAlchemyObjectType.Meta.connection_field_factory instead.' |
| 130 | + 'major version. Use SQLAlchemyObjectType.Meta.connection_field_factory instead.', |
| 131 | + DeprecationWarning, |
131 | 132 | )
|
132 | 133 | global __connectionFactory
|
133 | 134 | __connectionFactory = UnsortedSQLAlchemyConnectionField
|
0 commit comments