summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-09-08 02:29:17 -0400
committerChris McDonough <chrism@plope.com>2011-09-08 02:29:17 -0400
commitc55903c70838167ee7f152c135e98724dc647063 (patch)
treeb2c668a64489168a4ee4b8107288ebcf44064b1c
parent05b8a60dc1e9bac7e8f7edd2a3f41f6bd8131307 (diff)
downloadpyramid-c55903c70838167ee7f152c135e98724dc647063.tar.gz
pyramid-c55903c70838167ee7f152c135e98724dc647063.tar.bz2
pyramid-c55903c70838167ee7f152c135e98724dc647063.zip
use unicode path names to make tests pass on jython (also happens to be the right thing, thanks jython)
-rw-r--r--pyramid/static.py5
-rw-r--r--pyramid/tests/test_integration.py24
2 files changed, 18 insertions, 11 deletions
diff --git a/pyramid/static.py b/pyramid/static.py
index 71534d09c..d3075fec0 100644
--- a/pyramid/static.py
+++ b/pyramid/static.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import os
from os.path import normcase, normpath, join, getmtime, getsize, isdir, exists
from pkg_resources import resource_exists, resource_filename, resource_isdir
@@ -178,4 +179,6 @@ def _secure_path(path_tuple):
return None
if any([contains_slash(item) for item in path_tuple]):
return None
- return '/'.join([x.encode('utf-8') for x in path_tuple])
+ encoded = u'/'.join(path_tuple) # will be unicode
+ return encoded
+
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index 753a55d36..1cbebd4c1 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
import os
import unittest
@@ -72,20 +74,22 @@ class TestStaticAppBase(IntegrationBase):
def test_hidden(self):
res = self.testapp.get('/static/.hiddenfile', status=200)
- self._assertBody(res.body, os.path.join(here,
- 'fixtures/static/.hiddenfile'))
+ self._assertBody(
+ res.body,
+ os.path.join(here, 'fixtures/static/.hiddenfile')
+ )
def test_highchars_in_pathelement(self):
- res = self.testapp.get('/static/h\xc3\xa9h\xc3\xa9/index.html',
- status=200)
- self._assertBody(res.body, os.path.join(
- here, 'fixtures/static/h\xc3\xa9h\xc3\xa9/index.html'))
+ res = self.testapp.get('/static/héhé/index.html', status=200)
+ self._assertBody(
+ res.body, os.path.join(here, u'fixtures/static/héhé/index.html')
+ )
def test_highchars_in_filename(self):
- res = self.testapp.get('/static/h\xc3\xa9h\xc3\xa9.html',
- status=200)
- self._assertBody(res.body, os.path.join(
- here, 'fixtures/static/h\xc3\xa9h\xc3\xa9.html'))
+ res = self.testapp.get('/static/héhé.html', status=200)
+ self._assertBody(
+ res.body, os.path.join(here, u'fixtures/static/héhé.html')
+ )
def test_not_modified(self):
self.testapp.extra_environ = {