Merge lp:~leonardr/launchpad/multiversion-apidoc into lp:launchpad/db-devel
| Status: | Merged |
|---|---|
| Approved by: | Aaron Bentley on 2010-03-15 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~leonardr/launchpad/multiversion-apidoc |
| Merge into: | lp:launchpad/db-devel |
| Prerequisite: | lp:~leonardr/launchpad/no-mutator-named-operations |
| Diff against target: |
1156 lines (+535/-157) 21 files modified
.bzrignore (+2/-2) Makefile (+5/-9) lib/canonical/buildd/debian/launchpad-buildd.init (+1/-1) lib/canonical/launchpad/pagetests/webservice/apidoc.txt (+17/-3) lib/canonical/launchpad/pagetests/webservice/multiversion.txt (+32/-0) lib/canonical/launchpad/rest/configuration.py (+21/-0) lib/canonical/launchpad/webapp/tests/test_servers.py (+1/-1) lib/lp/bugs/stories/webservice/xx-bug.txt (+9/-40) lib/lp/buildmaster/interfaces/buildfarmjobbehavior.py (+1/-1) lib/lp/buildmaster/model/buildfarmjobbehavior.py (+94/-10) lib/lp/buildmaster/tests/test_buildfarmjobbehavior.py (+80/-8) lib/lp/code/model/recipebuilder.py (+11/-2) lib/lp/scripts/utilities/apiindex.py (+0/-21) lib/lp/soyuz/doc/buildd-slavescanner.txt (+4/-3) lib/lp/testing/factory.py (+87/-40) lib/lp/translations/doc/translationtemplatesbuildbehavior.txt (+41/-12) lib/lp/translations/model/translationtemplatesbuildbehavior.py (+17/-1) lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py (+37/-0) utilities/apidoc-index.pt (+37/-0) utilities/create-lp-wadl-and-apidoc.py (+35/-0) versions.cfg (+3/-3) |
| To merge this branch: | bzr merge lp:~leonardr/launchpad/multiversion-apidoc |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2010-03-11 | Approve on 2010-03-15 | |
|
Review via email:
|
|||
Description of the Change
This branch makes Launchpad generate an HTML apidoc for every version of the web service, not just the devel version. The apidoc for version "foo" is written to lib/canonical/
This branch renames create-lp-wadl.py to create-
I would really like feedback on the following issues:
1. Is there a way to put apidoc-index.pt somewhere else? Maybe in lib/canonical/
2. Is there a way to look up config/
This branch still needs a little bit of work--I need to fix up the apidoc test so it tests the new system.
| Leonard Richardson (leonardr) wrote : | # |
| Leonard Richardson (leonardr) wrote : | # |
One test on EC2 failed: the title of the generated apidoc is now "About this service", not "Launchpad Web Service API". Our XSLT stylesheet (which is based on Mark Nottingham's general WADL stylesheet) has this code:
Previously the WADL's <application> tag had no <doc> children, so we used the default. Now there are two <doc> tags, "About this service" and "About version {version}".
This is actually pretty nice; I was afraid I would have to hack the XSLT to add the <doc> tags to the HTML, but it already processes them. The only problem is that the XSLT stylesheet uses the title of the first <doc> tag as the title of the whole document, and ignores the title of all subsequent <doc> tags. I was hoping for this (#1):
---
<h1>Launchpad Web Service API</h1>
<h2>About this service</h2>
The Launchpad web service allows automated clients to access most of the functionality available on the Launchpad web site. For help getting started, see the help wiki.
<h2>About version beta</h2>
This is the first version of the web service ever published. Its end-of-life date is April 2011, the same as the Ubuntu release "Karmic Koala".
---
And upon reflection I think this would be even better (#2):
---
<h1>Launchpad web service, version beta</h1>
The Launchpad web service allows automated clients to access most of the functionality available on the Launchpad web site. For help getting started, see the help wiki.
This is the first version of the web service ever published. Its end-of-life date is April 2011, the same as the Ubuntu release "Karmic Koala".
---
Instead, we have this (#3):
---
<h1>About this service</h1>
The Launchpad web service allows automated clients to access most of the functionality available on the Launchpad web site. For help getting started, see the help wiki.
This is the first version of the web service ever published. Its end-of-life date is April 2011, the same as the Ubuntu release "Karmic Koala".
---
We can change the stylesheet to get #1 and change lazr.restful to get #2. But I think what we have now is good enough that I can file a bug and come back to fix the generated documentation later. What do you think?
| Leonard Richardson (leonardr) wrote : | # |
And here's another diff against the precursor branch: http://
| Aaron Bentley (abentley) wrote : | # |
Please use extract_text if possible. Otherwise, this looks fine.
| Gary Poster (gary) wrote : | # |
Leonard asked me to take a look at this because of his two specific questions.
1. Is there a way to put apidoc-index.pt somewhere else? Maybe in lib/canonical/
The FilePageTemplate just expects a path. I'm relatively confident that you can use os.path fun, combined with module __file__ fun, to do what you describe. However, as we agreed on IRC, I'm fine with what you are doing now.
2. Is there a way to look up config/
The infrequently used syntax for this is "?," I believe. In other words, if you have a variable named "config" and a variable named "version" that contains the string "beta", "config/
On a separate note, also as we discussed on IRC, this segment from create-
1115 + # Finally, create an index.html with links to all the HTML
1116 + # documentation files we just generated.
1117 + template_file = 'apidoc-index.pt'
1118 + template = PageTemplateFil
1119 + namespace = template.
1120 + namespace['config'] = config
1121 + versions_
1122 + for version in config.
1123 + versions_
1124 + dict(version=
1125 + description=
1126 + namespace[
1127 +
1128 + f = open(os.
1129 + f.write(
This could be simplified to the following:
template_file = 'apidoc-index.pt'
template = PageTemplateFil
versions_
for version in config.
f = open(os.
f.write(
Then in your template you would access config and versions_
If you use the ? syntax I mentioned above for options/
template_file = 'apidoc-index.pt'
template = PageTemplateFil
f = open(os.
f.write(
That's way nicer, I think.

The diff is screwed up due to the precursor branch being out-of-date, but here's a paste: http:// pastebin. ubuntu. com/393568/