summaryrefslogtreecommitdiff
path: root/tablib/core.py
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2010-09-25 15:23:01 -0400
committerKenneth Reitz <me@kennethreitz.com>2010-09-25 15:23:01 -0400
commit4117503ed5f2229c54df68bc9ab339f7ea7cb36d (patch)
tree056e8c12b9626aeb48b897f3255ba52f8d0e35bd /tablib/core.py
parentdfa26a7d53097c32283f2876be2e0b1ecf1b312f (diff)
downloadtablib-4117503ed5f2229c54df68bc9ab339f7ea7cb36d.tar.gz
Elegant imports in place!
Diffstat (limited to 'tablib/core.py')
-rw-r--r--tablib/core.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tablib/core.py b/tablib/core.py
index e368bab..9500d20 100644
--- a/tablib/core.py
+++ b/tablib/core.py
@@ -76,8 +76,12 @@ class Dataset(object):
"""Adds format properties."""
for fmt in formats:
try:
- setattr(cls, fmt.title, property(fmt.export_set))
- except Exception:
+ try:
+ setattr(cls, fmt.title, property(fmt.export_set, fmt.import_set))
+ except AttributeError:
+ setattr(cls, fmt.title, property(fmt.export_set))
+
+ except AttributeError:
pass
@@ -234,8 +238,12 @@ class Databook(object):
"""Adds format properties."""
for fmt in formats:
try:
- setattr(cls, fmt.title, property(fmt.export_book))
- except Exception:
+ try:
+ setattr(cls, fmt.title, property(fmt.export_book, fmt.import_book))
+ except AttributeError:
+ setattr(cls, fmt.title, property(fmt.export_book))
+
+ except AttributeError:
pass