Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
#1084 fixing syntax issues
  • Loading branch information
karlcow committed Jun 6, 2016
commit 45cd6c6f578f8b77f9fc73f6385346f40f4dc831
20 changes: 10 additions & 10 deletions labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def get_issue_labels(labels_uri):
def create_label(labels):
'''Create a label in the user repo'''
response = requests.post(
USER_LABELS_URI,
json.dumps(labels),
headers=AUTH_HEADERS)
USER_LABELS_URI,
json.dumps(labels),
headers=AUTH_HEADERS)
if not response.status_code == 201:
response.raise_for_status()

Expand All @@ -45,28 +45,28 @@ def delete_label(name):

def main():
'''Duplicate webcompat test repo labels in user test repo'''
#check if the user repo is a webcompat repo
# check if the user repo is a webcompat repo
if (ISSUES_URI == "webcompat/webcompat-tests" or
ISSUES_URI == "webcompat/webcompat.com"):
sys.exit("Error: Attempting to change a webcompat repo")
try:
#get all existing labels from the user issues repo
# get all existing labels from the user issues repo
user_labels = get_issue_labels(USER_LABELS_URI)
#delete all existing labels from the user issues repo
# delete all existing labels from the user issues repo
for label in user_labels:
delete_label(label.get('name'))
#get all labels from the webcompat tests repo
# get all labels from the webcompat tests repo
webcompat_labels = get_issue_labels(WEBCOMPAT_LABELS_URI)
#re-create labels in user issues repo
# re-create labels in user issues repo
for label in webcompat_labels:
data = {"name": label.get('name'), "color": label.get('color')}
create_label(data)
sys.exit(0)
except requests.exceptions.HTTPError as e:
#handles exceptions occuring due to undesired response status code
# handles exceptions occuring due to undesired response status code
sys.exit("Error: {}".format(e))
except requests.exceptions.RequestException as e:
#handles all other exceptions
# handles all other exceptions
sys.exit("Error: {}".format(e))


Expand Down
1 change: 0 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import argparse
import pkg_resources
from pkg_resources import DistributionNotFound, VersionConflict
import subprocess
import sys

IMPORT_ERROR = '''
Expand Down
5 changes: 3 additions & 2 deletions webcompat/api/uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


class Upload(object):

'''Class that abstracts over saving image and screenshot uploads.

It performs a simple extension-based validation before saving to the
Expand Down Expand Up @@ -95,8 +96,8 @@ def save(self):
file_dest = 'jpg'.join(file_dest.rsplit('png', 1))
# If animated GIF, aka duration > 0, add save_all parameter
if (self.image_object.format == 'GIF' and
self.image_object.info['duration'] > 0):
save_parameters['save_all'] = True
self.image_object.info['duration'] > 0):
save_parameters['save_all'] = True
# unpacking save_parameters
self.image_object.save(file_dest, **save_parameters)

Expand Down
4 changes: 2 additions & 2 deletions webcompat/error_handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def error_response(request, code):
def api_call(request):
'''Helper method to check if the request originates from an API call'''
if (request.path.startswith('/api/') and
request.accept_mimetypes.accept_json and
not request.accept_mimetypes.accept_html):
request.accept_mimetypes.accept_json and
not request.accept_mimetypes.accept_html):
return True
else:
return False
Expand Down