database helper to list installed SONManipulators

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      any
    • None
    • Minor Change
    • None
    • None
    • None
    • None
    • None
    • None

      Consider the following code example:

      >>> class MyManipulator(SONManipulator):
      ... def transform_incoming(self, son, collection):
      ... print "Transforming!"
      ... return son
      >>> m = MyManipulator()
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> col = db.foobar
      >>> col
      Collection(Database(Connection('localhost', 27017), u'playhaven'), u'foobar')
      >>> db.foobar.insert(

      {'a' : 1}

      )
      Transforming!
      Transforming!
      Transforming!
      Transforming!
      Transforming!
      ObjectId('4c58593d860f970350000001')

      It's easy to see how this could cause performance problems if extra care is not taken. What would be nice is if the method would only add the same SONManipulator once. Or at a very minimum, there should be a way to check and see if the SONManipulator has already been added.

              Assignee:
              Bernie Hackett
              Reporter:
              Jason Baker
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: