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
diff --git a/mypy/semanal.py b/mypy/semanal.py | |
index 7bac809..33d798f 100644 | |
--- a/mypy/semanal.py | |
+++ b/mypy/semanal.py | |
@@ -2943,21 +2943,9 @@ class SemanticAnalyzer(NodeVisitor): | |
if isinstance(base.node, TypeInfo): | |
# C.bar where C is a class | |
type_info = base.node | |
- elif isinstance(base.node, Var) and self.function_stack: | |
- # check for self.bar or cls.bar in method/classmethod |
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
def paginate(ctx_name): | |
""" | |
View decorator that handles pagination of a ListObject. Expects to find it | |
in the TemplateResponse context under the name ``ctx_name``. | |
This needs to not force delivery of the ListObject. | |
""" | |
def decorator(view_func): | |
@wraps(view_func) |
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 |
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/ref/forms/models.txt b/docs/ref/forms/models.txt | |
index 46f7df1..dd0a422 100644 | |
--- a/docs/ref/forms/models.txt | |
+++ b/docs/ref/forms/models.txt | |
@@ -33,8 +33,8 @@ Model Form Functions | |
``formfield_callback`` and ``widgets`` are all passed through to | |
:func:`~django.forms.models.modelform_factory`. | |
- Arguments ``formset``, ``extra``, ``max_num``, ``can_order``, and | |
- ``can_delete`` are passed through to |
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
It seems to me that there's a remarkable level of consensus developing | |
here (though it may not look like it), and a small set of remaining open | |
questions. | |
The consensus (as I see it): | |
- Migrate away from scraping external HTML pages, with package owners in | |
control of the migration but a deadline for a forced switch, as outlined | |
in Holger's PEP (with all appropriate caution and testing). |
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
It seems to me that there's a remarkable level of consensus developing here (though it may not look like it), and a small set of remaining open questions. | |
The consensus (as I see it): | |
- Migrate away from scraping external HTML pages, with package owners in control of the migration but a deadline for a forced switch, as outlined in Holger's PEP (with all appropriate caution and testing). | |
- In some way, migrate to a situation where the popular installer tools install only release files from PyPI by default, but are capable of installing from other locations if the user provides an option. | |
The open question is basically how to implement the latter portion. I see two options proposed: |
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 unittest | |
from unittest import mock | |
class SomeClass: | |
def a_method(self): | |
return 2 | |
class TestStub(unittest.TestCase): |
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
if 'raven.contrib.django' in settings.INSTALLED_APPS: # pragma: no cover | |
from raven.contrib.celery import register_signal | |
from raven.contrib.django.models import client | |
# automatic logging of task failures to Sentry | |
register_signal(client) |
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
@pytest.fixture | |
def template(request): | |
if 'param' in request.fixturenames: | |
param = request.getfuncargvalue('param') | |
else: | |
param = 'default' | |
# return something based on param |