Пример #1
0
    def test_inbox_ratelimit_valid_keys(self):
        request = MockRequest(self.user)

        cache_prefix = u"hello€@.+-_ <>"

        with override_settings(INBOX_LIMIT_CACHE_PREFIX=cache_prefix), \
                warnings.catch_warnings(record=True) as w:
            self.assertEqual(inbox_ratelimit.counter_full(request), False)

            for i in range(settings.INBOX_LIMIT_COUNT + 1):
                inbox_ratelimit.counter_increase(request)

            self.assertEqual(inbox_ratelimit.counter_full(request), True)

        self.assertEqual(len(w), 0)
Пример #2
0
    def test_inbox_ratelimit_valid_keys(self):
        request = MockRequest(self.user)

        cache_prefix = u"hello€@.+-_ <>"

        with override_settings(INBOX_LIMIT_CACHE_PREFIX=cache_prefix), \
                warnings.catch_warnings(record=True) as w:
            self.assertEqual(inbox_ratelimit.counter_full(request), False)

            for i in range(settings.INBOX_LIMIT_COUNT + 1):
                inbox_ratelimit.counter_increase(request)

            self.assertEqual(inbox_ratelimit.counter_full(request), True)

        self.assertEqual(len(w), 0)
Пример #3
0
 def clean(self):
     if inbox_ratelimit.counter_full(self.request):
         raise forms.ValidationError(
             _("Slow down! You're creating inboxes too quickly."))
Пример #4
0
 def clean(self):
     if inbox_ratelimit.counter_full(self.request):
         raise forms.ValidationError(_("Slow down! You're creating inboxes too quickly."))