File: test_method_hook.py

package info (click to toggle)
python-extclass 1.2.0zope-2.5.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 540 kB
  • ctags: 719
  • sloc: ansic: 5,769; python: 302; makefile: 46
file content (15 lines) | stat: -rw-r--r-- 324 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import ExtensionClass

class C(ExtensionClass.Base):

    def __call_method__(self, meth, args, kw={}):
        print 'give us a hook, hook, hook...'
        return apply(meth, args, kw)

    def hi(self, *args, **kw):
        print "%s()" % self.__class__.__name__, args, kw

c=C()
c.hi()
c.hi(1,2,3)
c.hi(1,2,spam='eggs')