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