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

Add some checks for Collection.__getattr__

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Minor Change

      Line: https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/collection.py#L132

      getattr returns always something, even for special methods, and this can create confusion when interfacing with other libraries or creating custom code. For example callable(collection) would return True (and calling triggers an error). Also see this problem:

      https://github.com/ipython/ipython/issues/5227

      Probably getattr should not retrurn for things like properties starting and ending with underscore.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            Zah Zah [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: