Commits

Gael Pasgrimaud committed e563c45

add contents to doc

Comments (0)

Files changed (2)

pyquery/README.txt

 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::
+
+Usage
+-----
+
 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'
 
+Attributes
+----------
+
 You can play with the attributes with the jquery API::
 
     >>> p.attr("id")
     'hello2'
     >>> p.attr.class_ = 'hello'
 
+CSS
+---
+
 You can also play with css classes::
 
     >>> p.addClass("toto")
     >>> p.attr.style
     'font-size: 17px'
 
+Manipulating
+------------
+
 You can also add content to the end of tags::
 
     >>> d('p').append('check out <a href="http://reddit.com/r/python"><span>reddit</span></a>')
     >>> print pq('<div>Yeah !</div>').addClass('myclass') + pq('<b>cool</b>')
     <div class="myclass">Yeah !</div><b>cool</b>
 
+
+AJAX
+----
+
 .. 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('https://bitbucket.org/olauzanne/pyquery/')
+    >>> a
+    [<html>]
+
+You can retrieve the app response::
+
+    >>> print a.response.status
+    301 Moved Permanently
+
+The response attribute is a `WebOb`_ `Response`_
+
+.. _webob: http://pythonpaste.org/webob/
+.. _response: http://pythonpaste.org/webob/#response
+.. _paste: http://pythonpaste.org/
+.. _proxy: http://pythonpaste.org/modules/proxy.html#paste.proxy.Proxy
+
+Testing
+-------
+
 If you want to run the tests that you can see above you should do::
 
+    $ hg clone https://bitbucket.org/olauzanne/pyquery/
+    $ cd pyquery
     $ python bootstrap.py
     $ bin/buildout
     $ bin/test
 
+Other documentations
+--------------------
+
 For more documentation about the API use the jquery website http://docs.jquery.com/
 
 The reference I'm now using for the API is ... the color cheat sheet
         if 'response' in kwargs:
             self.response = kwargs.pop('response')
         else:
-            self.response = Response()
+            self.response = no_default
         if 'app' in kwargs:
             self.app = kwargs.pop('app')
             if len(args) == 0: