| Total Complexity | 4 |
| Total Lines | 10 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import random |
||
| 14 | class ContextFilter(Filter): |
||
| 15 | |||
| 16 | def filter(self, record): |
||
| 17 | if not hasattr(record, 'user_id'): |
||
| 18 | record.user_id = getattr(local, 'user_id', None) |
||
| 19 | if not hasattr(record, 'id'): |
||
| 20 | record.id = getattr(local, 'random', None) |
||
| 21 | if not hasattr(record, 'ip'): |
||
| 22 | record.ip = getattr(local, 'client_ip', None) |
||
| 23 | return True |