-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently if you misconfigure a strategy, perhaps by omitting a name or by forgetting to call super().__init__() passing everything through in its initialiser, devdata doesn't give much useful feedback.
The error you do get is:
File ".../devdata/engine.py", line 72, in export_data
model_strategies = sort_model_strategies(settings.strategies)
File ".../devdata/utils.py", line 72, in sort_model_strategies
for dep in strategy.depends_on:
AttributeError: 'tuple' object has no attribute 'depends_on'
Which is unfortunately considerably later in devdata's processing.
I think the fix is likely to change the handling in settings.py, so that the strategy construction logic is more explicitly able to tell the difference between the available valid options and those which are erroneous:
django-devdata/src/devdata/settings.py
Lines 39 to 44 in da8933c
| try: | |
| klass_path, kwargs = strategy | |
| klass = import_string(klass_path) | |
| ret[app_model_label].append(klass(**kwargs)) | |
| except (ValueError, TypeError, IndexError): | |
| ret[app_model_label].append(strategy) |
Metadata
Metadata
Assignees
Labels
No labels