From 10d2f293f250faf93844a8446c8fcfc5e1c90580 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 24 Sep 2011 12:28:19 -0400 Subject: fix mako tests on py3 --- pyramid/compat.py | 5 +++++ pyramid/tests/fixtures/helloworld.mak | 4 ++-- pyramid/tests/fixtures/helloworld.mako | 4 ++-- pyramid/tests/pkgs/permbugapp/__init__.py | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pyramid/compat.py b/pyramid/compat.py index ed5e900ad..1936d58ac 100644 --- a/pyramid/compat.py +++ b/pyramid/compat.py @@ -204,3 +204,8 @@ try: from Cookie import SimpleCookie except ImportError: # pragma: no cover from http.cookies import SimpleCookie + +if PY3: # pragma: no cover + from html import escape +else: + from cgi import escape diff --git a/pyramid/tests/fixtures/helloworld.mak b/pyramid/tests/fixtures/helloworld.mak index efcf791e8..25283a50d 100644 --- a/pyramid/tests/fixtures/helloworld.mak +++ b/pyramid/tests/fixtures/helloworld.mak @@ -1,3 +1,3 @@ ## -*- coding: utf-8 -*- -<% a, b = 'foo', u'föö' %> -Hello ${u'föö'} +<%!from pyramid.compat import text_%><% a, b = 'foo', text_('föö', 'utf-8') %> +Hello ${text_('föö', 'utf-8')} diff --git a/pyramid/tests/fixtures/helloworld.mako b/pyramid/tests/fixtures/helloworld.mako index efcf791e8..25283a50d 100644 --- a/pyramid/tests/fixtures/helloworld.mako +++ b/pyramid/tests/fixtures/helloworld.mako @@ -1,3 +1,3 @@ ## -*- coding: utf-8 -*- -<% a, b = 'foo', u'föö' %> -Hello ${u'föö'} +<%!from pyramid.compat import text_%><% a, b = 'foo', text_('föö', 'utf-8') %> +Hello ${text_('föö', 'utf-8')} diff --git a/pyramid/tests/pkgs/permbugapp/__init__.py b/pyramid/tests/pkgs/permbugapp/__init__.py index 10a244f3b..330d983ab 100644 --- a/pyramid/tests/pkgs/permbugapp/__init__.py +++ b/pyramid/tests/pkgs/permbugapp/__init__.py @@ -1,6 +1,6 @@ -from cgi import escape +from pyramid.compat import escape from pyramid.security import view_execution_permitted -from webob import Response +from pyramid.response import Response def x_view(request): # pragma: no cover return Response('this is private!') -- cgit v1.2.3