Quote consistency

This commit is contained in:
Bo Lopker 2016-04-12 14:23:00 -07:00
parent f2ffd5ad5e
commit a300f1190d
17 changed files with 122 additions and 119 deletions

View File

@ -10,6 +10,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
from __future__ import unicode_literals
from datetime import datetime
import os
import sys
@ -43,8 +45,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'cookiecutter-django'
copyright = u"2013-{}, Daniel Roy Greenfeld".format(now.year)
project = 'cookiecutter-django'
copyright = '2013-{}, Daniel Roy Greenfeld'.format(now.year)
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -188,8 +190,8 @@ latex_elements = {
latex_documents = [
('index',
'cookiecutter-django.tex',
u'cookiecutter-django Documentation',
u"cookiecutter-django", 'manual'),
'cookiecutter-django Documentation',
'cookiecutter-django', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -218,8 +220,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'cookiecutter-django', u'cookiecutter-django documentation',
[u"Daniel Roy Greenfeld"], 1)
('index', 'cookiecutter-django', 'cookiecutter-django documentation',
['Daniel Roy Greenfeld'], 1)
]
# If true, show URL addresses after external links.
@ -232,8 +234,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'cookiecutter-django', u'cookiecutter-django documentation',
u"Daniel Roy Greenfeld", 'cookiecutter-django',
('index', 'cookiecutter-django', 'cookiecutter-django documentation',
'Daniel Roy Greenfeld', 'cookiecutter-django',
'A Cookiecutter template for creating production-ready Django projects quickly.', 'Miscellaneous'),
]

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
import os
import platform
import sys
try:
@ -11,11 +10,11 @@ except ImportError:
# Our version ALWAYS matches the version of Django we support
# If Django has a new release, we branch, tag, then update this setting after the tag.
version = "1.9.4"
version = '1.9.4'
if sys.argv[-1] == 'tag':
os.system("git tag -a %s -m 'version %s'" % (version, version))
os.system("git push --tags")
os.system('git tag -a %s -m "version %s"' % (version, version))
os.system('git push --tags')
sys.exit()
with open('README.rst') as readme_file:

View File

@ -7,23 +7,23 @@ import sh
import pytest
from binaryornot.check import is_binary
PATTERN = "{{(\s?cookiecutter)[.](.*?)}}"
PATTERN = '{{(\s?cookiecutter)[.](.*?)}}'
RE_OBJ = re.compile(PATTERN)
@pytest.fixture
def context():
return {
"project_name": "My Test Project",
"repo_name": "my_test_project",
"author_name": "Test Author",
"email": "test@example.com",
"description": "A short description of the project.",
"domain_name": "example.com",
"version": "0.1.0",
"timezone": "UTC",
"now": "2015/01/13",
"year": "2015"
'project_name': 'My Test Project',
'repo_name': 'my_test_project',
'author_name': 'Test Author',
'email': 'test@example.com',
'description': 'A short description of the project.',
'domain_name': 'example.com',
'version': '0.1.0',
'timezone': 'UTC',
'now': '2015/01/13',
'year': '2015'
}
@ -46,7 +46,7 @@ def check_paths(paths):
continue
for line in open(path, 'r'):
match = RE_OBJ.search(line)
msg = "cookiecutter variable not replaced in {}"
msg = 'cookiecutter variable not replaced in {}'
assert match is None, msg.format(path)

View File

@ -71,7 +71,7 @@ MIGRATION_MODULES = {
# DEBUG
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool("DJANGO_DEBUG", False)
DEBUG = env.bool('DJANGO_DEBUG', False)
# FIXTURE CONFIGURATION
# ------------------------------------------------------------------------------
@ -99,7 +99,7 @@ MANAGERS = ADMINS
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
'default': env.db("DATABASE_URL", default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.repo_name}}"),
'default': env.db('DATABASE_URL', default='postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.repo_name}}'),
}
DATABASES['default']['ATOMIC_REQUESTS'] = True
@ -212,7 +212,7 @@ ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True)
ACCOUNT_ALLOW_REGISTRATION = env.bool('DJANGO_ACCOUNT_ALLOW_REGISTRATION', True)
ACCOUNT_ADAPTER = '{{cookiecutter.repo_name}}.users.adapters.AccountAdapter'
SOCIALACCOUNT_ADAPTER = '{{cookiecutter.repo_name}}.users.adapters.SocialAccountAdapter'
@ -224,12 +224,12 @@ LOGIN_URL = 'account_login'
# SLUGLIFIER
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
{% if cookiecutter.use_celery == "y" %}
{% if cookiecutter.use_celery == 'y' %}
########## CELERY
INSTALLED_APPS += ('{{cookiecutter.repo_name}}.taskapp.celery.CeleryConfig',)
# if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line.
INSTALLED_APPS += ('kombu.transport.django',)
BROKER_URL = env("CELERY_BROKER_URL", default='django://')
BROKER_URL = env('CELERY_BROKER_URL', default='django://')
########## END CELERY
{% endif %}

View File

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
'''
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
"""
from .common import * # noqa
@ -19,13 +19,13 @@ TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing.
SECRET_KEY = env("DJANGO_SECRET_KEY", default='CHANGEME!!!')
SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
# Mail settings
# ------------------------------------------------------------------------------
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
{%if cookiecutter.use_mailhog == "n" -%}
{%if cookiecutter.use_mailhog == 'n' -%}
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND',
default='django.core.mail.backends.console.EmailBackend')
{%- endif %}
@ -60,7 +60,7 @@ INSTALLED_APPS += ('django_extensions', )
# TESTING
# ------------------------------------------------------------------------------
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
{% if cookiecutter.use_celery == "y" %}
{% if cookiecutter.use_celery == 'y' %}
########## CELERY
# In development, all tasks will be executed locally by blocking until the task returns
CELERY_ALWAYS_EAGER = True

View File

@ -1,23 +1,23 @@
# -*- coding: utf-8 -*-
'''
"""
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
{% if cookiecutter.use_sentry == "y" %}
{% if cookiecutter.use_sentry == 'y' %}
- Use sentry for error logging
{% endif %}
{% if cookiecutter.use_opbeat == "y" %}
{% if cookiecutter.use_opbeat == 'y' %}
- Use opbeat for error reporting
{% endif %}
'''
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
{% if cookiecutter.use_sentry == "y" %}
{% if cookiecutter.use_sentry == 'y' %}
import logging
{% endif %}
@ -27,7 +27,7 @@ from .common import * # noqa
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = env("DJANGO_SECRET_KEY")
SECRET_KEY = env('DJANGO_SECRET_KEY')
# This ensures that Django will be able to detect a secure connection
# properly on Heroku.
@ -35,8 +35,8 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# django-secure
# ------------------------------------------------------------------------------
INSTALLED_APPS += ("djangosecure", )
{% if cookiecutter.use_sentry == "y" -%}
INSTALLED_APPS += ('djangosecure', )
{% if cookiecutter.use_sentry == 'y' -%}
# raven sentry client
# See https://docs.getsentry.com/hosted/clients/python/integrations/django/
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
@ -44,7 +44,7 @@ INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
SECURITY_MIDDLEWARE = (
'djangosecure.middleware.SecurityMiddleware',
)
{% if cookiecutter.use_sentry == "y" -%}
{% if cookiecutter.use_sentry == 'y' -%}
RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware',)
MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + \
@ -55,7 +55,7 @@ MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + \
MIDDLEWARE_CLASSES = SECURITY_MIDDLEWARE + MIDDLEWARE_CLASSES
{%- endif %}
{% if cookiecutter.use_opbeat == "y" -%}
{% if cookiecutter.use_opbeat == 'y' -%}
# opbeat integration
# See https://opbeat.com/languages/django/
INSTALLED_APPS += ('opbeat.contrib.django',)
@ -71,14 +71,14 @@ MIDDLEWARE_CLASSES = (
# set this to 60 seconds and then to 518400 when you can prove it works
SECURE_HSTS_SECONDS = 60
SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
"DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS", default=True)
SECURE_FRAME_DENY = env.bool("DJANGO_SECURE_FRAME_DENY", default=True)
'DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS', default=True)
SECURE_FRAME_DENY = env.bool('DJANGO_SECURE_FRAME_DENY', default=True)
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
"DJANGO_SECURE_CONTENT_TYPE_NOSNIFF", default=True)
'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=True)
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
# SITE CONFIGURATION
# ------------------------------------------------------------------------------
@ -87,7 +87,7 @@ SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=True)
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}'])
# END SITE CONFIGURATION
INSTALLED_APPS += ("gunicorn", )
INSTALLED_APPS += ('gunicorn', )
# STORAGE CONFIGURATION
# ------------------------------------------------------------------------------
@ -152,7 +152,7 @@ DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = env('DJANGO_MAILGUN_API_KEY')
MAILGUN_SERVER_NAME = env('DJANGO_MAILGUN_SERVER_NAME')
EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", default='[{{cookiecutter.project_name}}] ')
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}] ')
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
{% if cookiecutter.use_newrelic == 'y'-%}
NEW_RELIC_LICENSE_KEY = env('NEW_RELIC_LICENSE_KEY')
@ -171,24 +171,24 @@ TEMPLATES[0]['OPTIONS']['loaders'] = [
# DATABASE CONFIGURATION
# ------------------------------------------------------------------------------
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
DATABASES['default'] = env.db("DATABASE_URL")
DATABASES['default'] = env.db('DATABASE_URL')
# CACHING
# ------------------------------------------------------------------------------
# Heroku URL does not pass the DB number, so we parse it in
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "{0}/{1}".format(env('REDIS_URL', default="redis://127.0.0.1:6379"), 0),
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"IGNORE_EXCEPTIONS": True, # mimics memcache behavior.
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': '{0}/{1}'.format(env('REDIS_URL', default='redis://127.0.0.1:6379'), 0),
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'IGNORE_EXCEPTIONS': True, # mimics memcache behavior.
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
}
}
{% if cookiecutter.use_sentry == "y" %}
{% if cookiecutter.use_sentry == 'y' %}
# Sentry Configuration
SENTRY_DSN = env('DJANGO_SENTRY_DSN')
SENTRY_CLIENT = env('DJANGO_SENTRY_CLIENT', default='raven.contrib.django.raven_compat.DjangoClient')
@ -244,7 +244,7 @@ RAVEN_CONFIG = {
'CELERY_LOGLEVEL': env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO),
'DSN': SENTRY_DSN
}
{% elif cookiecutter.use_sentry == "n" %}
{% elif cookiecutter.use_sentry == 'n' %}
# LOGGING CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging

View File

@ -9,14 +9,14 @@ from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='pages/home.html'), name="home"),
url(r'^about/$', TemplateView.as_view(template_name='pages/about.html'), name="about"),
url(r'^$', TemplateView.as_view(template_name='pages/home.html'), name='home'),
url(r'^about/$', TemplateView.as_view(template_name='pages/about.html'), name='about'),
# Django Admin, use {% raw %}{% url 'admin:index' %}{% endraw %}
url(settings.ADMIN_URL, include(admin.site.urls)),
# User management
url(r'^users/', include("{{ cookiecutter.repo_name }}.users.urls", namespace="users")),
url(r'^users/', include('{{ cookiecutter.repo_name }}.users.urls', namespace='users')),
url(r'^accounts/', include('allauth.urls')),
# Your stuff: custom urls includes go here
@ -28,8 +28,8 @@ if settings.DEBUG:
# This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like.
urlpatterns += [
url(r'^400/$', default_views.bad_request, kwargs={'exception': Exception("Bad Request!")}),
url(r'^403/$', default_views.permission_denied, kwargs={'exception': Exception("Permission Denied")}),
url(r'^404/$', default_views.page_not_found, kwargs={'exception': Exception("Page not Found")}),
url(r'^400/$', default_views.bad_request, kwargs={'exception': Exception('Bad Request!')}),
url(r'^403/$', default_views.permission_denied, kwargs={'exception': Exception('Permission Denied')}),
url(r'^404/$', default_views.page_not_found, kwargs={'exception': Exception('Page not Found')}),
url(r'^500/$', default_views.server_error),
]

View File

@ -15,8 +15,8 @@ framework.
"""
import os
{% if cookiecutter.use_newrelic == "y" -%}
if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production":
{% if cookiecutter.use_newrelic == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
import newrelic.agent
newrelic.agent.initialize()
{%- endif %}
@ -24,8 +24,8 @@ from django.core.wsgi import get_wsgi_application
{% if cookiecutter.use_whitenoise == 'y' -%}
from whitenoise.django import DjangoWhiteNoise
{%- endif %}
{% if cookiecutter.use_sentry == "y" -%}
if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production":
{% if cookiecutter.use_sentry == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
{%- endif %}
@ -45,12 +45,12 @@ application = get_wsgi_application()
# See: https://whitenoise.readthedocs.org/
application = DjangoWhiteNoise(application)
{%- endif %}
{% if cookiecutter.use_sentry == "y" -%}
if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production":
{% if cookiecutter.use_sentry == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
application = Sentry(application)
{%- endif %}
{% if cookiecutter.use_newrelic == "y" -%}
if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production":
{% if cookiecutter.use_newrelic == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
application = newrelic.agent.WSGIApplicationWrapper(application)
{%- endif %}
# Apply WSGI middleware here.

View File

@ -11,6 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
from __future__ import unicode_literals
import os
import sys
@ -41,8 +43,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'{{ cookiecutter.project_name }}'
copyright = u"{{ cookiecutter.year }}, {{ cookiecutter.author_name }}"
project = '{{ cookiecutter.project_name }}'
copyright = """{{ cookiecutter.year }}, {{ cookiecutter.author_name }}"""
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -186,8 +188,8 @@ latex_elements = {
latex_documents = [
('index',
'{{ cookiecutter.repo_name }}.tex',
u'{{ cookiecutter.project_name }} Documentation',
u"{{ cookiecutter.author_name }}", 'manual'),
'{{ cookiecutter.project_name }} Documentation',
"""{{ cookiecutter.author_name }}""", 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -216,8 +218,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', '{{ cookiecutter.repo_name }}', u'{{ cookiecutter.project_name }} Documentation',
[u"{{ cookiecutter.author_name }}"], 1)
('index', '{{ cookiecutter.repo_name }}', '{{ cookiecutter.project_name }} Documentation',
["""{{ cookiecutter.author_name }}"""], 1)
]
# If true, show URL addresses after external links.
@ -230,9 +232,9 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', '{{ cookiecutter.repo_name }}', u'{{ cookiecutter.project_name }} Documentation',
u"{{ cookiecutter.author_name }}", '{{ cookiecutter.project_name }}',
'{{ cookiecutter.description }}', 'Miscellaneous'),
('index', '{{ cookiecutter.repo_name }}', '{{ cookiecutter.project_name }} Documentation',
"""{{ cookiecutter.author_name }}""", '{{ cookiecutter.project_name }}',
"""{{ cookiecutter.description }}""", 'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.

View File

@ -2,8 +2,8 @@
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
from django.core.management import execute_from_command_line

View File

@ -24,8 +24,8 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
python_package.build()
call([
python_package.pip, "install", "-r",
path.join(PROJECT_DIRECTORY, "requirements/local.txt")
python_package.pip, 'install', '-r',
path.join(PROJECT_DIRECTORY, 'requirements/local.txt')
])
postgres_package = hitchpostgres.PostgresPackage()
@ -36,16 +36,16 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
self.services = hitchserve.ServiceBundle(
project_directory=PROJECT_DIRECTORY,
startup_timeout=float(self.settings["startup_timeout"]),
shutdown_timeout=float(self.settings["shutdown_timeout"]),
startup_timeout=float(self.settings['startup_timeout']),
shutdown_timeout=float(self.settings['shutdown_timeout']),
)
postgres_user = hitchpostgres.PostgresUser("{{cookiecutter.repo_name}}", "password")
postgres_user = hitchpostgres.PostgresUser('{{cookiecutter.repo_name}}', 'password')
self.services['Postgres'] = hitchpostgres.PostgresService(
postgres_package=postgres_package,
users=[postgres_user, ],
databases=[hitchpostgres.PostgresDatabase("{{cookiecutter.repo_name}}", postgres_user), ]
databases=[hitchpostgres.PostgresDatabase('{{cookiecutter.repo_name}}', postgres_user), ]
)
self.services['HitchSMTP'] = hitchsmtp.HitchSMTPService(port=1025)
@ -53,7 +53,7 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
self.services['Django'] = hitchpython.DjangoService(
python=python_package.python,
port=8000,
settings="config.settings.local",
settings='config.settings.local',
needs=[self.services['Postgres'], ],
env_vars=self.settings['environment_variables'],
)
@ -62,10 +62,10 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
redis_package=redis_package,
port=16379,
)
{% if cookiecutter.use_celery == "y" %}
{% if cookiecutter.use_celery == 'y' %}
self.services['Celery'] = hitchpython.CeleryService(
python=python_package.python,
app="{{cookiecutter.repo_name}}.taskapp", loglevel="INFO",
app='{{cookiecutter.repo_name}}.taskapp', loglevel='INFO',
needs=[
self.services['Redis'], self.services['Django'],
],
@ -73,7 +73,7 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
)
{% endif %}
self.services['Firefox'] = hitchselenium.SeleniumService(
xvfb=self.settings.get("xvfb", False),
xvfb=self.settings.get('xvfb', False),
no_libfaketime=True,
)
@ -118,7 +118,7 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
def load_website(self):
"""Navigate to website in Firefox."""
self.driver.get(self.services['Django'].url())
self.click("djHideToolBarButton")
self.click('djHideToolBarButton')
def fill_form(self, **kwargs):
"""Fill in a form with id=value."""
@ -150,13 +150,13 @@ class ExecutionEngine(hitchtest.ExecutionEngine):
def on_failure(self):
"""Stop and IPython."""
if not self.settings['quiet']:
if self.settings.get("pause_on_failure", False):
if self.settings.get('pause_on_failure', False):
self.pause(message=self.stacktrace.to_template())
def on_success(self):
"""Pause on success if enabled."""
if self.settings.get("pause_on_success", False):
self.pause(message="SUCCESS")
if self.settings.get('pause_on_success', False):
self.pause(message='SUCCESS')
def tear_down(self):
"""Shut down services required to run your test."""

View File

@ -13,24 +13,24 @@ from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site = apps.get_model('sites', 'Site')
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "{{cookiecutter.domain_name}}",
"name": "{{cookiecutter.project_name}}"
'domain': '{{cookiecutter.domain_name}}',
'name': '{{cookiecutter.project_name}}'
}
)
def update_site_backward(apps, schema_editor):
"""Revert site domain and name to default."""
Site = apps.get_model("sites", "Site")
Site = apps.get_model('sites', 'Site')
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "example.com",
"name": "example.com"
'domain': 'example.com',
'name': 'example.com'
}
)

View File

@ -1,4 +1,4 @@
{% if cookiecutter.use_celery == "y" %}
{% if cookiecutter.use_celery == 'y' %}
from __future__ import absolute_import
import os
from celery import Celery
@ -8,7 +8,7 @@ from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") # pragma: no cover
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local') # pragma: no cover
app = Celery('{{cookiecutter.repo_name}}')
@ -24,7 +24,7 @@ class CeleryConfig(AppConfig):
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, force=True)
{% if cookiecutter.use_sentry == "y" -%}
{% if cookiecutter.use_sentry == 'y' -%}
if hasattr(settings, 'RAVEN_CONFIG'):
# Celery signal registration
from raven import Client as RavenClient
@ -36,7 +36,7 @@ class CeleryConfig(AppConfig):
raven_register_signal(raven_client)
{%- endif %}
{% if cookiecutter.use_opbeat == "y" -%}
{% if cookiecutter.use_opbeat == 'y' -%}
if hasattr(settings, 'OPBEAT'):
from opbeat.contrib.django.models import client as opbeat_client
from opbeat.contrib.django.models import logger as opbeat_logger

View File

@ -24,7 +24,7 @@ class MyUserCreationForm(UserCreationForm):
model = User
def clean_username(self):
username = self.cleaned_data["username"]
username = self.cleaned_data['username']
try:
User.objects.get(username=username)
except User.DoesNotExist:

View File

@ -13,7 +13,7 @@ class User(AbstractUser):
# First Name and Last Name do not cover name patterns
# around the globe.
name = models.CharField(_("Name of User"), blank=True, max_length=255)
name = models.CharField(_('Name of User'), blank=True, max_length=255)
def __str__(self):
return self.username

View File

@ -9,7 +9,7 @@ class TestUser(TestCase):
def test__str__(self):
self.assertEqual(
self.user.__str__(),
"testuser" # This is the default username for self.make_user()
'testuser' # This is the default username for self.make_user()
)
def test_get_absolute_url(self):

View File

@ -12,16 +12,16 @@ from .models import User
class UserDetailView(LoginRequiredMixin, DetailView):
model = User
# These next two lines tell the view to index lookups by username
slug_field = "username"
slug_url_kwarg = "username"
slug_field = 'username'
slug_url_kwarg = 'username'
class UserRedirectView(LoginRequiredMixin, RedirectView):
permanent = False
def get_redirect_url(self):
return reverse("users:detail",
kwargs={"username": self.request.user.username})
return reverse('users:detail',
kwargs={'username': self.request.user.username})
class UserUpdateView(LoginRequiredMixin, UpdateView):
@ -33,8 +33,8 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
# send the user back to their own page after a successful update
def get_success_url(self):
return reverse("users:detail",
kwargs={"username": self.request.user.username})
return reverse('users:detail',
kwargs={'username': self.request.user.username})
def get_object(self):
# Only get the User record for the user making the request
@ -44,5 +44,5 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
class UserListView(LoginRequiredMixin, ListView):
model = User
# These next two lines tell the view to index lookups by username
slug_field = "username"
slug_url_kwarg = "username"
slug_field = 'username'
slug_url_kwarg = 'username'