Browse Source

Add a config item getter

pull/8/head
Florian Mounier 12 years ago
parent
commit
39427d4dc2
  1. 9
      pygal/config.py

9
pygal/config.py

@ -158,9 +158,16 @@ class Config(object):
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'])

Loading…
Cancel
Save