~ubuntu-branches/ubuntu/quantal/pytables/quantal

« back to all changes in this revision

Viewing changes to tables/attributeaccess.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2005-11-27 20:25:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127202534-l8jzyd8357krw40h
Tags: 1.1.1-1ubuntu1
* Sync with Debian:
  + Use python 2.4 as default

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import weakref
 
2
 
 
3
 
 
4
 
 
5
class AttributeAccess(object):
 
6
    def __init__(self, container, accessor='__getattr__'):
 
7
        mydict = self.__dict__
 
8
 
 
9
##        mydict['__container'] = weakref.ref(container)
 
10
        mydict['__container'] = container
 
11
        mydict['__accessor'] = accessor
 
12
 
 
13
 
 
14
    def __getattr__(self, name):
 
15
##        container = self.__dict__['__container']()
 
16
        container = self.__dict__['__container']
 
17
        accessor = self.__dict__['__accessor']
 
18
        return getattr(container, accessor)(name)
 
19
 
 
20
 
 
21
 
 
22
## Local Variables:
 
23
## mode: python
 
24
## py-indent-offset: 4
 
25
## tab-width: 4
 
26
## fill-column: 72
 
27
## End: