Skip to content

Commit

Permalink
Add a config item getter
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Sep 14, 2012
1 parent bc9929b commit 39427d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pygal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,16 @@ def to_dict(self):
value = getattr(self, attr)
if hasattr(value, 'to_dict'):
config[attr] = value.to_dict()
elif not hasattr(value, '__call__'):
elif attr != '_items' and not hasattr(value, '__call__'):
config[attr] = value
return config

def copy(self):
return deepcopy(self)

@property
def _items(self):
return filter(
lambda x:
not x[0].startswith('_') and not hasattr(x[1], '__call__'),
[(k, getattr(self, k)) for k in dir(self) if k != '_items'])

0 comments on commit 39427d4

Please sign in to comment.