← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:upgrade-z3c.pt into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:upgrade-z3c.pt into launchpad:master.

Commit message:
Upgrade Chameleon, z3c.pt, and z3c.ptcompat

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/376976

z3c.ptcompat is now configured entirely via ZCML, and the PREFER_Z3C_PT environment variable is obsolete.  We now have to import directly from ZTK rather than going via z3c.ptcompat (it registers an IPageTemplateEngine utility in its configure.zcml instead).

I've run the full test suite over the default configuration, but I've only done some basic testing on the Chameleon mode to make sure it isn't entirely broken.  At some point we should do some performance testing and pick one or the other rather than retaining it as a rarely-tested option, but this at least gets these dependencies out of the way of a Python 3 port.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:upgrade-z3c.pt into launchpad:master.
diff --git a/constraints.txt b/constraints.txt
index b153e9e..a95ca14 100644
--- a/constraints.txt
+++ b/constraints.txt
@@ -180,7 +180,7 @@ bson==0.3.3
 # lp:~launchpad/bzr/lp
 bzr==2.6.0.lp.4
 celery==4.1.1
-Chameleon==2.11
+Chameleon==3.6.2
 constantly==15.1.0
 cookies==2.2.1
 cryptography==2.7
@@ -316,13 +316,12 @@ wheel==0.29.0
 wsgi-intercept==0.5.1
 WSGIProxy2==0.4.6
 wsgiref==0.1.2
-z3c.pt==2.2.3
-z3c.ptcompat[zpt]==0.5.7
+z3c.pt==3.2.0
+z3c.ptcompat==2.2.0
 zc.zservertracelog==1.3.2
 zope.app.applicationcontrol==4.0.0
 zope.app.appsetup==4.1.0
 zope.app.http==4.0.1
-zope.app.pagetemplate==3.11.2
 zope.app.publication==4.3.1
 zope.app.publisher==3.10.2
 zope.app.server==4.0.0
diff --git a/doc/chameleon.txt b/doc/chameleon.txt
index 8ccb73a..0aec37d 100644
--- a/doc/chameleon.txt
+++ b/doc/chameleon.txt
@@ -1,21 +1,11 @@
 Running Launchpad with Chameleon Template Engine
 ================================================
 
-- Need to pull the following dependencies into ``sourcecode``:
+- Uncomment ``<include package="z3c.ptcompat" />`` in ``zcml/zopeapp.zcml``
+  to enable ``z3c.pt``.
 
-  - lp:sourcecodegen/trunk
-  - lp:chameleon.core/trunk
-  - lp:chameleon.zpt/trunk
-  - lp:z3c.pt/trunk
-  - lp:z3c.ptcompat/trunk
 
-- Run launchpad with ``PREFER_Z3C_PT=true make run`` to enable
-  ``z3c.pt``. Omitting it or setting to ``false`` will disable
-  ``z3c.pt`` and use ``zope.pagetemplate`` instead. Yes, it's that
-  simple. This is possible thanks to ``z3c.ptcompat``.
-
-
-Other useful environment options for ``z3c.pt``::
+Useful environment options for ``z3c.pt``::
 
   # in debug-mode, templates on disk are reloaded if they're modified
   CHAMELEON_DEBUG (default: false)
diff --git a/lib/lp/answers/browser/question.py b/lib/lp/answers/browser/question.py
index a477b4e..e660cb2 100644
--- a/lib/lp/answers/browser/question.py
+++ b/lib/lp/answers/browser/question.py
@@ -31,7 +31,7 @@ import re
 
 from lazr.restful.interface import copy_field
 from lazr.restful.utils import smartquote
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib import form
 from zope.formlib.interfaces import IWidgetFactory
diff --git a/lib/lp/answers/browser/questiontarget.py b/lib/lp/answers/browser/questiontarget.py
index ca468c5..9fcf9e0 100644
--- a/lib/lp/answers/browser/questiontarget.py
+++ b/lib/lp/answers/browser/questiontarget.py
@@ -28,7 +28,7 @@ from lazr.restful.interfaces import (
     IWebServiceClientRequest,
     )
 from simplejson import dumps
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     getMultiAdapter,
     getUtility,
