Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-208

connection class repr broken by recent commit

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.10
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      any

      String representation of a pymongo Connection instance is broken when only one host is specified and slave_okay is set to True. This was caused by commit c5e78293d5b3a758a9d2. The problem is that self._host and self._post aren't being set since we are skipping __try_node. This doesn't seem to affect connectivity since __connect will call __find_master directly if either of these attributes are set to None. The bug is mostly cosmetic.

      repro:

      Python 2.7.1 (r271:86832, Jan 19 2011, 14:07:10)
      [GCC 4.4.4] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import pymongo
      >>> conn = pymongo.Connection('localhost', slave_okay=True)
      >>> conn
      Connection(None, None)
      >>> conn.host
      >>> repr(conn.host)
      'None'
      >>> repr(conn.port)
      'None'
      >>> conn = pymongo.Connection()
      >>> conn
      Connection(['localhost:27017', u'behackett-dt:27019', u'behackett-dt:27017', u'behackett-dt:27018'])

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: