~barry/ubuntu/natty/lazr.restful/bug-759205

« back to all changes in this revision

Viewing changes to src/lazr/restful/example/base/tests/wadl.txt

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2010-06-28 10:11:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100628101111-a00pkffnva3y87q9
Tags: 0.9.29-0ubuntu1
new upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
format. These documents are similar to the HTML documents that provide
7
7
human beings with links to click and forms to fill out.
8
8
 
9
 
===============
10
9
Entry resources
11
10
===============
12
11
 
103
102
document that says "The resource at this URL is of type [foo]," where
104
103
[foo] is a reference to another WADL document.
105
104
 
106
 
====================
107
105
Collection resources
108
106
====================
109
107
 
137
135
    >>> resource.attrib['type']
138
136
    'http://...#cookbooks'
139
137
 
140
 
===========================
141
138
Scoped collection resources
142
139
===========================
143
140
 
165
162
    >>> resource.attrib['type']
166
163
    'http://...#recipe-page-resource'
167
164
 
168
 
=====================
169
165
Hosted file resources
170
166
=====================
171
167
 
224
220
    >>> resource.attrib['type']
225
221
    'http://...#HostedFile'
226
222
 
227
 
================
228
223
The service root
229
224
================
230
225
 
257
252
located here are the descriptions of the JSON representations those
258
253
resources serve.
259
254
 
260
 
======================================
261
 
Description of the service root itself
262
 
======================================
263
 
 
264
 
Let's whittle down the complexity a little by taking a look at the
265
 
description of the service root resource itself.
 
255
Description of the full service
 
256
--------------------------------
 
257
 
 
258
The first two tags in the WADL file are human-readable documentation
 
259
for the entire web service.
 
260
 
266
261
 
267
262
    >>> from lxml.etree import _Comment
268
263
    >>> children = [child for child in tree
269
264
    ...             if not isinstance(child, _Comment)]
270
 
    >>> resources, service_root_type, service_root_repr = children[:3]
 
265
 
 
266
    >>> service_doc, version_doc = children[:2]
 
267
    >>> print service_doc.attrib['title']
 
268
    About this service
 
269
    >>> for p_tag in service_doc:
 
270
    ...     print p_tag.text
 
271
    This is a web service.
 
272
    It's got resources!
 
273
 
 
274
    >>> print version_doc.attrib['title']
 
275
    About version devel
 
276
    >>> for p_tag in version_doc:
 
277
    ...     print p_tag.text
 
278
    The unstable development version.
 
279
    Don't use this unless you like changing things.
 
280
 
 
281
Description of the service root itself
 
282
--------------------------------------
 
283
 
 
284
Let's whittle down the complexity a little more by taking a look at
 
285
the description of the service root resource itself.
 
286
 
 
287
    >>> resources, service_root_type, service_root_repr = children[2:5]
271
288
    >>> # We'll deal with the rest of the children later.
272
 
    >>> other_children = children[3:]
 
289
    >>> other_children = children[5:]
273
290
 
274
291
The service root is an instance of a special resource type that
275
292
responds only to GET.
397
414
Aha! There's a resource of type "service-root" right there at the
398
415
service root! Who would have thought?
399
416
 
400
 
========================
401
417
The rest of the document
402
418
========================
403
419