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

Error behavior in SONManipulator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8, 3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      all
    • Sprint:
      Python Sprint 8

      Description

      There is bug with SONManipulator optimization here: https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/database.py#L95

      Due to this bug:

      • we cannot create manipulator that isn't inherited from SONManipulator class. That's not so good.
      • we cannot create two (or more) level manipulators inheritance hierarhy. For example this wouldn't work correct:

        from pymongo.son_manipulator import SONManipulator
         
         
        class ParentManipulator(SONManipulator):
            def transform_incoming(self, son, collection):
                son['collection_name'] = collection.name
                return son
         
            def transform_outgoing(self, son, collection):
                if 'collection_name' in son:
                    del son['collection_name']
                return son
         
         
        class ChildManipulator(ParentManipulator):
            """ 
            It should work like ParentManipulator, but it wouldn't work at call :(
            """
            pass
         

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: