This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tox.ini b/tox.ini | |
--- a/tox.ini | |
+++ b/tox.ini | |
@@ -1,7 +1,9 @@ | |
[tox] | |
envlist= | |
py26-1.3,py26-1.4,py26-1.5,py26-1.6, | |
- py27-1.3,py27-1.4,py27-1.5,py27-1.6,py27-1.7,py27-master | |
+ py27-1.3,py27-1.4,py27-1.5,py27-1.6,py27-1.7,py27-master, | |
+ py33-1.5,py33-1.6,py33-1.7,py33-master, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
SQLAlchemy, PostgreSQL (psycopg2), and autocommit | |
See blog post: http://oddbird.net/2014/06/14/sqlalchemy-postgres-autocommit/ | |
""" | |
from contextlib import contextmanager | |
from sqlalchemy import create_engine, event | |
from sqlalchemy.orm import sessionmaker, Session as BaseSession |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greatest(object): | |
"""A pseudo- (or meta-) aggregate; returns highest of sub-aggregates. | |
This has to be inserted directly into the Query internals; it can't go | |
through the usual ``qs.annotate(...)`` or ``qs.aggregate(...)`` path | |
(because that leads to ``Query.add_aggregate(...)`` which makes assumptions | |
we can't meet). | |
To use, instantiate ``Greatest`` with one or more normal aggregates, and | |
call ``greatest_instance.add_to_qs(queryset, 'name')`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./tests/runtests.py migrations | |
Testing against Django installed in '/home/carljm/projects/django/django/django/django' | |
Creating test database for alias 'default'... | |
Creating test database for alias 'other'... | |
..................................................................................................................................s...............................EE.EE.E..........s....................................... | |
====================================================================== | |
ERROR: test_squashmigrations_squashes (migrations.test_commands.SquashMigrationsTest) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/carljm/projects/django/django/django/django/test/utils.py", line 187, in inner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
from websocket import create_connection | |
BASE = 'localhost:3000/socket.io/?EIO=3' | |
# First establish a polling-transport HTTP connection to get a session ID | |
url = 'http://%s&transport=polling' % BASE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt | |
index a0dc365..fae87a0 100644 | |
--- a/docs/topics/migrations.txt | |
+++ b/docs/topics/migrations.txt | |
@@ -148,6 +148,13 @@ developers (or your production servers) check out the code, they'll | |
get both the changes to your models and the accompanying migration at the | |
same time. | |
+.. versionadded:: 1.8 | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from logging.config import dictConfig | |
import logging | |
initial = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'handlers': { | |
'console': { | |
'class': 'logging.StreamHandler', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Jinja2Backend(jinja2backend.Jinja2): | |
def __init__(self, params): | |
self.context_processors = [ | |
import_string(p) | |
for p in params['OPTIONS'].pop('context_processors', []) | |
] | |
super(Jinja2Backend, self).__init__(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Utility for pulling settings from the environment.""" | |
import os | |
from urllib.parse import urlparse | |
class EnvParser: | |
"""Utility for getting settings from the OS environ. | |
Instantiate with the name of an env var to get the current mode from (that | |
env var should be set to one of VALID_MODES, or not set), then call the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TransactionMiddleware: | |
def __init__(self, get_response): | |
self.get_response = get_response | |
def __call__(self, request): | |
with transaction.atomic(): | |
response = self.get_response(request) | |
if response.status_code == 500: | |
transaction.set_rollback() | |
return response |