Skip to content

linting for cdn module #2878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion prospector-more.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ inherits: prospector
strictness: medium

ignore-paths:
- cdn/
- core/
- doc_builder/
- donate/
Expand Down
6 changes: 5 additions & 1 deletion readthedocs/cdn/purge.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Utility to purge MaxCDN files, if configured."""

import logging

from django.conf import settings
Expand All @@ -19,10 +21,12 @@ def chunks(in_list, chunk_size):
from maxcdn import MaxCDN
api = MaxCDN(CDN_USERNAME, CDN_KEY, CDN_SECRET)

# pylint: disable=redefined-builtin

def purge(id, files):
# We can only purge up to 250 files per request
for chunk in chunks(files, 200):
return api.purge(id, chunk)
else:
def purge(id, files):
def purge(*__):
log.error("CDN not configured, can't purge files")