summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt10
-rw-r--r--docs/narr/assets.rst13
-rw-r--r--pyramid/configuration.py2
-rw-r--r--pyramid/tests/test_authentication.py6
-rw-r--r--pyramid/tests/test_configuration.py6
-rw-r--r--pyramid/tests/test_encode.py6
-rw-r--r--pyramid/tests/test_httpexceptions.py6
-rw-r--r--pyramid/tests/test_integration.py48
-rw-r--r--pyramid/tests/test_mako_templating.py6
-rw-r--r--pyramid/tests/test_request.py14
-rw-r--r--pyramid/tests/test_url.py12
-rw-r--r--pyramid/tests/test_view.py6
12 files changed, 90 insertions, 45 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index bcedb19a1..d07d49f8b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,13 @@
+Next release
+============
+
+Bug Fixes
+---------
+
+- ``pyramid.config.Configurator.with_package`` didn't work if the
+ Configurator was an old-style ``pyramid.configuration.Configurator``
+ instance.
+
1.3a9 (2012-02-22)
==================
diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst
index 22b38c929..e8e915297 100644
--- a/docs/narr/assets.rst
+++ b/docs/narr/assets.rst
@@ -379,13 +379,12 @@ do so, do things "by hand". First define the view callable.
The above bit of code within ``favicon_view`` computes "here", which is a
path relative to the Python file in which the function is defined. It then
-uses the Python ``open`` function to obtain a file handle to a file within
-"here" named ``static``, and returns a :class:`pyramid.response.FileResponse`
-using the file path as the response's ``path`` argument and the request as
-the response's ``request`` argument. :class:`pyramid.response.FileResponse`
-will serve the file as quickly as possible when it's used this way. It makes
-sure to set the right content length and content_type too based on the file
-extension of the file you pass.
+creates a :class:`pyramid.response.FileResponse` using the file path as the
+response's ``path`` argument and the request as the response's ``request``
+argument. :class:`pyramid.response.FileResponse` will serve the file as
+quickly as possible when it's used this way. It makes sure to set the right
+content length and content_type too based on the file extension of the file
+you pass.
You might register such a view via configuration as a view callable that
should be called as the result of a traversal:
diff --git a/pyramid/configuration.py b/pyramid/configuration.py
index f6543906e..802c10d1f 100644
--- a/pyramid/configuration.py
+++ b/pyramid/configuration.py
@@ -29,6 +29,7 @@ class Configurator(BaseConfigurator):
session_factory=None,
autocommit=True,
route_prefix=None,
+ introspection=True,
):
if package is None:
package = caller_package()
@@ -49,6 +50,7 @@ class Configurator(BaseConfigurator):
session_factory=session_factory,
autocommit=autocommit,
route_prefix=route_prefix,
+ introspection=introspection,
)
deprecated(
diff --git a/pyramid/tests/test_authentication.py b/pyramid/tests/test_authentication.py
index 02bfa1fed..e513b9a48 100644
--- a/pyramid/tests/test_authentication.py
+++ b/pyramid/tests/test_authentication.py
@@ -1,7 +1,9 @@
import unittest
from pyramid import testing
-from pyramid.compat import text_
-from pyramid.compat import bytes_
+from pyramid.compat import (
+ text_,
+ bytes_,
+ )
class TestCallbackAuthenticationPolicyDebugging(unittest.TestCase):
def setUp(self):
diff --git a/pyramid/tests/test_configuration.py b/pyramid/tests/test_configuration.py
index 688a597f6..0a98bcb5c 100644
--- a/pyramid/tests/test_configuration.py
+++ b/pyramid/tests/test_configuration.py
@@ -22,4 +22,10 @@ class ConfiguratorTests(unittest.TestCase):
config = self._makeOne(package='pyramid')
self.assertEqual(config.package, pyramid)
+ def test_with_package(self):
+ import pyramid
+ config = self._makeOne()
+ newconfig = config.with_package('pyramid')
+ self.assertEqual(newconfig.package, pyramid)
+
diff --git a/pyramid/tests/test_encode.py b/pyramid/tests/test_encode.py
index ccc8f16e3..736ecb5b3 100644
--- a/pyramid/tests/test_encode.py
+++ b/pyramid/tests/test_encode.py
@@ -1,6 +1,8 @@
import unittest
-from pyramid.compat import text_
-from pyramid.compat import native_
+from pyramid.compat import (
+ text_,
+ native_,
+ )
class UrlEncodeTests(unittest.TestCase):
def _callFUT(self, query, doseq=False):
diff --git a/pyramid/tests/test_httpexceptions.py b/pyramid/tests/test_httpexceptions.py
index 84485fadc..0061907ba 100644
--- a/pyramid/tests/test_httpexceptions.py
+++ b/pyramid/tests/test_httpexceptions.py
@@ -1,7 +1,9 @@
import unittest
-from pyramid.compat import bytes_
-from pyramid.compat import text_
+from pyramid.compat import (
+ bytes_,
+ text_,
+ )
class Test_exception_response(unittest.TestCase):
def _callFUT(self, *arg, **kw):
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index bf3bafc09..85a68ab25 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -1,20 +1,25 @@
# -*- coding: utf-8 -*-
import datetime
+import locale
import os
import unittest
from pyramid.wsgi import wsgiapp
from pyramid.view import view_config
from pyramid.static import static_view
-from pyramid.compat import text_
-from pyramid.compat import url_quote
+from pyramid.compat import (
+ text_,
+ url_quote,
+ )
from zope.interface import Interface
# 5 years from now (more or less)
fiveyrsfuture = datetime.datetime.utcnow() + datetime.timedelta(5*365)
+defaultlocale = locale.getdefaultlocale()[1]
+
class INothing(Interface):
pass
@@ -76,23 +81,25 @@ class TestStaticAppBase(IntegrationBase):
res = self.testapp.get('/static/.hiddenfile', status=200)
_assertBody(res.body, os.path.join(here, 'fixtures/static/.hiddenfile'))
- def test_highchars_in_pathelement(self):
- url = url_quote('/static/héhé/index.html')
- res = self.testapp.get(url, status=200)
- _assertBody(
- res.body,
- os.path.join(here,
- text_('fixtures/static/héhé/index.html', 'utf-8'))
- )
-
- def test_highchars_in_filename(self):
- url = url_quote('/static/héhé.html')
- res = self.testapp.get(url, status=200)
- _assertBody(
- res.body,
- os.path.join(here,
- text_('fixtures/static/héhé.html', 'utf-8'))
- )
+ if defaultlocale is not None:
+ # These tests are expected to fail on LANG=C systems
+ def test_highchars_in_pathelement(self):
+ url = url_quote('/static/héhé/index.html')
+ res = self.testapp.get(url, status=200)
+ _assertBody(
+ res.body,
+ os.path.join(here,
+ text_('fixtures/static/héhé/index.html', 'utf-8'))
+ )
+
+ def test_highchars_in_filename(self):
+ url = url_quote('/static/héhé.html')
+ res = self.testapp.get(url, status=200)
+ _assertBody(
+ res.body,
+ os.path.join(here,
+ text_('fixtures/static/héhé.html', 'utf-8'))
+ )
def test_not_modified(self):
self.testapp.extra_environ = {
@@ -611,5 +618,8 @@ def read_(filename):
return val
def _assertBody(body, filename):
+ if defaultlocale is None: # pragma: no cover
+ # If system locale does not have an encoding then default to utf-8
+ filename = filename.encode('utf-8')
assert(body.replace(b'\r', b'') == read_(filename))
diff --git a/pyramid/tests/test_mako_templating.py b/pyramid/tests/test_mako_templating.py
index 0726c5250..550c95312 100644
--- a/pyramid/tests/test_mako_templating.py
+++ b/pyramid/tests/test_mako_templating.py
@@ -2,8 +2,10 @@
import unittest
from pyramid import testing
-from pyramid.compat import text_
-from pyramid.compat import text_type
+from pyramid.compat import (
+ text_,
+ text_type,
+ )
class Base(object):
def setUp(self):
diff --git a/pyramid/tests/test_request.py b/pyramid/tests/test_request.py
index 8a5215a2b..170ea5c97 100644
--- a/pyramid/tests/test_request.py
+++ b/pyramid/tests/test_request.py
@@ -1,11 +1,15 @@
import unittest
from pyramid import testing
-from pyramid.compat import PY3
-from pyramid.compat import text_
-from pyramid.compat import bytes_
-from pyramid.compat import native_
-from pyramid.compat import iteritems_, iterkeys_, itervalues_
+from pyramid.compat import (
+ PY3,
+ text_,
+ bytes_,
+ native_,
+ iteritems_,
+ iterkeys_,
+ itervalues_,
+ )
class TestRequest(unittest.TestCase):
def setUp(self):
diff --git a/pyramid/tests/test_url.py b/pyramid/tests/test_url.py
index 7b05368ce..527bf31bc 100644
--- a/pyramid/tests/test_url.py
+++ b/pyramid/tests/test_url.py
@@ -1,10 +1,14 @@
import unittest
import warnings
-from pyramid.testing import setUp
-from pyramid.testing import tearDown
-from pyramid.compat import text_
-from pyramid.compat import native_
+from pyramid.testing import (
+ setUp,
+ tearDown,
+ )
+from pyramid.compat import (
+ text_,
+ native_,
+ )
class TestURLMethodsMixin(unittest.TestCase):
def setUp(self):
diff --git a/pyramid/tests/test_view.py b/pyramid/tests/test_view.py
index a775e7bc9..a105adb70 100644
--- a/pyramid/tests/test_view.py
+++ b/pyramid/tests/test_view.py
@@ -3,8 +3,10 @@ import sys
from zope.interface import implementer
-from pyramid.testing import setUp
-from pyramid.testing import tearDown
+from pyramid.testing import (
+ setUp,
+ tearDown,
+ )
class BaseTest(object):
def setUp(self):