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

Add some checks for Collection.__getattr__

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • Minor Change

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: