(0.5beta1) SessionExtensions fail unless they implement every method

Issue #1101 resolved
Former user created an issue

I have a SessionExtension that only implements after_begin. When I try to call commit() on my session, I get:

TypeError: unbound method before_commit() must be called with MingleSessionExtension instance as first argument (got Session instance instead)

There's also a docs problem (probably the same issue)--the SessionExtension docs say that Session Extensions take a self argument as their first argument, but actually they're @staticmethods and they seem to take a session as their first argument.

Comments (1)

  1. Mike Bayer repo owner

    Sorry, you need to instantiate your SessionExtension. There is no @staticmethod in use.

    Session = sessionmaker(extension=MyExtension())
    sess = Session()
    
  2. Log in to comment