diff --git a/lib/lp/app/browser/doc/base-layout.txt b/lib/lp/app/browser/doc/base-layout.txt
index 12d1250..888c7d0 100644
--- a/lib/lp/app/browser/doc/base-layout.txt
+++ b/lib/lp/app/browser/doc/base-layout.txt
@@ -12,7 +12,7 @@ YUI grid classes for positioning.
 
     >>> from lp.services.webapp.publisher import LaunchpadView
     >>> from lp.services.webapp.servers import LaunchpadTestRequest
-    >>> from z3c.ptcompat import ViewPageTemplateFile
+    >>> from zope.browserpage import ViewPageTemplateFile
 
     >>> user = factory.makePerson(name='waffles')
     >>> request = LaunchpadTestRequest(
diff --git a/lib/lp/app/browser/doc/launchpadform-view.txt b/lib/lp/app/browser/doc/launchpadform-view.txt
index a365ed7..46b554d 100644
--- a/lib/lp/app/browser/doc/launchpadform-view.txt
+++ b/lib/lp/app/browser/doc/launchpadform-view.txt
@@ -11,7 +11,7 @@ can be used for subordinate field indentation, for example.
     >>> from zope.interface import Interface
     >>> from zope.schema import TextLine
     >>> from lp.services.config import config
-    >>> from z3c.ptcompat import ViewPageTemplateFile
+    >>> from zope.browserpage import ViewPageTemplateFile
     >>> from lp.app.browser.launchpadform import LaunchpadFormView
     >>> from lp.testing.pages import find_tags_by_class
     >>> from lp.services.webapp.servers import LaunchpadTestRequest
diff --git a/lib/lp/app/browser/lazrjs.py b/lib/lp/app/browser/lazrjs.py
index 95f37bb..3c3f0a8 100644
--- a/lib/lp/app/browser/lazrjs.py
+++ b/lib/lp/app/browser/lazrjs.py
@@ -23,7 +23,7 @@ from lazr.restful.utils import (
     safe_hasattr,
     )
 import simplejson
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.schema.interfaces import (
     ICollection,
diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
index 156a93d..3466a83 100644
--- a/lib/lp/app/browser/tales.py
+++ b/lib/lp/app/browser/tales.py
@@ -22,7 +22,7 @@ from lazr.enum import enumerated_type_registry
 from lazr.restful.utils import get_current_browser_request
 from lazr.uri import URI
 import pytz
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     adapter,
     getMultiAdapter,
diff --git a/lib/lp/app/browser/tests/test_base_layout.py b/lib/lp/app/browser/tests/test_base_layout.py
index 2c1044d..c77f75c 100644
--- a/lib/lp/app/browser/tests/test_base_layout.py
+++ b/lib/lp/app/browser/tests/test_base_layout.py
@@ -13,7 +13,7 @@ in the root element. The template provides common layout to Launchpad.
 
 __metaclass__ = type
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 
 from lp.registry.interfaces.person import PersonVisibility
 from lp.services.beautifulsoup import BeautifulSoup4 as BeautifulSoup
diff --git a/lib/lp/app/browser/tests/test_launchpadform.py b/lib/lp/app/browser/tests/test_launchpadform.py
index 40f45ea..cc85eee 100644
--- a/lib/lp/app/browser/tests/test_launchpadform.py
+++ b/lib/lp/app/browser/tests/test_launchpadform.py
@@ -13,7 +13,7 @@ from os.path import (
 from lxml import html
 import simplejson
 from testtools.content import text_content
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.formlib.form import action
 from zope.interface import Interface
 from zope.schema import (
diff --git a/lib/lp/app/doc/launchpadform.txt b/lib/lp/app/doc/launchpadform.txt
index 808523e..6af879c 100644
--- a/lib/lp/app/doc/launchpadform.txt
+++ b/lib/lp/app/doc/launchpadform.txt
@@ -469,7 +469,7 @@ template and thus is way simpler.
 
   >>> from StringIO import StringIO
   >>> from tempfile import mkstemp
-  >>> from z3c.ptcompat import ViewPageTemplateFile
+  >>> from zope.browserpage import ViewPageTemplateFile
   >>> file, filename = mkstemp()
   >>> f = open(filename, 'w')
   >>> f.write(u'<div metal:use-macro="context/@@launchpad_form/form" />')
diff --git a/lib/lp/app/doc/menus.txt b/lib/lp/app/doc/menus.txt
index 3035ae8..74aabff 100644
--- a/lib/lp/app/doc/menus.txt
+++ b/lib/lp/app/doc/menus.txt
@@ -1090,7 +1090,7 @@ NavigationMenus used in the previous TALES section.
 
     >>> import operator
     >>> import tempfile
-    >>> from z3c.ptcompat import ViewPageTemplateFile
+    >>> from zope.browserpage import ViewPageTemplateFile
     >>> from lp.services.webapp.menu import (
     ...     get_facet, get_current_view)
 
diff --git a/lib/lp/app/widgets/date.py b/lib/lp/app/widgets/date.py
index 06b0eb6..b6e8a38 100644
--- a/lib/lp/app/widgets/date.py
+++ b/lib/lp/app/widgets/date.py
@@ -22,7 +22,7 @@ __all__ = [
 from datetime import datetime
 
 import pytz
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.datetime import (
     DateTimeError,
diff --git a/lib/lp/app/widgets/exception.py b/lib/lp/app/widgets/exception.py
index 446386e..a7c68a7 100644
--- a/lib/lp/app/widgets/exception.py
+++ b/lib/lp/app/widgets/exception.py
@@ -1,7 +1,7 @@
 # Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.formlib.interfaces import (
     IWidgetInputError,
     IWidgetInputErrorView,
diff --git a/lib/lp/app/widgets/launchpadtarget.py b/lib/lp/app/widgets/launchpadtarget.py
index 536a2e8..89b2a95 100644
--- a/lib/lp/app/widgets/launchpadtarget.py
+++ b/lib/lp/app/widgets/launchpadtarget.py
@@ -3,7 +3,7 @@
 
 __metaclass__ = type
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import (
     ConversionError,
diff --git a/lib/lp/app/widgets/popup.py b/lib/lp/app/widgets/popup.py
index d1097d4..9e8fb73 100644
--- a/lib/lp/app/widgets/popup.py
+++ b/lib/lp/app/widgets/popup.py
@@ -16,7 +16,7 @@ __all__ = [
 
 from lazr.restful.utils import safe_hasattr
 import simplejson
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import ConversionError
 from zope.formlib.itemswidgets import (
diff --git a/lib/lp/app/widgets/product.py b/lib/lp/app/widgets/product.py
index b4b2f40..e3c9d57 100644
--- a/lib/lp/app/widgets/product.py
+++ b/lib/lp/app/widgets/product.py
@@ -15,7 +15,7 @@ __all__ = [
 import math
 
 from lazr.restful.interface import copy_field
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.boolwidgets import CheckBoxWidget
 from zope.formlib.interfaces import IInputWidget
diff --git a/lib/lp/app/widgets/textwidgets.py b/lib/lp/app/widgets/textwidgets.py
index e30a857..6b50946 100644
--- a/lib/lp/app/widgets/textwidgets.py
+++ b/lib/lp/app/widgets/textwidgets.py
@@ -5,7 +5,7 @@ import datetime
 import re
 
 import pytz
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.datetime import (
     DateTimeError,
     parse,
diff --git a/lib/lp/blueprints/browser/specificationtarget.py b/lib/lp/blueprints/browser/specificationtarget.py
index 70ef413..32e826d 100644
--- a/lib/lp/blueprints/browser/specificationtarget.py
+++ b/lib/lp/blueprints/browser/specificationtarget.py
@@ -19,7 +19,7 @@ from lazr.restful.utils import (
     safe_hasattr,
     smartquote,
     )
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     getMultiAdapter,
     queryMultiAdapter,
diff --git a/lib/lp/bugs/browser/bugalsoaffects.py b/lib/lp/bugs/browser/bugalsoaffects.py
index 0bd25b5..4fa3421 100644
--- a/lib/lp/bugs/browser/bugalsoaffects.py
+++ b/lib/lp/bugs/browser/bugalsoaffects.py
@@ -16,7 +16,7 @@ from lazr.enum import (
     Item,
     )
 from lazr.lifecycle.event import ObjectCreatedEvent
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.event import notify
 from zope.formlib import form
diff --git a/lib/lp/bugs/browser/buglisting.py b/lib/lp/bugs/browser/buglisting.py
index 2468f2f..3cef8f9 100644
--- a/lib/lp/bugs/browser/buglisting.py
+++ b/lib/lp/bugs/browser/buglisting.py
@@ -34,8 +34,8 @@ from six.moves.urllib.parse import (
     parse_qs,
     parse_qsl,
     )
-from z3c.pt.pagetemplate import ViewPageTemplateFile
 from zope.authentication.interfaces import IUnauthenticatedPrincipal
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     getAdapter,
     getUtility,
diff --git a/lib/lp/bugs/browser/bugtarget.py b/lib/lp/bugs/browser/bugtarget.py
index 82d49db..5b0366a 100644
--- a/lib/lp/bugs/browser/bugtarget.py
+++ b/lib/lp/bugs/browser/bugtarget.py
@@ -31,7 +31,7 @@ from lazr.restful.interfaces import IJSONRequestCache
 from pytz import timezone
 from simplejson import dumps
 from sqlobject import SQLObjectNotFound
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.form import Fields
 from zope.formlib.interfaces import InputErrors
diff --git a/lib/lp/bugs/browser/bugtask.py b/lib/lp/bugs/browser/bugtask.py
index b25e213..3cc4ad5 100644
--- a/lib/lp/bugs/browser/bugtask.py
+++ b/lib/lp/bugs/browser/bugtask.py
@@ -51,8 +51,8 @@ from lazr.restful.utils import smartquote
 from pytz import utc
 from simplejson import dumps
 import transaction
-from z3c.pt.pagetemplate import ViewPageTemplateFile
 from zope import formlib
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     adapter,
     ComponentLookupError,
diff --git a/lib/lp/bugs/browser/widgets/bugtask.py b/lib/lp/bugs/browser/widgets/bugtask.py
index 334ba08..b17d19f 100644
--- a/lib/lp/bugs/browser/widgets/bugtask.py
+++ b/lib/lp/bugs/browser/widgets/bugtask.py
@@ -17,7 +17,7 @@ __all__ = [
     "NewLineToSpacesWidget",
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import (
     IDisplayWidget,
diff --git a/lib/lp/bugs/feed/bug.py b/lib/lp/bugs/feed/bug.py
index 644fa88..218f199 100644
--- a/lib/lp/bugs/feed/bug.py
+++ b/lib/lp/bugs/feed/bug.py
@@ -12,7 +12,7 @@ __all__ = [
     'SearchBugsFeed',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 
 from lp.bugs.browser.buglisting import (
diff --git a/lib/lp/code/browser/branchlisting.py b/lib/lp/code/browser/branchlisting.py
index e1a2525..176733b 100644
--- a/lib/lp/code/browser/branchlisting.py
+++ b/lib/lp/code/browser/branchlisting.py
@@ -35,7 +35,7 @@ from lazr.enum import (
     Item,
     )
 from storm.expr import Desc
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib import form
 from zope.interface import (
diff --git a/lib/lp/code/browser/sourcepackagerecipe.py b/lib/lp/code/browser/sourcepackagerecipe.py
index a16f29b..9c5b2d4 100644
--- a/lib/lp/code/browser/sourcepackagerecipe.py
+++ b/lib/lp/code/browser/sourcepackagerecipe.py
@@ -33,8 +33,8 @@ from lazr.restful.interfaces import (
     )
 import simplejson
 from storm.locals import Store
-from z3c.ptcompat import ViewPageTemplateFile
 from zope import component
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.event import notify
 from zope.formlib import form
diff --git a/lib/lp/code/browser/widgets/branchtarget.py b/lib/lp/code/browser/widgets/branchtarget.py
index 63a5d1e..77e479a 100644
--- a/lib/lp/code/browser/widgets/branchtarget.py
+++ b/lib/lp/code/browser/widgets/branchtarget.py
@@ -7,7 +7,7 @@ __all__ = [
     'BranchTargetWidget',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.formlib.interfaces import (
     ConversionError,
     IInputWidget,
diff --git a/lib/lp/code/browser/widgets/gitgrantee.py b/lib/lp/code/browser/widgets/gitgrantee.py
index 9177823..4cb8a8a 100644
--- a/lib/lp/code/browser/widgets/gitgrantee.py
+++ b/lib/lp/code/browser/widgets/gitgrantee.py
@@ -12,7 +12,7 @@ __all__ = [
 
 from lazr.enum import DBItem
 from lazr.restful.fields import Reference
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.formlib.interfaces import (
     ConversionError,
     IDisplayWidget,
diff --git a/lib/lp/code/browser/widgets/gitref.py b/lib/lp/code/browser/widgets/gitref.py
index a56a449..cfe8e40 100644
--- a/lib/lp/code/browser/widgets/gitref.py
+++ b/lib/lp/code/browser/widgets/gitref.py
@@ -8,7 +8,7 @@ __all__ = [
     ]
 
 import six
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import (
     ConversionError,
diff --git a/lib/lp/code/browser/widgets/gitrepositorytarget.py b/lib/lp/code/browser/widgets/gitrepositorytarget.py
index f5191df..63e9285 100644
--- a/lib/lp/code/browser/widgets/gitrepositorytarget.py
+++ b/lib/lp/code/browser/widgets/gitrepositorytarget.py
@@ -8,7 +8,7 @@ __all__ = [
     'GitRepositoryTargetWidget',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import (
     ConversionError,
diff --git a/lib/lp/code/feed/branch.py b/lib/lp/code/feed/branch.py
index 8ec11f5..45a5077 100644
--- a/lib/lp/code/feed/branch.py
+++ b/lib/lp/code/feed/branch.py
@@ -15,7 +15,7 @@ __all__ = [
     'ProjectRevisionFeed',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.interface import implementer
 from zope.security.interfaces import Unauthorized
diff --git a/lib/lp/hardwaredb/browser/hwdb.py b/lib/lp/hardwaredb/browser/hwdb.py
index c948794..cbd1801 100644
--- a/lib/lp/hardwaredb/browser/hwdb.py
+++ b/lib/lp/hardwaredb/browser/hwdb.py
@@ -13,7 +13,7 @@ __all__ = [
 
 from textwrap import dedent
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.interface import implementer
 from zope.publisher.interfaces.browser import IBrowserPublisher
diff --git a/lib/lp/registry/browser/distroseriesdifference.py b/lib/lp/registry/browser/distroseriesdifference.py
index 9b0666f..d58ce5f 100644
--- a/lib/lp/registry/browser/distroseriesdifference.py
+++ b/lib/lp/registry/browser/distroseriesdifference.py
@@ -10,7 +10,7 @@ __all__ = [
     ]
 
 from lazr.restful.interfaces import IWebServiceClientRequest
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     adapter,
     getUtility,
diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
index a6df4b5..da99b67 100644
--- a/lib/lp/registry/browser/person.py
+++ b/lib/lp/registry/browser/person.py
@@ -65,7 +65,7 @@ from lazr.restful.utils import smartquote
 from lazr.uri import URI
 import pytz
 from storm.zope.interfaces import IResultSet
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     adapter,
     getUtility,
diff --git a/lib/lp/registry/browser/poll.py b/lib/lp/registry/browser/poll.py
index 83d92b8..c42bfb1 100644
--- a/lib/lp/registry/browser/poll.py
+++ b/lib/lp/registry/browser/poll.py
@@ -18,7 +18,7 @@ __all__ = [
     'TeamPollsView',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.event import notify
 from zope.formlib.widget import CustomWidgetFactory
diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py
index 0fc757f..ad188ec 100644
--- a/lib/lp/registry/browser/product.py
+++ b/lib/lp/registry/browser/product.py
@@ -52,7 +52,7 @@ from lazr.restful.interface import (
     use_template,
     )
 from lazr.restful.interfaces import IJSONRequestCache
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.event import notify
 from zope.formlib import form
diff --git a/lib/lp/registry/browser/productrelease.py b/lib/lp/registry/browser/productrelease.py
index 05439a0..b4a23ba 100644
--- a/lib/lp/registry/browser/productrelease.py
+++ b/lib/lp/registry/browser/productrelease.py
@@ -18,7 +18,7 @@ import mimetypes
 
 from lazr.restful.interface import copy_field
 from lazr.restful.utils import smartquote
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.event import notify
 from zope.formlib.form import FormFields
 from zope.formlib.widget import CustomWidgetFactory
diff --git a/lib/lp/registry/browser/productseries.py b/lib/lp/registry/browser/productseries.py
index 0f28e30..1bf10e7 100644
--- a/lib/lp/registry/browser/productseries.py
+++ b/lib/lp/registry/browser/productseries.py
@@ -29,7 +29,7 @@ __all__ = [
 from operator import attrgetter
 
 from lazr.restful.interface import copy_field
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib import form
 from zope.formlib.widget import CustomWidgetFactory
diff --git a/lib/lp/registry/browser/project.py b/lib/lp/registry/browser/project.py
index 61559c4..233207a 100644
--- a/lib/lp/registry/browser/project.py
+++ b/lib/lp/registry/browser/project.py
@@ -31,7 +31,7 @@ __all__ = [
     ]
 
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.event import notify
 from zope.formlib import form
diff --git a/lib/lp/registry/browser/sourcepackage.py b/lib/lp/registry/browser/sourcepackage.py
index 459c3af..19a6e89 100644
--- a/lib/lp/registry/browser/sourcepackage.py
+++ b/lib/lp/registry/browser/sourcepackage.py
@@ -29,7 +29,7 @@ from lazr.enum import (
     Item,
     )
 from lazr.restful.interface import copy_field
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     adapter,
     getMultiAdapter,
diff --git a/lib/lp/registry/browser/team.py b/lib/lp/registry/browser/team.py
index ba79b6c..73f30c5 100644
--- a/lib/lp/registry/browser/team.py
+++ b/lib/lp/registry/browser/team.py
@@ -44,7 +44,7 @@ from lazr.restful.interfaces import IJSONRequestCache
 from lazr.restful.utils import smartquote
 import pytz
 import simplejson
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.form import (
     Fields,
diff --git a/lib/lp/registry/doc/product-widgets.txt b/lib/lp/registry/doc/product-widgets.txt
index cf09219..b289107 100644
--- a/lib/lp/registry/doc/product-widgets.txt
+++ b/lib/lp/registry/doc/product-widgets.txt
@@ -402,7 +402,7 @@ GhostWidget to suppress the markup.
 Launchpad form macros do not generate table rows for the GhostWidget.
 
     >>> from lp.services.config import config
-    >>> from z3c.ptcompat import ViewPageTemplateFile
+    >>> from zope.browserpage import ViewPageTemplateFile
     >>> from lp.app.browser.launchpadform import LaunchpadFormView
 
     >>> class GhostWidgetView(LaunchpadFormView):
diff --git a/lib/lp/scripts/utilities/warninghandler.py b/lib/lp/scripts/utilities/warninghandler.py
index 026f69e..46b8a73 100644
--- a/lib/lp/scripts/utilities/warninghandler.py
+++ b/lib/lp/scripts/utilities/warninghandler.py
@@ -60,7 +60,7 @@ class ImportantInfo:
         return '\n'.join(L)
 
 # ViewPageTemplateFile has .filename.
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 
 # PythonExpr has .text, the text of the expression.
 from zope.tales.pythonexpr import PythonExpr
diff --git a/lib/lp/services/feeds/feed.py b/lib/lp/services/feeds/feed.py
index 84fd56f..9462062 100644
--- a/lib/lp/services/feeds/feed.py
+++ b/lib/lp/services/feeds/feed.py
@@ -22,7 +22,7 @@ import os
 import time
 from urlparse import urljoin
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.datetime import rfc1123_date
 from zope.interface import implementer
diff --git a/lib/lp/services/profile/profile.py b/lib/lp/services/profile/profile.py
index 7516045..0c7a077 100644
--- a/lib/lp/services/profile/profile.py
+++ b/lib/lp/services/profile/profile.py
@@ -24,7 +24,6 @@ import threading
 
 from bzrlib import lsprof
 import oops_datedir_repo.serializer_rfc822
-from z3c.pt.pagetemplate import PageTemplateFile
 from zope.component import (
     adapter,
     getUtility,
@@ -32,6 +31,7 @@ from zope.component import (
 from zope.contenttype.parse import parse
 from zope.error.interfaces import IErrorReportingUtility
 from zope.exceptions.exceptionformatter import format_exception
+from zope.pagetemplate.pagetemplatefile import PageTemplateFile
 from zope.publisher.interfaces import (
     IEndRequestEvent,
     IStartRequestEvent,
diff --git a/lib/lp/services/webapp/error.py b/lib/lp/services/webapp/error.py
index df592e9..5712962 100644
--- a/lib/lp/services/webapp/error.py
+++ b/lib/lp/services/webapp/error.py
@@ -17,8 +17,8 @@ import httplib
 import sys
 import traceback
 
-from z3c.ptcompat import ViewPageTemplateFile
 from zope.browser.interfaces import ISystemErrorView
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.exceptions.exceptionformatter import format_exception
 from zope.interface import implementer
diff --git a/lib/lp/services/webapp/login.py b/lib/lp/services/webapp/login.py
index b9076b1..30fc146 100644
--- a/lib/lp/services/webapp/login.py
+++ b/lib/lp/services/webapp/login.py
@@ -28,8 +28,8 @@ from paste.httpexceptions import (
     )
 import six
 import transaction
-from z3c.ptcompat import ViewPageTemplateFile
 from zope.authentication.interfaces import IUnauthenticatedPrincipal
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import (
     getSiteManager,
     getUtility,
diff --git a/lib/lp/services/webapp/metazcml.py b/lib/lp/services/webapp/metazcml.py
index ccbb4f5..909fe2d 100644
--- a/lib/lp/services/webapp/metazcml.py
+++ b/lib/lp/services/webapp/metazcml.py
@@ -5,11 +5,11 @@ __metaclass__ = type
 
 import inspect
 
-from z3c.ptcompat.zcml import (
-    page_directive as original_page,
-    pages_directive as original_pages,
-    )
 from zope.app.publication.metaconfigure import publisher
+from zope.browserpage.metaconfigure import (
+    page as original_page,
+    pages as original_pages,
+    )
 import zope.browserpage.metadirectives
 from zope.component import getUtility
 from zope.component.security import PublicPermission
diff --git a/lib/lp/services/webapp/namespace.py b/lib/lp/services/webapp/namespace.py
index 498ec9b..33d15b1 100644
--- a/lib/lp/services/webapp/namespace.py
+++ b/lib/lp/services/webapp/namespace.py
@@ -9,8 +9,8 @@ __all__ = [
     ]
 
 
-from z3c.ptcompat import (
-    bind_template,
+from zope.browserpage.viewpagetemplatefile import (
+    BoundPageTemplate,
     ViewPageTemplateFile,
     )
 from zope.component import getMultiAdapter
@@ -44,7 +44,8 @@ class FormNamespaceView(view):
         if isinstance(context, LaunchpadFormView):
             # Note: without explicitly creating the BoundPageTemplate here
             # the view fails to render.
-            context.index = bind_template(FormNamespaceView.template, context)
+            context.index = BoundPageTemplate(
+                FormNamespaceView.template, context)
         else:
             raise TraversalError("The URL does not correspond to a form.")
 
diff --git a/lib/lp/snappy/browser/widgets/snaparchive.py b/lib/lp/snappy/browser/widgets/snaparchive.py
index e138664..fadd621 100644
--- a/lib/lp/snappy/browser/widgets/snaparchive.py
+++ b/lib/lp/snappy/browser/widgets/snaparchive.py
@@ -9,7 +9,7 @@ __all__ = [
     'SnapArchiveWidget',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import (
     ConversionError,
diff --git a/lib/lp/snappy/browser/widgets/snapbuildchannels.py b/lib/lp/snappy/browser/widgets/snapbuildchannels.py
index fb1e600..8a9b67a 100644
--- a/lib/lp/snappy/browser/widgets/snapbuildchannels.py
+++ b/lib/lp/snappy/browser/widgets/snapbuildchannels.py
@@ -10,7 +10,7 @@ __all__ = [
     'SnapBuildChannelsWidget',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.formlib.interfaces import IInputWidget
 from zope.formlib.utility import setUpWidget
 from zope.formlib.widget import (
diff --git a/lib/lp/snappy/browser/widgets/storechannels.py b/lib/lp/snappy/browser/widgets/storechannels.py
index 2d4d665..0e3e211 100644
--- a/lib/lp/snappy/browser/widgets/storechannels.py
+++ b/lib/lp/snappy/browser/widgets/storechannels.py
@@ -9,7 +9,7 @@ __all__ = [
     'StoreChannelsWidget',
     ]
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.formlib.interfaces import (
     IInputWidget,
     WidgetInputError,
diff --git a/lib/lp/soyuz/browser/sourceslist.py b/lib/lp/soyuz/browser/sourceslist.py
index 228ba8c..29697aa 100644
--- a/lib/lp/soyuz/browser/sourceslist.py
+++ b/lib/lp/soyuz/browser/sourceslist.py
@@ -3,7 +3,7 @@
 
 """Browser views for sources list entries."""
 
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import IInputWidget
 from zope.formlib.utility import setUpWidget
diff --git a/lib/lp/testopenid/browser/server.py b/lib/lp/testopenid/browser/server.py
index 18d4434..c3d540a 100644
--- a/lib/lp/testopenid/browser/server.py
+++ b/lib/lp/testopenid/browser/server.py
@@ -26,8 +26,8 @@ from openid.server.server import (
     Server,
     )
 from openid.store.memstore import MemoryStore
-from z3c.ptcompat import ViewPageTemplateFile
 from zope.authentication.interfaces import IUnauthenticatedPrincipal
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.interface import implementer
 from zope.security.proxy import isinstance as zisinstance
diff --git a/lib/lp/translations/browser/hastranslationimports.py b/lib/lp/translations/browser/hastranslationimports.py
index 0a18d80..fe55038 100644
--- a/lib/lp/translations/browser/hastranslationimports.py
+++ b/lib/lp/translations/browser/hastranslationimports.py
@@ -13,7 +13,7 @@ import datetime
 
 import pytz
 import simplejson
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib import form
 from zope.formlib.widget import CustomWidgetFactory
diff --git a/lib/lp/translations/browser/person.py b/lib/lp/translations/browser/person.py
index bd0e32a..9b2e992 100644
--- a/lib/lp/translations/browser/person.py
+++ b/lib/lp/translations/browser/person.py
@@ -19,7 +19,7 @@ from itertools import islice
 import urllib
 
 import pytz
-from z3c.ptcompat import ViewPageTemplateFile
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import TextWidget
diff --git a/lib/lp/translations/browser/translationmessage.py b/lib/lp/translations/browser/translationmessage.py
index 7442198..c2bdc04 100644
--- a/lib/lp/translations/browser/translationmessage.py
+++ b/lib/lp/translations/browser/translationmessage.py
@@ -25,8 +25,8 @@ import urllib
 
 import pytz
 from six.moves.urllib.parse import parse_qsl
-from z3c.ptcompat import ViewPageTemplateFile
 from zope import datetime as zope_datetime
+from zope.browserpage import ViewPageTemplateFile
 from zope.component import getUtility
 from zope.formlib.interfaces import IInputWidget
 from zope.formlib.utility import setUpWidgets
diff --git a/setup.py b/setup.py
index 2f9ab7a..ba5816e 100644
--- a/setup.py
+++ b/setup.py
@@ -235,8 +235,7 @@ setup(
         'WebOb',
         'WebTest',
         'WSGIProxy2',
-        'z3c.pt',
-        'z3c.ptcompat[zpt]',
+        'z3c.ptcompat',
         'zc.zservertracelog',
         'zope.app.http',
         'zope.app.publication',
diff --git a/utilities/create-lp-wadl-and-apidoc.py b/utilities/create-lp-wadl-and-apidoc.py
index 808c991..c2f92dc 100755
--- a/utilities/create-lp-wadl-and-apidoc.py
+++ b/utilities/create-lp-wadl-and-apidoc.py
@@ -21,8 +21,8 @@ import sys
 import bzrlib
 from bzrlib.branch import Branch
 from lazr.restful.interfaces import IWebServiceConfiguration
-from z3c.ptcompat import PageTemplateFile
 from zope.component import getUtility
+from zope.pagetemplate.pagetemplatefile import PageTemplateFile
 
 from lp.services.scripts import execute_zcml_for_scripts
 from lp.services.webservice.wadl import (
diff --git a/zcml/zopeapp.zcml b/zcml/zopeapp.zcml
index a0a230c..3606c4e 100644
--- a/zcml/zopeapp.zcml
+++ b/zcml/zopeapp.zcml
@@ -18,7 +18,6 @@
   <include package="zope.sendmail" file="meta.zcml" />
   <include package="zope.app.publication" file="meta.zcml" />
   <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
-  <includeOverrides package="z3c.ptcompat" file="meta.zcml" />
 
   <!-- Note that we need to do this early, as later startup
        subscribers may break without fixups -->
@@ -33,7 +32,9 @@
   <include package="zope.session" />
 
   <include package="zope.app.publisher.xmlrpc" />
-  <include package="z3c.pt" />
+
+  <!-- Uncomment this to use Chameleon for page template rendering -->
+  <!-- <include package="z3c.ptcompat" /> -->
 
 
   <!-- selected things from zope.traversing -->