Repository: Kinto/kinto

Issue:
Port Kinto for Pyramid 1.8
Pyramid 1.8 is breaking a number of things:

- BasicAuth authn policy
- pserve http_port config.

Right now it is still an alpha release but it gets installed on time to time.


Discussion:
`_get_credentials` was removed and we can use the public `extract_http_basic_credentials` utility instead. https://github.com/Pylons/pyramid/blob/master/pyramid/authentication.py#L1138-L1175

Resolving patch:
diff --git a/kinto/core/__init__.py b/kinto/core/__init__.py
--- a/kinto/core/__init__.py
+++ b/kinto/core/__init__.py
@@ -20,7 +20,6 @@
 # Module version, as defined in PEP-0396.
 __version__ = pkg_resources.get_distribution('kinto').version  # FIXME?
 
-
 DEFAULT_SETTINGS = {
     'backoff': None,
     'batch_max_requests': 25,
diff --git a/kinto/core/authentication.py b/kinto/core/authentication.py
--- a/kinto/core/authentication.py
+++ b/kinto/core/authentication.py
@@ -24,7 +24,7 @@ def effective_principals(self, request):
     def unauthenticated_userid(self, request):
         settings = request.registry.settings
 
-        credentials = self._get_credentials(request)
+        credentials = base_auth.extract_http_basic_credentials(request)
         if credentials:
             username, password = credentials
             if not username:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ def read_file(filename):
     'jsonschema',
     'jsonpatch',
     'python-dateutil',
-    'pyramid >1.7,<1.8',
+    'pyramid > 1.8',
     'pyramid_multiauth >= 0.8',  # User on policy selected event.
     'ruamel.yaml',
     'transaction',


Test patch:
diff --git a/tests/core/test_initialization.py b/tests/core/test_initialization.py
--- a/tests/core/test_initialization.py
+++ b/tests/core/test_initialization.py
@@ -93,7 +93,7 @@ def test_specified_default_settings_are_overriden_by_application(self):
         self.assertEqual(config.registry.settings['paginate_by'], 5)
 
     def test_backends_are_not_instantiated_by_default(self):
-        config = Configurator(settings=kinto.core.DEFAULT_SETTINGS)
+        config = Configurator(settings={**kinto.core.DEFAULT_SETTINGS})
         kinto.core.initialize(config, '0.0.1', 'project_name')
         self.assertFalse(hasattr(config.registry, 'storage'))
         self.assertFalse(hasattr(config.registry, 'cache'))
@@ -430,7 +430,7 @@ def test_http_host_overrides_the_request_headers(self):
 
 class PluginsTest(unittest.TestCase):
     def test_kinto_core_includes_are_included_manually(self):
-        config = Configurator(settings=kinto.core.DEFAULT_SETTINGS)
+        config = Configurator(settings={**kinto.core.DEFAULT_SETTINGS})
         config.add_settings({'includes': 'elastic history'})
         config.route_prefix = 'v2'
 
@@ -442,7 +442,7 @@ def test_kinto_core_includes_are_included_manually(self):
                 config.include.assert_any_call('history')
 
     def make_app(self):
-        config = Configurator(settings=kinto.core.DEFAULT_SETTINGS)
+        config = Configurator(settings={**kinto.core.DEFAULT_SETTINGS})
         config.add_settings({
             'permission_backend': 'kinto.core.permission.memory',
             'includes': 'tests.core.testplugin'