Merge lp:~gary/launchpad/apidoc into lp:launchpad

Proposed by Gary Poster on 2010-07-24
Status: Merged
Approved by: Aaron Bentley on 2010-07-26
Approved revision: no longer in the source branch.
Merged at revision: 11235
Proposed branch: lp:~gary/launchpad/apidoc
Merge into: lp:launchpad
Diff against target: 143 lines (+60/-9)
3 files modified
configs/development/apidoc-configure-normal.zcml (+36/-4)
lib/canonical/launchpad/security.py (+15/-2)
lib/lp/services/doc/sprites.txt (+9/-3)
To merge this branch: bzr merge lp:~gary/launchpad/apidoc
Reviewer Review Type Date Requested Status
Aaron Bentley (community) 2010-07-24 Approve on 2010-07-26
Review via email: mp+30849@code.launchpad.net

Commit Message

Fix the integration of the "Book" section of the apidoc.

Description of the Change

This branch fixes the integration of the "Book" section of the apidoc.

In order to show its potential usefulness, I added a few files in the Launchpad tree that actually seemed like reasonably up-to-date documentation. I'm hoping we can expose some of the lazr.restful documents soon as well, and perhaps, when we make a static version of this, this can be a place to aggregate and publish the files in the tree that we actually consider to be documentation.

I fixed up some ReST in a fly-by, so that it would render nicely in the browser.

I also changed the apidoc-specific permissions to be a bit more careful: only allow them when we are in devmode. I considered moving them out to a separate module so that they could be grokked only when the apidoc zcml is parsed, but did not do it, both because of inertia and because of no clear location for such a file.

When I added a couple of module inclusions in the apidoc zcml, I reordered the includes to put the meta files first, as is usually done.

To post a comment you must log in.
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configs/development/apidoc-configure-normal.zcml'
2--- configs/development/apidoc-configure-normal.zcml 2010-07-23 19:17:41 +0000
3+++ configs/development/apidoc-configure-normal.zcml 2010-07-26 19:26:46 +0000
4@@ -69,15 +69,18 @@
5 <!-- Turn on devmode for the following includes to work -->
6 <meta:provides feature="devmode" />
7
8- <include package="zope.location" />
9- <include package="zope.app.applicationcontrol" />
10- <include package="zope.app.renderer" />
11 <include package="zope.app.preference" file="meta.zcml" />
12 <include package="zope.app.apidoc.codemodule" file="meta.zcml" />
13 <include package="zope.app.apidoc.bookmodule" file="meta.zcml" />
14+ <include package="zope.app.onlinehelp" file="meta.zcml" />
15+
16+ <include package="zope.app.apidoc" />
17+ <include package="zope.app.applicationcontrol" />
18+ <include package="zope.app.onlinehelp" />
19 <include package="zope.app.preference" />
20+ <include package="zope.app.renderer" />
21 <include package="zope.app.tree" />
22- <include package="zope.app.apidoc" />
23+ <include package="zope.location" />
24
25 <apidoc:rootModule module="canonical" />
26 <apidoc:rootModule module="lp" />
27@@ -90,4 +93,33 @@
28 <apidoc:rootModule module="bzrlib" />
29 <apidoc:rootModule module="storm" />
30
31+ <apidoc:bookchapter
32+ id="lp"
33+ title="Launchpad"
34+ />
35+ <apidoc:bookchapter
36+ id="dbpolicy"
37+ title="Storm Stores and Database Policies"
38+ doc_path="../../lib/canonical/launchpad/doc/db-policy.txt"
39+ parent="lp"
40+ />
41+ <apidoc:bookchapter
42+ id="memcachetales"
43+ title="Memcache Tales Expressions"
44+ doc_path="../../lib/lp/services/memcache/doc/tales-cache.txt"
45+ parent="lp"
46+ />
47+ <apidoc:bookchapter
48+ id="sprites"
49+ title="Image Sprites"
50+ doc_path="../../lib/lp/services/doc/sprites.txt"
51+ parent="lp"
52+ />
53+ <apidoc:bookchapter
54+ id="buildout"
55+ title="Buildout"
56+ doc_path="../../doc/buildout.txt"
57+ parent="lp"
58+ />
59+
60 </configure>
61
62=== modified file 'lib/canonical/launchpad/security.py'
63--- lib/canonical/launchpad/security.py 2010-07-26 19:13:49 +0000
64+++ lib/canonical/launchpad/security.py 2010-07-26 19:26:46 +0000
65@@ -11,6 +11,7 @@
66 from zope.interface import implements, Interface
67 from zope.component import getAdapter, getUtility
68
69+from canonical.config import config
70 from canonical.launchpad.interfaces.account import IAccount
71 from canonical.launchpad.interfaces.emailaddress import IEmailAddress
72 from canonical.launchpad.interfaces.librarian import (
73@@ -1087,10 +1088,12 @@
74 usedfor = Interface
75
76 def checkUnauthenticated(self):
77- return True
78+ # We only want this permission to work at all for devmode.
79+ return config.devmode
80
81 def checkAuthenticated(self, user):
82- return True
83+ # We only want this permission to work at all for devmode.
84+ return config.devmode
85
86
87 class ManageApplicationForEverybody(UseApiDoc):
88@@ -1103,6 +1106,16 @@
89 usedfor = Interface
90
91
92+class ZopeViewForEverybody(UseApiDoc):
93+ """This is just to please apidoc.launchpad.dev.
94+
95+ We do this because zope.app.apidoc uses that permission, but nothing else
96+ should be using it.
97+ """
98+ permission = 'zope.View'
99+ usedfor = Interface
100+
101+
102 class OnlyBazaarExpertsAndAdmins(AuthorizationBase):
103 """Base class that allows only the Launchpad admins and Bazaar
104 experts."""
105
106=== modified file 'lib/lp/services/doc/sprites.txt'
107--- lib/lp/services/doc/sprites.txt 2010-02-11 04:55:23 +0000
108+++ lib/lp/services/doc/sprites.txt 2010-07-26 19:26:46 +0000
109@@ -6,13 +6,15 @@
110 view a page. An individual sprite is displayed as a background image
111 on an element by setting the background position.
112
113-A new image can be added to the combined file with the command:
114+A new image can be added to the combined file with the command::
115+
116 make sprite_image
117
118 The resulting icon-sprites and icon-sprites.positioning files must
119 be committed to the repository. Any changes to the CSS template will
120 be automatically picked up when Launchpad is restarted. If you don't
121-want to restart launchpad.dev, you can run:
122+want to restart launchpad.dev, you can run::
123+
124 make css_combine
125
126
127@@ -23,11 +25,15 @@
128 indicating that the background-image for a given rule should be
129 added to the combined image file and the rule should be updated.
130
131-For example:
132+For example::
133+
134 .add {
135 background-image: url(/@@/edit.png); /* sprite-ref: group1 */
136 }
137+
138 would become
139+::
140+
141 .add {
142 background-image: url(foo/combined_image.png);
143 background-position: 0px 234px;