Merge lp:~wgrant/launchpad/bug-640435-minimise-z.a.publisher into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Henning Eggers
Approved revision: no longer in the source branch.
Merged at revision: 11676
Proposed branch: lp:~wgrant/launchpad/bug-640435-minimise-z.a.publisher
Merge into: lp:launchpad
Diff against target: 88 lines (+9/-9)
4 files modified
lib/canonical/launchpad/webapp/metazcml.py (+4/-4)
lib/canonical/lazr/folder.py (+3/-3)
lib/lp/vostok/browser/tests/test_root.py (+1/-1)
zopeapp.zcml (+1/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-640435-minimise-z.a.publisher
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Review via email: mp+37338@code.launchpad.net

Commit message

Include only zope.app.publisher's XML-RPC ZCML, to prevent global registration of the 'manage' view. - landed by henninge

Description of the change

zope.app.publisher's configure.zcml registers a view on * named 'manage'. This unused view shadows objects named 'manage', and it OOPSes because Launchpad doesn't have a zope.ManageContent permission (bug #640435).

Some investigation revealed that the only code we use from zope.app.publisher is its XML-RPC support, and that including just the XML-RPC ZCML in our zopeapp.zcml is sufficient. Gary supports this approach.

I also replaced all deprecated zope.app.publisher imports with imports from their new locations, to make it obvious that we're not actually using much of z.a.p.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

+1

Revision history for this message
Henning Eggers (henninge) wrote :

The code looks good, thanks for doing this.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/webapp/metazcml.py'
2--- lib/canonical/launchpad/webapp/metazcml.py 2010-08-20 20:31:18 +0000
3+++ lib/canonical/launchpad/webapp/metazcml.py 2010-10-02 07:08:50 +0000
4@@ -15,7 +15,7 @@
5 import zope.app.form.browser.metadirectives
6 from zope.app.pagetemplate.engine import TrustedEngine
7 from zope.app.publication.metaconfigure import publisher
8-import zope.app.publisher.browser.metadirectives
9+import zope.browserpage.metadirectives
10 from zope.component import getUtility
11 from zope.component.security import PublicPermission
12 from zope.component.zcml import (
13@@ -439,7 +439,7 @@
14
15
16 class IPageDirective(
17- zope.app.publisher.browser.metadirectives.IPageDirective,
18+ zope.browserpage.metadirectives.IPageDirective,
19 IAssociatedWithAFacet):
20 """Extended browser:page directive to have an extra 'facet' attribute."""
21
22@@ -473,14 +473,14 @@
23
24
25 class IPagesPageSubdirective(
26- zope.app.publisher.browser.metadirectives.IPagesPageSubdirective,
27+ zope.browserpage.metadirectives.IPagesPageSubdirective,
28 IAssociatedWithAFacet):
29 """Extended complex browser:pages directive to have an extra 'facet'
30 attribute on the inner <browser:page> element."""
31
32
33 class IPagesDirective(
34- zope.app.publisher.browser.metadirectives.IPagesDirective,
35+ zope.browserpage.metadirectives.IPagesDirective,
36 IAssociatedWithAFacet):
37 """Extend the complex browser:pages directive to have an extra 'facet'
38 attribute on the outer <browser:pages> element."""
39
40=== modified file 'lib/canonical/lazr/folder.py'
41--- lib/canonical/lazr/folder.py 2009-06-25 05:30:52 +0000
42+++ lib/canonical/lazr/folder.py 2010-10-02 07:08:50 +0000
43@@ -13,16 +13,16 @@
44 import re
45 import time
46
47-from zope.interface import implements
48+from zope.browserresource.file import setCacheControl
49 from zope.contenttype import guess_content_type
50 from zope.datetime import rfc1123_date
51-from zope.app.publisher.browser.fileresource import setCacheControl
52+from zope.interface import implements
53 from zope.publisher.interfaces.browser import IBrowserPublisher
54 from zope.publisher.interfaces import NotFound
55
56
57 class File:
58- # Copied from zope.app.publisher.fileresource, which
59+ # Copied from zope.browserresource.file, which
60 # unbelievably throws away the file data, and isn't
61 # useful extensible.
62 #
63
64=== modified file 'lib/lp/vostok/browser/tests/test_root.py'
65--- lib/lp/vostok/browser/tests/test_root.py 2010-09-25 14:29:32 +0000
66+++ lib/lp/vostok/browser/tests/test_root.py 2010-10-02 07:08:50 +0000
67@@ -8,7 +8,7 @@
68 import os
69 import unittest
70
71-from zope.app.publisher.browser import getDefaultViewName
72+from zope.publisher.defaultview import getDefaultViewName
73
74 from canonical.launchpad.testing.pages import (
75 extract_text,
76
77=== modified file 'zopeapp.zcml'
78--- zopeapp.zcml 2010-07-21 09:56:38 +0000
79+++ zopeapp.zcml 2010-10-02 07:08:50 +0000
80@@ -38,7 +38,7 @@
81 <!--
82 <include package="zope.app.container" />
83 -->
84- <include package="zope.app.publisher" />
85+ <include package="zope.app.publisher.xmlrpc" />
86
87 <include package="zope.app.publication" file="meta.zcml" />
88 <!-- We don't need any of the default publications. -->