From f17dafeaac91fbf0e776027f5861074e47269050 Mon Sep 17 00:00:00 2001 From: shu zOMG chen Date: Sun, 15 Jul 2012 22:31:18 -1000 Subject: [PATCH] Added attrdict --- hicap/hicap/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hicap/hicap/utils.py b/hicap/hicap/utils.py index 904f722..5bff648 100644 --- a/hicap/hicap/utils.py +++ b/hicap/hicap/utils.py @@ -3,3 +3,10 @@ def to_unixtime(d): return int(time.mktime(d.timetuple())) + +class AttrDict(dict): + def __getattr__(self, key): + return self[key] + + def __setattr__(self, key, value): + self[key] = value