mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 15:00:19 +00:00
Fix export only formats
Formats like LaTeX could have never been exported because `setattr(cls, set_%s % fmt.title, fmt.import_set)` always failed for export-only formats and with that the exception was caught in the outer try/except and the format tuple was set to (None, None) with `cls._formats[fmt.title] = (None, None)`
This commit is contained in:
+3
-2
@@ -252,12 +252,13 @@ class Dataset(object):
|
||||
try:
|
||||
try:
|
||||
setattr(cls, fmt.title, property(fmt.export_set, fmt.import_set))
|
||||
setattr(cls, 'get_%s' % fmt.title, fmt.export_set)
|
||||
setattr(cls, 'set_%s' % fmt.title, fmt.import_set)
|
||||
cls._formats[fmt.title] = (fmt.export_set, fmt.import_set)
|
||||
except AttributeError:
|
||||
setattr(cls, fmt.title, property(fmt.export_set))
|
||||
setattr(cls, 'get_%s' % fmt.title, fmt.export_set)
|
||||
cls._formats[fmt.title] = (fmt.export_set, None)
|
||||
setattr(cls, 'get_%s' % fmt.title, fmt.export_set)
|
||||
setattr(cls, 'set_%s' % fmt.title, fmt.import_set)
|
||||
|
||||
except AttributeError:
|
||||
cls._formats[fmt.title] = (None, None)
|
||||
|
||||
Reference in New Issue
Block a user