Allow CSRElement objects to be autocompleted.
This commit is contained in:
parent
722edfe9e8
commit
1f6dc446d2
|
@ -3,11 +3,15 @@ import csv
|
|||
|
||||
class CSRElements:
|
||||
def __init__(self, d):
|
||||
self.d = d
|
||||
self.__dict__.update(d)
|
||||
|
||||
@property
|
||||
def d(self):
|
||||
return self.__dict__
|
||||
|
||||
def __getattr__(self, attr):
|
||||
try:
|
||||
return self.__dict__['d'][attr]
|
||||
return self.__dict__[attr]
|
||||
except KeyError:
|
||||
pass
|
||||
raise KeyError("No such element " + attr)
|
||||
|
|
Loading…
Reference in New Issue