# HG changeset patch # User Pierre-Yves David # Date 1372323750 -7200 # Node ID b7f7aa1b11234dc9c1183771dda5bf2b85a741bd # Parent 5467fb9019315719f790ab8a34335eb4c6d7fe9f [client-connection] handle the lack of connection id while not open the connection id is computed at opening and forgotten when closing. We can't rely on it in various messages … like the "connection closed" exception. diff -r 5467fb901931 -r b7f7aa1b1123 repoapi.py --- a/repoapi.py Wed Jun 26 11:21:39 2013 +0200 +++ b/repoapi.py Thu Jun 27 11:02:30 2013 +0200 @@ -175,9 +175,15 @@ self.__exit__(None, None, None) def __repr__(self): - if self.anonymous_connection: + # XXX we probably want to reference the user of the session here + if self._open is None: + return '' + elif not self._open: + return '' + elif self.anonymous_connection: return '' % self._cnx.connectionid - return '' % self._cnx.connectionid + else: + return '' % self._cnx.connectionid # end silly BC @property @@ -188,7 +194,7 @@ TRANSITIONAL PURPOSE, This will be dropped once we use standalone session object""" if not self._open: - raise ProgrammingError('Closed connection %s' % self._cnxid) + raise ProgrammingError('Closed connection') yield self._cnx # Main Connection purpose in life #########################################