Add some checks for Collection.__getattr__

XMLWordPrintableJSON

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

      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 Hackett
              Reporter:
              Zah [X]
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: