| Conditions | 5 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | # coding=utf-8 |
||
| 9 | def prepare_filename_decorator(fn): |
||
| 10 | """ |
||
| 11 | A decorator of `prepare_filename` method |
||
| 12 | |||
| 13 | 1. It automatically assign `settings.ROUGHPAGES_INDEX_FILENAME` if the |
||
| 14 | `normalized_url` is ''. |
||
| 15 | 2. It automatically assign file extensions to the output list. |
||
| 16 | """ |
||
| 17 | @wraps(fn) |
||
| 18 | def inner(self, normalized_url, request): |
||
| 19 | ext = settings.ROUGHPAGES_TEMPLATE_FILE_EXT |
||
| 20 | if not normalized_url: |
||
| 21 | normalized_url = settings.ROUGHPAGES_INDEX_FILENAME |
||
| 22 | filenames = fn(self, normalized_url, request) |
||
| 23 | filenames = [x + ext for x in filenames if x] |
||
| 24 | return filenames |
||
| 25 | return inner |
||
| 26 |