Skip to content

Commit

Permalink
fix missing obj line in storage.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Rowansdabomb committed Oct 25, 2018
2 parents 0cd7b6d + 3d48f47 commit f72fc3b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dispatch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.5.21'
__version__ = '0.5.22'

37 changes: 32 additions & 5 deletions dispatch/bin/dispatch-admin
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
#!/usr/bin/env python
"""Dispatch Admin.
Usage:
dispatch_admin <command_name>
dispatch_admin <command_name> [<test_labels>...]
dispatch_admin (-h | --help)
dispatch_admin (-v | --version)
Options:
-h --help Show this screen.
-v --version Show version.
Commands:
test Run tests.
coverage Run coverage.
report Generate coverage report.
report_html Generate html coverage report.
"""
import os
import sys
import dispatch
import coverage
from docopt import docopt

import django
from django.conf import settings
from django.test.utils import get_runner

PACKAGE_DIR = os.path.dirname(dispatch.__file__)


def run_tests(*args):
os.environ['DJANGO_SETTINGS_MODULE'] = 'dispatch.tests.settings'

Expand All @@ -25,6 +46,7 @@ def run_tests(*args):
if failures:
sys.exit(1)


def run_coverage(*args):
# Setup coverage
cov = coverage.Coverage(
Expand All @@ -50,18 +72,21 @@ def run_coverage(*args):
# Save coverage report
cov.save()


def coverage_report():
# Show report
cov = coverage.Coverage()
cov.load()
cov.report()


def coverage_html_report():
# Show report
cov = coverage.Coverage()
cov.load()
cov.html_report()


commands = {
'test': run_tests,
'coverage': run_coverage,
Expand All @@ -71,15 +96,17 @@ commands = {

if __name__ == "__main__":

command_name = sys.argv[1]
args = sys.argv[2:]
if len(sys.argv) == 1:
sys.argv.append("-h")

arguments = docopt(__doc__, version="Dispatch Admin %s" % dispatch.__version__)

# Attempt to find command function
try:
func = commands[command_name]
func = commands[arguments["<command_name>"]]
except KeyError:
print "%s isn't a valid command" % command_name
print "%s isn't a valid command" % arguments["<command_name>"]
exit()

# Execute the function
func(*args)
func(*arguments['<test_labels>'])
3 changes: 0 additions & 3 deletions dispatch/core/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ def generate_signed_url(path, content_type, expires_after_seconds=60):
obj = os.path.join(settings.GS_LOCATION, path)

client = storage.Client()

# if settings.DEBUG:
# client = storage.Client().from_service_account_json(settings.GCS_CREDENTIALS_FILE)

bucket = client.get_bucket(settings.GS_STORAGE_BUCKET_NAME)
blob = storage.Blob(obj, bucket)
Expand Down
2 changes: 1 addition & 1 deletion dispatch/static/manager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dispatch",
"version": "0.5.21",
"version": "0.5.22",
"description": "The frontend framework for the Dispatch publishing platform.",
"author": "Peter Siemens <[email protected]>",
"homepage": "https://www.ubyssey.ca",
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name='dispatch',
version='0.5.21',
version='0.5.22',
description='A publishing platform for modern newspapers',
url='https://github.com/ubyssey/dispatch',
author='Peter Siemens',
Expand All @@ -16,6 +16,7 @@
'pillow',
'requests',
'jsonfield',
'docopt == 0.6.2'
],
extras_require={
'dev': [
Expand Down

0 comments on commit f72fc3b

Please sign in to comment.