Gael Pasgrimaud committed e563c45

add contents to doc

Comments (0)

Files changed (2)


 It can be used for many purposes, one idea that I might try in the future is to
 use it for templating with pure http templates that you modify using pyquery.
+.. contents::
 You can use the PyQuery class to load an xml document from a string, a lxml
 document, from a file or from an url::
     >>> p.text()
     'you know Python rocks'
 You can play with the attributes with the jquery API::
     >>> p.attr("id")
     >>> p.attr.class_ = 'hello'
 You can also play with css classes::
     >>> p.addClass("toto")
     'font-size: 17px'
 You can also add content to the end of tags::
     >>> d('p').append('check out <a href=""><span>reddit</span></a>')
     >>> print pq('<div>Yeah !</div>').addClass('myclass') + pq('<b>cool</b>')
     <div class="myclass">Yeah !</div><b>cool</b>
 .. fake imports
     >>> from ajax import PyQuery as pq
-You can query some wsgi app if WebOb is installed (it's not a pyquery
+You can query some wsgi app if `WebOb`_ is installed (it's not a pyquery
 dependencie). IN this example the test app returns a simple input at `/` and a
 submit button at `/submit`::
     >>> print d
     <form><input name="youyou" type="text" value=""/><input type="submit" value="OK"/></form>
+If `Paste`_ is installed, you are able to get url directly with a `Proxy`_ app::
+    >>> a = d.get('')
+    >>> a
+    [<html>]
+You can retrieve the app response::
+    >>> print a.response.status
+    301 Moved Permanently
+The response attribute is a `WebOb`_ `Response`_
+.. _webob:
+.. _response:
+.. _paste:
+.. _proxy:
 If you want to run the tests that you can see above you should do::
+    $ hg clone
+    $ cd pyquery
     $ python
     $ bin/buildout
     $ bin/test
+Other documentations
 For more documentation about the API use the jquery website
 The reference I'm now using for the API is ... the color cheat sheet
         if 'response' in kwargs:
             self.response = kwargs.pop('response')
-            self.response = Response()
+            self.response = no_default
         if 'app' in kwargs:
    = kwargs.pop('app')
             if len(args) == 0: