Index: src/zope/app/exception/browser/tests/test_unauthorized.py
===================================================================
--- src/zope/app/exception/browser/tests/test_unauthorized.py	(revision 98908)
+++ src/zope/app/exception/browser/tests/test_unauthorized.py	(working copy)
@@ -17,13 +17,14 @@
 """
 from unittest import TestCase, main, makeSuite
 from zope import component, interface
-import zope.formlib.namedtemplate
+import z3c.template.interfaces
 from zope.publisher.browser import TestRequest
 from zope.authentication.interfaces import IAuthentication
 from zope.security.interfaces import IPrincipal
 from zope.app.testing import ztapi
 from zope.app.exception.browser.unauthorized import Unauthorized
 from zope.app.testing.placelesssetup import PlacelessSetup
+import zope.publisher.interfaces.browser
 
 class DummyPrincipal(object):
     interface.implements(IPrincipal)  # this is a lie
@@ -47,13 +48,14 @@
 
 class DummyTemplate (object):
 
-    def __init__(self, context):
+    def __init__(self, context, request):
         self.context = context
 
-    component.adapts(Unauthorized)
-    interface.implements(zope.formlib.namedtemplate.INamedTemplate)
+    component.adapts(Unauthorized,
+                     zope.publisher.interfaces.browser.IDefaultBrowserLayer)
+    interface.implements(z3c.template.interfaces.IContentTemplate)
 
-    def __call__(self):
+    def __call__(self, view):
         return 'You are not authorized'
 
 class Test(PlacelessSetup, TestCase):
Index: src/zope/app/exception/browser/configure.zcml
===================================================================
--- src/zope/app/exception/browser/configure.zcml	(revision 98908)
+++ src/zope/app/exception/browser/configure.zcml	(working copy)
@@ -1,5 +1,6 @@
 <zope:configure
    xmlns:zope="http://namespaces.zope.org/zope"
+   xmlns:z3c="http://namespaces.zope.org/z3c"
    xmlns="http://namespaces.zope.org/browser">
 
   <page
@@ -17,7 +18,11 @@
       class=".unauthorized.Unauthorized"
       />
 
-  <zope:adapter factory=".unauthorized.default_template" name="default" />
+  <z3c:template
+     for=".unauthorized.Unauthorized"
+     template="unauthorized.pt"
+     name="default"
+      />
 
   <page
       for="zope.exceptions.interfaces.IUserError"
Index: src/zope/app/exception/browser/unauthorized.py
===================================================================
--- src/zope/app/exception/browser/unauthorized.py	(revision 98908)
+++ src/zope/app/exception/browser/unauthorized.py	(working copy)
@@ -20,8 +20,9 @@
 from zope.authentication.interfaces import IAuthentication
 from zope.publisher.browser import BrowserPage
 from zope.formlib import namedtemplate
-from zope.component import getUtility
+import zope.component
 from zope.app.pagetemplate import ViewPageTemplateFile
+import z3c.template.interfaces
 
 class Unauthorized(BrowserPage):
 
@@ -36,12 +37,10 @@
         self.request.response.setHeader('Pragma', 'no-cache')
 
         principal = self.request.principal
-        auth = getUtility(IAuthentication)
+        auth = zope.component.getUtility(IAuthentication)
         auth.unauthorized(principal.id, self.request)
         if self.request.response.getStatus() not in (302, 303):
-            return self.template()
-
-    template = namedtemplate.NamedTemplate('default')
-
-default_template = namedtemplate.NamedTemplateImplementation(
-    ViewPageTemplateFile('unauthorized.pt'), Unauthorized)
+            template = zope.component.getMultiAdapter(
+                (self, self.request), z3c.template.interfaces.IContentTemplate,
+                name='default')
+            return template(self)
Index: src/zope/app/exception/ftesting.zcml
===================================================================
--- src/zope/app/exception/ftesting.zcml	(revision 98908)
+++ src/zope/app/exception/ftesting.zcml	(working copy)
@@ -9,6 +9,7 @@
   <!-- used for functional testing setup -->
 
   <include package="zope.app.securitypolicy" file="meta.zcml" />
+  <include package="z3c.template" file="meta.zcml" />
 
   <include package="zope.app.zcmlfiles" />
   <include package="zope.app.authentication" />
Index: setup.py
===================================================================
--- setup.py	(revision 98912)
+++ setup.py	(working copy)
@@ -61,8 +61,7 @@
       ]),
       install_requires=['setuptools',
                         'zope.app.pagetemplate',
-                        # This is a dependency we can avaid:
-                        'zope.formlib',
+                        'z3c.template',
                         'zope.interface',
                         'zope.publisher',
                         ],
