| 30 | self._con_release_ctr = connection._pool_release_ctr |
| 31 | |
| 32 | def _check_conn_validity(self, meth_name): |
| 33 | con_release_ctr = self._connection._pool_release_ctr |
| 34 | if con_release_ctr != self._con_release_ctr: |
| 35 | raise exceptions.InterfaceError( |
| 36 | 'cannot call {}.{}(): ' |
| 37 | 'the underlying connection has been released back ' |
| 38 | 'to the pool'.format(self.__class__.__name__, meth_name)) |
| 39 | |
| 40 | if self._connection.is_closed(): |
| 41 | raise exceptions.InterfaceError( |
| 42 | 'cannot call {}.{}(): ' |
| 43 | 'the underlying connection is closed'.format( |
| 44 | self.__class__.__name__, meth_name)) |