| 1510 | api = 2 |
| 1511 | |
| 1512 | def apply(self, callback, route): |
| 1513 | conf = route.config.get('template') |
| 1514 | if isinstance(conf, (tuple, list)) and len(conf) == 2: |
| 1515 | return view(conf[0], **conf[1])(callback) |
| 1516 | elif isinstance(conf, str) and 'template_opts' in route.config: |
| 1517 | depr('The `template_opts` parameter is deprecated.') #0.9 |
| 1518 | return view(conf, **route.config['template_opts'])(callback) |
| 1519 | elif isinstance(conf, str): |
| 1520 | return view(conf)(callback) |
| 1521 | else: |
| 1522 | return callback |
| 1523 | |
| 1524 | |
| 1525 | #: Not a plugin, but part of the plugin API. TODO: Find a better place. |