Browse Source

Made flood delay configureable

Rafał Pitoń 12 years ago
parent
commit
acc27d66b7
2 changed files with 5 additions and 3 deletions
  1. 1 2
      misago/apps/threadtype/mixins.py
  2. 4 1
      misago/settings_base.py

+ 1 - 2
misago/apps/threadtype/mixins.py

@@ -10,8 +10,7 @@ class FloodProtectionMixin(object):
         if self.request.block_flood_requests and self.request.user.last_post:
             diff = timezone.now() - self.request.user.last_post
             diff = diff.seconds + (diff.days * 86400)
-            flood_limit = 35
-            wait_for = flood_limit - diff
+            wait_for = settings.FLOOD_DELAY - diff
             if wait_for > 0:
                 if wait_for < 5:
                     raise forms.ValidationError(_("You can't post one message so quickly after another. Please wait a moment and try again."))

+ 4 - 1
misago/settings_base.py

@@ -27,6 +27,9 @@ AVATAR_SIZES = (125, 100, 80, 60, 40, 24)
 # Allow usernames to contain diacritics
 UNICODE_USERNAMES = True
 
+# Default anti-flood delay (seconds)
+FLOOD_DELAY = 35
+
 # If you set this to False, Django will make some optimizations so as not
 # to load the internationalization machinery.
 USE_I18N = True
@@ -184,7 +187,7 @@ INSTALLED_APPS = (
     'django_jinja', # Jinja2 integration
     'django_jinja.contrib.humanize', # Some Django filters
     'floppyforms', # Better forms
-    'mptt', # Modified Pre-order Tree Transversal - allows us to nest forums 
+    'mptt', # Modified Pre-order Tree Transversal - allows us to nest forums
     'haystack', # Search engines bridge
     'debug_toolbar', # Debug toolbar'
     'misago', # Misago Forum App