| Conditions | 2 |
| Total Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import time |
||
| 13 | def check_spam(self, json_message): |
||
| 14 | message_length = len(json_message) |
||
| 15 | info_key = int(round(time.time() * 100)) |
||
| 16 | self.info[info_key] = message_length |
||
| 17 | if message_length > settings.MAX_MESSAGE_SIZE: |
||
| 18 | self.spammed += 1 |
||
| 19 | raise ValidationError("Message can't exceed %d symbols" % settings.MAX_MESSAGE_SIZE) |
||
| 20 | self.check_timed_spam() |
||
| 21 | |||
| 25 | # raise ValidationError("You're chatting too much, calm down a bit!") |