durusmail: quixote-users: Authentication/permissions
Authentication/permissions
2004-11-08
2004-11-09
2004-11-10
2004-11-10
Authentication/permissions
Michele Simionato
2004-11-11
On Wed, 10 Nov 2004 10:52:44 -0800, Mike Orr  wrote:

> I'd like to use super() but Request is a classic class. :(  I remember
> seeing a super() function somewhere that worked with either type of
> class, so I'm on the hunt for it.

Well, Request should be made new style. However, there is an hackish
solution that should work: convert the old style class to a new style one
by composing it with "object". Here is an example:

class Old:
  def __init__(self):
    print "Old.__init__"

class New(Old, object): # this is trick!
  pass

class Mixin(object):
  def __init__(self):
    print "Mixin.__init__"
    super(Mixin, self).__init__()


class C(Mixin, New):
    def __init__(self):
       print "C.__init__"
       super(C, self).__init__()

print C.__mro__
c=C()

$ python super.py
(, , , , )
C.__init__
Mixin.__init__
Old.__init__

   Michele Simionato

reply