~vcs-imports/quotient/main

« back to all changes in this revision

Viewing changes to atop/fwd.py

  • Committer: glyph
  • Date: 2003-10-26 23:44:25 UTC
  • Revision ID: Arch-1:unnamed@bazaar.ubuntu.com%series--4208--patch-749
whitespace

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
class ItemForwardingComponent:
 
3
    def __init__(self, fwdTo):
 
4
        if hasattr(fwdTo, '__checkstate__'):
 
5
            raise RuntimeError("USE REFERENCETO YOU WORHTLESS IDIOT!!")
 
6
        self.fwdTo = fwdTo
 
7
 
 
8
    def __getattr__(self, attr):
 
9
        if attr[0] == '_':
 
10
            raise AttributeError
 
11
        else:
 
12
            def _(*a, **kw):
 
13
                return getattr(self.fwdTo.getItem(), attr)(*a, **kw)
 
14
            return _
 
15
 
 
16
    def __eq__(self, other):
 
17
        if not isinstance(other, ItemForwardingComponent):
 
18
            return False
 
19
        return self.fwdTo == other.fwdTo
 
20