0001-misc-allow-multiple-rates-in-tracking-code-throttlin.patch
wcs/forms/root.py | ||
---|---|---|
150 | 150 |
return r.getvalue() |
151 | 151 | |
152 | 152 |
def load(self): |
153 |
rate_limit = get_publisher().get_site_option('rate-limit') or '3/s' |
|
154 |
if rate_limit != 'none': |
|
155 |
ratelimited = ratelimit.utils.is_ratelimited( |
|
156 |
request=get_request().django_request, |
|
157 |
group='trackingcode', |
|
158 |
key='ip', |
|
159 |
rate=rate_limit, |
|
160 |
increment=True) |
|
161 |
if ratelimited: |
|
162 |
raise errors.AccessForbiddenError('rate limit reached') |
|
153 |
rate_limit_option = get_publisher().get_site_option('rate-limit') or '3/s 1500/d' |
|
154 |
if rate_limit_option != 'none': |
|
155 |
for rate_limit in rate_limit_option.split(): |
|
156 |
ratelimited = ratelimit.utils.is_ratelimited( |
|
157 |
request=get_request().django_request, |
|
158 |
group='trackingcode', |
|
159 |
key='ip', |
|
160 |
rate=rate_limit, |
|
161 |
increment=True) |
|
162 |
if ratelimited: |
|
163 |
raise errors.AccessForbiddenError('rate limit reached (%s)' % rate_limit) |
|
163 | 164 |
try: |
164 | 165 |
tracking_code = get_publisher().tracking_code_class.get(self.code) |
165 | 166 |
if tracking_code.formdata_id is None: |
166 |
- |