| Conditions | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| 1 | from plugin.api.core.exceptions import ApiError |
||
| 40 | @decorator.wraps |
||
| 41 | def expose(authenticated=True): |
||
| 42 | def outer(func): |
||
| 43 | def inner(self, *args, **kwargs): |
||
| 44 | if authenticated and self.context.token is None: |
||
| 45 | raise AuthenticationRequiredError |
||
| 46 | |||
| 47 | return func(self, *args, **kwargs) |
||
| 48 | |||
| 49 | # Attach meta to wrapper |
||
| 50 | inner.__meta__ = { |
||
| 51 | 'authenticated': authenticated, |
||
| 52 | 'exposed': True |
||
| 53 | } |
||
| 54 | |||
| 55 | return inner |
||
| 56 | |||
| 57 | return outer |
||
| 58 |