git.fiddlerwoaroof.com
Browse code

initial commit

Ed L authored on 26/05/2011 21:47:40
Showing 48 changed files
... ...
@@ -1,3 +1,4 @@
1 1
 CVS
2 2
 .cvsignore
3 3
 *.pyc
4
+KEEPME
4 5
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+Copyright (c) 2011 Edward Langley
2
+All rights reserved.
3
+
4
+Redistribution and use in source and binary forms, with or without
5
+modification, are permitted provided that the following conditions
6
+are met:
7
+
8
+Redistributions of source code must retain the above copyright notice,
9
+this list of conditions and the following disclaimer.
10
+
11
+Redistributions in binary form must reproduce the above copyright
12
+notice, this list of conditions and the following disclaimer in the
13
+documentation and/or other materials provided with the distribution.
14
+
15
+Neither the name of the project's author nor the names of its
16
+contributors may be used to endorse or promote products derived from
17
+this software without specific prior written permission.
18
+
19
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+
0 32
new file mode 100644
... ...
@@ -0,0 +1,35 @@
1
+# $Id: __init__.py,v 1.2 2011/05/20 10:15:33 irees Exp $
2
+
3
+#  
4
+#  Copyright (c) 2011 Edward Langley
5
+#  All rights reserved.
6
+#  
7
+#  Redistribution and use in source and binary forms, with or without
8
+#  modification, are permitted provided that the following conditions
9
+#  are met:
10
+#  
11
+#  Redistributions of source code must retain the above copyright notice,
12
+#  this list of conditions and the following disclaimer.
13
+#  
14
+#  Redistributions in binary form must reproduce the above copyright
15
+#  notice, this list of conditions and the following disclaimer in the
16
+#  documentation and/or other materials provided with the distribution.
17
+#  
18
+#  Neither the name of the project's author nor the names of its
19
+#  contributors may be used to endorse or promote products derived from
20
+#  this software without specific prior written permission.
21
+#  
22
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+#  
34
+#
35
+__version__ = "$Revision: 1.2 $".split(":")[1][:-1].strip()
0 36
new file mode 100644
... ...
@@ -0,0 +1,161 @@
1
+# Makefile for Sphinx documentation
2
+#  
3
+#  Copyright (c) 2011 Edward Langley
4
+#  All rights reserved.
5
+#  
6
+#  Redistribution and use in source and binary forms, with or without
7
+#  modification, are permitted provided that the following conditions
8
+#  are met:
9
+#  
10
+#  Redistributions of source code must retain the above copyright notice,
11
+#  this list of conditions and the following disclaimer.
12
+#  
13
+#  Redistributions in binary form must reproduce the above copyright
14
+#  notice, this list of conditions and the following disclaimer in the
15
+#  documentation and/or other materials provided with the distribution.
16
+#  
17
+#  Neither the name of the project's author nor the names of its
18
+#  contributors may be used to endorse or promote products derived from
19
+#  this software without specific prior written permission.
20
+#  
21
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+#  
33
+#
34
+
35
+# You can set these variables from the command line.
36
+SPHINXOPTS    =
37
+SPHINXBUILD   = sphinx-build
38
+PAPER         =
39
+BUILDDIR      = build
40
+
41
+# Internal variables.
42
+PAPEROPT_a4     = -D latex_paper_size=a4
43
+PAPEROPT_letter = -D latex_paper_size=letter
44
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
45
+
46
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
47
+
48
+help:
49
+	@echo "Please use \`make <target>' where <target> is one of"
50
+	@echo "  html       to make standalone HTML files"
51
+	@echo "  dirhtml    to make HTML files named index.html in directories"
52
+	@echo "  singlehtml to make a single large HTML file"
53
+	@echo "  pickle     to make pickle files"
54
+	@echo "  json       to make JSON files"
55
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
56
+	@echo "  qthelp     to make HTML files and a qthelp project"
57
+	@echo "  devhelp    to make HTML files and a Devhelp project"
58
+	@echo "  epub       to make an epub"
59
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
60
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
61
+	@echo "  text       to make text files"
62
+	@echo "  man        to make manual pages"
63
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
64
+	@echo "  linkcheck  to check all external links for integrity"
65
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
66
+
67
+clean:
68
+	-rm -rf $(BUILDDIR)/*
69
+
70
+html:
71
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
72
+	@echo
73
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
74
+
75
+dirhtml:
76
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
77
+	@echo
78
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
79
+
80
+singlehtml:
81
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
82
+	@echo
83
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
84
+
85
+pickle:
86
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
87
+	@echo
88
+	@echo "Build finished; now you can process the pickle files."
89
+
90
+json:
91
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
92
+	@echo
93
+	@echo "Build finished; now you can process the JSON files."
94
+
95
+htmlhelp:
96
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
97
+	@echo
98
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
99
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
100
+
101
+qthelp:
102
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
103
+	@echo
104
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
105
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
106
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/JSONRPC.qhcp"
107
+	@echo "To view the help file:"
108
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/JSONRPC.qhc"
109
+
110
+devhelp:
111
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
112
+	@echo
113
+	@echo "Build finished."
114
+	@echo "To view the help file:"
115
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/JSONRPC"
116
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/JSONRPC"
117
+	@echo "# devhelp"
118
+
119
+epub:
120
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
121
+	@echo
122
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
123
+
124
+latex:
125
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
126
+	@echo
127
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
128
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
129
+	      "(use \`make latexpdf' here to do that automatically)."
130
+
131
+latexpdf:
132
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
133
+	@echo "Running LaTeX files through pdflatex..."
134
+	make -C $(BUILDDIR)/latex all-pdf
135
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
136
+
137
+text:
138
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
139
+	@echo
140
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
141
+
142
+man:
143
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
144
+	@echo
145
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
146
+
147
+changes:
148
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
149
+	@echo
150
+	@echo "The overview file is in $(BUILDDIR)/changes."
151
+
152
+linkcheck:
153
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
154
+	@echo
155
+	@echo "Link check complete; look for any errors in the above output " \
156
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
157
+
158
+doctest:
159
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
160
+	@echo "Testing of doctests in the sources finished, look at the " \
161
+	      "results in $(BUILDDIR)/doctest/output.txt."
1 163
new file mode 100644
2 164
Binary files /dev/null and b/doc/build/doctrees/environment.pickle differ
3 165
new file mode 100644
4 166
Binary files /dev/null and b/doc/build/doctrees/index.doctree differ
5 167
new file mode 100644
6 168
Binary files /dev/null and b/doc/build/doctrees/jsonutil.doctree differ
7 169
new file mode 100644
8 170
Binary files /dev/null and b/doc/build/doctrees/proxy.doctree differ
9 171
new file mode 100644
10 172
Binary files /dev/null and b/doc/build/doctrees/server.doctree differ
11 173
new file mode 100644
... ...
@@ -0,0 +1,4 @@
1
+# Sphinx build info version 1
2
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3
+config: 704c958239868dec115297de7630885e
4
+tags: fbb0d17656682115ca4d033fb2f83ba1
0 5
new file mode 100644
... ...
@@ -0,0 +1,91 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>Overview: module code &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '../',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="../_static/jquery.js"></script>
23
+    <script type="text/javascript" src="../_static/underscore.js"></script>
24
+    <script type="text/javascript" src="../_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="../index.html" /> 
26
+  </head>
27
+  <body>
28
+    <div class="related">
29
+      <h3>Navigation</h3>
30
+      <ul>
31
+        <li class="right" style="margin-right: 10px">
32
+          <a href="../genindex.html" title="General Index"
33
+             accesskey="I">index</a></li>
34
+        <li class="right" >
35
+          <a href="../py-modindex.html" title="Python Module Index"
36
+             >modules</a> |</li>
37
+        <li><a href="../index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
38
+      </ul>
39
+    </div>  
40
+
41
+    <div class="document">
42
+      <div class="documentwrapper">
43
+        <div class="bodywrapper">
44
+          <div class="body">
45
+            
46
+  <h1>All modules for which code is available</h1>
47
+<ul><li><a href="jsonrpc/jsonutil.html">jsonrpc.jsonutil</a></li>
48
+<li><a href="jsonrpc/proxy.html">jsonrpc.proxy</a></li>
49
+<li><a href="jsonrpc/server.html">jsonrpc.server</a></li>
50
+</ul>
51
+
52
+          </div>
53
+        </div>
54
+      </div>
55
+      <div class="sphinxsidebar">
56
+        <div class="sphinxsidebarwrapper">
57
+<div id="searchbox" style="display: none">
58
+  <h3>Quick search</h3>
59
+    <form class="search" action="../search.html" method="get">
60
+      <input type="text" name="q" size="18" />
61
+      <input type="submit" value="Go" />
62
+      <input type="hidden" name="check_keywords" value="yes" />
63
+      <input type="hidden" name="area" value="default" />
64
+    </form>
65
+    <p class="searchtip" style="font-size: 90%">
66
+    Enter search terms or a module, class or function name.
67
+    </p>
68
+</div>
69
+<script type="text/javascript">$('#searchbox').show(0);</script>
70
+        </div>
71
+      </div>
72
+      <div class="clearer"></div>
73
+    </div>
74
+    <div class="related">
75
+      <h3>Navigation</h3>
76
+      <ul>
77
+        <li class="right" style="margin-right: 10px">
78
+          <a href="../genindex.html" title="General Index"
79
+             >index</a></li>
80
+        <li class="right" >
81
+          <a href="../py-modindex.html" title="Python Module Index"
82
+             >modules</a> |</li>
83
+        <li><a href="../index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
84
+      </ul>
85
+    </div>
86
+    <div class="footer">
87
+        &copy; Copyright 2011, Edward Langley.
88
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
89
+    </div>
90
+  </body>
91
+</html>
0 92
\ No newline at end of file
1 93
new file mode 100644
... ...
@@ -0,0 +1,145 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>jsonrpc.jsonutil &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '../../',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="../../_static/jquery.js"></script>
23
+    <script type="text/javascript" src="../../_static/underscore.js"></script>
24
+    <script type="text/javascript" src="../../_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="../../index.html" />
26
+    <link rel="up" title="Module code" href="../index.html" /> 
27
+  </head>
28
+  <body>
29
+    <div class="related">
30
+      <h3>Navigation</h3>
31
+      <ul>
32
+        <li class="right" style="margin-right: 10px">
33
+          <a href="../../genindex.html" title="General Index"
34
+             accesskey="I">index</a></li>
35
+        <li class="right" >
36
+          <a href="../../py-modindex.html" title="Python Module Index"
37
+             >modules</a> |</li>
38
+        <li><a href="../../index.html">JSONRPC v1.0 documentation</a> &raquo;</li>
39
+          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
40
+      </ul>
41
+    </div>  
42
+
43
+    <div class="document">
44
+      <div class="documentwrapper">
45
+        <div class="bodywrapper">
46
+          <div class="body">
47
+            
48
+  <h1>Source code for jsonrpc.jsonutil</h1><div class="highlight"><pre>
49
+<span class="c"># $Id: jsonutil.py,v 1.2 2011/05/26 19:34:19 edwlan Exp $</span>
50
+<span class="sd">&quot;&quot;&quot;</span>
51
+<span class="sd">This module is primarily a wrapper around simplejson in order to make</span>
52
+<span class="sd">it behave like demjson</span>
53
+
54
+<span class="sd">- If an object being encoded has a &#39;json_equivalent&#39; attribute, that will be called to get a (more)</span>
55
+<span class="sd">	serializable object</span>
56
+
57
+<span class="sd">- if it has an &#39;items&#39; method, it will be called</span>
58
+<span class="sd">	- if it defines both items and iteritems, the second will be used)</span>
59
+
60
+<span class="sd">- if it is iterable, it will be made into a list</span>
61
+
62
+<span class="sd">- otherwise &#39;str&#39; will be called on the object, and that result will be used</span>
63
+<span class="sd">&quot;&quot;&quot;</span>
64
+<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;encode&#39;</span><span class="p">,</span> <span class="s">&#39;decode&#39;</span><span class="p">]</span>
65
+
66
+<span class="kn">import</span> <span class="nn">functools</span>
67
+
68
+<span class="k">try</span><span class="p">:</span>
69
+	<span class="kn">import</span> <span class="nn">json</span>
70
+<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
71
+	<span class="kn">import</span> <span class="nn">simplejson</span> <span class="kn">as</span> <span class="nn">json</span>
72
+
73
+
74
+<span class="k">def</span> <span class="nf">dict_encode</span><span class="p">(</span><span class="n">obj</span><span class="p">):</span>
75
+	<span class="n">items</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s">&#39;iteritems&#39;</span><span class="p">,</span> <span class="n">obj</span><span class="o">.</span><span class="n">items</span><span class="p">)</span>
76
+	<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span> <span class="p">(</span><span class="n">encode_</span><span class="p">(</span><span class="n">k</span><span class="p">),</span><span class="n">encode_</span><span class="p">(</span><span class="n">v</span><span class="p">))</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">items</span><span class="p">()</span> <span class="p">)</span>
77
+
78
+<span class="k">def</span> <span class="nf">list_encode</span><span class="p">(</span><span class="n">obj</span><span class="p">):</span>
79
+	<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">encode_</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">obj</span><span class="p">)</span>
80
+
81
+<span class="k">def</span> <span class="nf">safe_encode</span><span class="p">(</span><span class="n">obj</span><span class="p">):</span>
82
+	<span class="sd">&#39;&#39;&#39;Always return something, even if it is useless for serialization&#39;&#39;&#39;</span>
83
+	<span class="k">try</span><span class="p">:</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
84
+	<span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span> <span class="n">obj</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
85
+	<span class="k">return</span> <span class="n">obj</span>
86
+
87
+<span class="k">def</span> <span class="nf">encode_</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">):</span>
88
+	<span class="n">obj</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s">&#39;json_equivalent&#39;</span><span class="p">,</span> <span class="k">lambda</span><span class="p">:</span> <span class="n">obj</span><span class="p">)()</span>
89
+	<span class="n">func</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span>
90
+	<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s">&#39;items&#39;</span><span class="p">):</span>
91
+		<span class="n">func</span> <span class="o">=</span> <span class="n">dict_encode</span>
92
+	<span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s">&#39;__iter__&#39;</span><span class="p">):</span>
93
+		<span class="n">func</span> <span class="o">=</span> <span class="n">list_encode</span>
94
+	<span class="k">else</span><span class="p">:</span>
95
+		<span class="n">func</span> <span class="o">=</span> <span class="n">safe_encode</span>
96
+	<span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
97
+
98
+
99
+<span class="n">encode</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">partial</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">encode_</span><span class="p">)</span>
100
+<span class="n">decode</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">loads</span>
101
+
102
+<span class="n">__version__</span> <span class="o">=</span> <span class="s">&quot;$Revision: 1.2 $&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;:&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
103
+</pre></div>
104
+
105
+          </div>
106
+        </div>
107
+      </div>
108
+      <div class="sphinxsidebar">
109
+        <div class="sphinxsidebarwrapper">
110
+<div id="searchbox" style="display: none">
111
+  <h3>Quick search</h3>
112
+    <form class="search" action="../../search.html" method="get">
113
+      <input type="text" name="q" size="18" />
114
+      <input type="submit" value="Go" />
115
+      <input type="hidden" name="check_keywords" value="yes" />
116
+      <input type="hidden" name="area" value="default" />
117
+    </form>
118
+    <p class="searchtip" style="font-size: 90%">
119
+    Enter search terms or a module, class or function name.
120
+    </p>
121
+</div>
122
+<script type="text/javascript">$('#searchbox').show(0);</script>
123
+        </div>
124
+      </div>
125
+      <div class="clearer"></div>
126
+    </div>
127
+    <div class="related">
128
+      <h3>Navigation</h3>
129
+      <ul>
130
+        <li class="right" style="margin-right: 10px">
131
+          <a href="../../genindex.html" title="General Index"
132
+             >index</a></li>
133
+        <li class="right" >
134
+          <a href="../../py-modindex.html" title="Python Module Index"
135
+             >modules</a> |</li>
136
+        <li><a href="../../index.html">JSONRPC v1.0 documentation</a> &raquo;</li>
137
+          <li><a href="../index.html" >Module code</a> &raquo;</li> 
138
+      </ul>
139
+    </div>
140
+    <div class="footer">
141
+        &copy; Copyright 2011, Edward Langley.
142
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
143
+    </div>
144
+  </body>
145
+</html>
0 146
\ No newline at end of file
1 147
new file mode 100644
... ...
@@ -0,0 +1,268 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>jsonrpc.proxy &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '../../',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="../../_static/jquery.js"></script>
23
+    <script type="text/javascript" src="../../_static/underscore.js"></script>
24
+    <script type="text/javascript" src="../../_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="../../index.html" />
26
+    <link rel="up" title="Module code" href="../index.html" /> 
27
+  </head>
28
+  <body>
29
+    <div class="related">
30
+      <h3>Navigation</h3>
31
+      <ul>
32
+        <li class="right" style="margin-right: 10px">
33
+          <a href="../../genindex.html" title="General Index"
34
+             accesskey="I">index</a></li>
35
+        <li class="right" >
36
+          <a href="../../py-modindex.html" title="Python Module Index"
37
+             >modules</a> |</li>
38
+        <li><a href="../../index.html">JSONRPC v1.0 documentation</a> &raquo;</li>
39
+          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
40
+      </ul>
41
+    </div>  
42
+
43
+    <div class="document">
44
+      <div class="documentwrapper">
45
+        <div class="bodywrapper">
46
+          <div class="body">
47
+            
48
+  <h1>Source code for jsonrpc.proxy</h1><div class="highlight"><pre>
49
+<span class="c"># $Id: proxy.py,v 1.20 2011/05/26 20:19:17 edwlan Exp $</span>
50
+<span class="kn">import</span> <span class="nn">copy</span>
51
+<span class="kn">import</span> <span class="nn">urllib</span>
52
+<span class="kn">import</span> <span class="nn">urlparse</span>
53
+<span class="kn">import</span> <span class="nn">itertools</span>
54
+<span class="kn">import</span> <span class="nn">traceback</span>
55
+<span class="kn">import</span> <span class="nn">random</span>
56
+<span class="kn">import</span> <span class="nn">time</span>
57
+<span class="kn">import</span> <span class="nn">UserDict</span><span class="o">,</span> <span class="nn">collections</span>
58
+<span class="n">collections</span><span class="o">.</span><span class="n">Mapping</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">UserDict</span><span class="o">.</span><span class="n">DictMixin</span><span class="p">)</span>
59
+
60
+<span class="kn">from</span> <span class="nn">hashlib</span> <span class="kn">import</span> <span class="n">sha1</span>
61
+<span class="kn">import</span> <span class="nn">jsonrpc.jsonutil</span>
62
+
63
+<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;JSONRPCProxy&#39;</span><span class="p">,</span> <span class="s">&#39;ProxyEvents&#39;</span><span class="p">]</span>
64
+
65
+<span class="k">class</span> <span class="nc">NewStyleBaseException</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
66
+    <span class="k">def</span> <span class="nf">_get_message</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
67
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_message</span>
68
+    <span class="k">def</span> <span class="nf">_set_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
69
+        <span class="bp">self</span><span class="o">.</span><span class="n">_message</span> <span class="o">=</span> <span class="n">message</span>
70
+
71
+    <span class="n">message</span> <span class="o">=</span> <span class="nb">property</span><span class="p">(</span><span class="n">_get_message</span><span class="p">,</span> <span class="n">_set_message</span><span class="p">)</span>
72
+
73
+
74
+<span class="k">class</span> <span class="nc">JSONRPCException</span><span class="p">(</span><span class="n">NewStyleBaseException</span><span class="p">):</span>
75
+	<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rpcError</span><span class="p">):</span>
76
+		<span class="ne">Exception</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rpcError</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;message&#39;</span><span class="p">))</span>
77
+		<span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">rpcError</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;data&#39;</span><span class="p">)</span>
78
+		<span class="bp">self</span><span class="o">.</span><span class="n">message</span> <span class="o">=</span> <span class="n">rpcError</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;message&#39;</span><span class="p">)</span>
79
+		<span class="bp">self</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="n">rpcError</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;code&#39;</span><span class="p">)</span>
80
+
81
+<span class="k">class</span> <span class="nc">IDGen</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
82
+	<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
83
+		<span class="bp">self</span><span class="o">.</span><span class="n">_hasher</span> <span class="o">=</span> <span class="n">sha1</span><span class="p">()</span>
84
+		<span class="bp">self</span><span class="o">.</span><span class="n">_id</span> <span class="o">=</span> <span class="mi">0</span>
85
+	<span class="k">def</span> <span class="nf">__get__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">,</span> <span class="o">**</span><span class="n">__</span><span class="p">):</span>
86
+		<span class="bp">self</span><span class="o">.</span><span class="n">_id</span> <span class="o">+=</span> <span class="mi">1</span>
87
+		<span class="bp">self</span><span class="o">.</span><span class="n">_hasher</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_id</span><span class="p">))</span>
88
+		<span class="bp">self</span><span class="o">.</span><span class="n">_hasher</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">())</span>
89
+		<span class="bp">self</span><span class="o">.</span><span class="n">_hasher</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">))</span>
90
+		<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hasher</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()</span>
91
+
92
+
93
+
94
+<div class="viewcode-block" id="ProxyEvents"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.ProxyEvents">[docs]</a><span class="k">class</span> <span class="nc">ProxyEvents</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
95
+	<span class="sd">&#39;&#39;&#39;An event handler for JSONRPCProxy&#39;&#39;&#39;</span>
96
+
97
+	<span class="c">#: an instance of a class which defines a __get__ method, used to generate a request id</span>
98
+	<span class="n">IDGen</span> <span class="o">=</span> <span class="n">IDGen</span><span class="p">()</span>
99
+
100
+
101
+	<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">proxy</span><span class="p">):</span>
102
+		<span class="sd">&#39;&#39;&#39;Allow a subclass to do its own initialization, gets any arguments leftover from __init__&#39;&#39;&#39;</span>
103
+		<span class="bp">self</span><span class="o">.</span><span class="n">proxy</span> <span class="o">=</span> <span class="n">proxy</span>
104
+
105
+<div class="viewcode-block" id="ProxyEvents.get_postdata"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.ProxyEvents.get_postdata">[docs]</a>	<span class="k">def</span> <span class="nf">get_postdata</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">):</span>
106
+		<span class="sd">&#39;&#39;&#39;allow a subclass to modify the method&#39;s arguments</span>
107
+
108
+<span class="sd">		e.g. if an authentication token is necessary, the subclass can automatically insert it into every call&#39;&#39;&#39;</span>
109
+		<span class="k">return</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span>
110
+</div>
111
+<div class="viewcode-block" id="ProxyEvents.proc_response"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.ProxyEvents.proc_response">[docs]</a>	<span class="k">def</span> <span class="nf">proc_response</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
112
+		<span class="sd">&#39;&#39;&#39;allow a subclass to access the response data before it is returned to the user&#39;&#39;&#39;</span>
113
+		<span class="k">return</span> <span class="n">data</span>
114
+
115
+
116
+
117
+</div></div>
118
+<span class="n">inst</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span><span class="n">x</span><span class="p">()</span>
119
+<div class="viewcode-block" id="JSONRPCProxy"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.JSONRPCProxy">[docs]</a><span class="k">class</span> <span class="nc">JSONRPCProxy</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
120
+	<span class="sd">&#39;&#39;&#39;A class implementing a JSON-RPC Proxy.</span>
121
+
122
+<span class="sd">	:param str host: The HTTP server hosting the JSON-RPC server</span>
123
+<span class="sd">	:param str path: The path where the JSON-RPC server can be found</span>
124
+
125
+<span class="sd">	There are two ways of instantiating this class:</span>
126
+<span class="sd">	- JSONRPCProxy.from_url(url) -- give the absolute url to the JSON-RPC server</span>
127
+<span class="sd">	- JSONRPC(host, path) -- break up the url into smaller parts</span>
128
+
129
+<span class="sd">	&#39;&#39;&#39;</span>
130
+
131
+	<span class="c">#: Override this attribute to customize proxy behavior</span>
132
+	<span class="n">_eventhandler</span> <span class="o">=</span> <span class="n">ProxyEvents</span>
133
+	<span class="k">def</span> <span class="nf">customize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">eventhandler</span><span class="p">):</span>
134
+		<span class="bp">self</span><span class="o">.</span><span class="n">_eventhandler</span> <span class="o">=</span> <span class="n">eventhandler</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
135
+
136
+	<span class="k">def</span> <span class="nf">_transformURL</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">serviceURL</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
137
+		<span class="k">if</span> <span class="n">serviceURL</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;/&#39;</span><span class="p">:</span>
138
+			<span class="n">serviceURL</span> <span class="o">=</span> <span class="n">serviceURL</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
139
+		<span class="k">if</span> <span class="n">path</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;/&#39;</span><span class="p">:</span>
140
+			<span class="n">path</span> <span class="o">=</span> <span class="s">&#39;/</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span><span class="n">path</span>
141
+		<span class="k">if</span> <span class="n">path</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;/&#39;</span> <span class="ow">and</span> <span class="s">&#39;?&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">path</span><span class="p">:</span>
142
+			<span class="n">path</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">/&#39;</span><span class="o">%</span><span class="n">path</span>
143
+		<span class="k">return</span> <span class="n">serviceURL</span><span class="p">,</span> <span class="n">path</span>
144
+
145
+
146
+	<span class="k">def</span> <span class="nf">_get_postdata</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">):</span>
147
+		<span class="n">args</span><span class="p">,</span><span class="n">kwargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_eventhandler</span><span class="o">.</span><span class="n">get_postdata</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
148
+
149
+		<span class="k">if</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">has_key</span><span class="p">(</span><span class="s">&#39;__args&#39;</span><span class="p">):</span>
150
+			<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&#39;invalid argument name: __args&#39;</span>
151
+		<span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;__args&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">args</span> <span class="ow">or</span> <span class="p">()</span>
152
+		<span class="n">postdata</span> <span class="o">=</span> <span class="n">jsonrpc</span><span class="o">.</span><span class="n">jsonutil</span><span class="o">.</span><span class="n">encode</span><span class="p">({</span>
153
+			<span class="s">&quot;method&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_serviceName</span><span class="p">,</span>
154
+			<span class="s">&#39;params&#39;</span><span class="p">:</span> <span class="n">kwargs</span><span class="p">,</span>
155
+			<span class="s">&#39;id&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_eventhandler</span><span class="o">.</span><span class="n">IDGen</span><span class="p">,</span>
156
+			<span class="s">&#39;jsonrpc&#39;</span><span class="p">:</span> <span class="s">&#39;2.0&#39;</span>
157
+		<span class="p">})</span>
158
+		<span class="k">return</span> <span class="n">postdata</span>
159
+
160
+	<span class="c">## Public interface</span>
161
+	<span class="nd">@classmethod</span>
162
+<div class="viewcode-block" id="JSONRPCProxy.from_url"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.JSONRPCProxy.from_url">[docs]</a>	<span class="k">def</span> <span class="nf">from_url</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="n">ctxid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">serviceName</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
163
+		<span class="sd">&#39;&#39;&#39;Create a JSONRPCProxy from a URL&#39;&#39;&#39;</span>
164
+		<span class="n">urlsp</span> <span class="o">=</span> <span class="n">urlparse</span><span class="o">.</span><span class="n">urlsplit</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
165
+		<span class="n">url</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">://</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">urlsp</span><span class="o">.</span><span class="n">scheme</span><span class="p">,</span> <span class="n">urlsp</span><span class="o">.</span><span class="n">netloc</span><span class="p">)</span>
166
+		<span class="n">path</span> <span class="o">=</span> <span class="n">urlsp</span><span class="o">.</span><span class="n">path</span>
167
+		<span class="k">if</span> <span class="n">urlsp</span><span class="o">.</span><span class="n">query</span><span class="p">:</span> <span class="n">path</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">?</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">urlsp</span><span class="o">.</span><span class="n">query</span><span class="p">)</span>
168
+		<span class="k">if</span> <span class="n">urlsp</span><span class="o">.</span><span class="n">fragment</span><span class="p">:</span> <span class="n">path</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">#</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">urlsp</span><span class="o">.</span><span class="n">fragment</span><span class="p">)</span>
169
+		<span class="k">return</span> <span class="n">cls</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">serviceName</span><span class="p">,</span> <span class="n">ctxid</span><span class="p">)</span>
170
+
171
+</div>
172
+	<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">host</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="s">&#39;/jsonrpc&#39;</span><span class="p">,</span> <span class="n">serviceName</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
173
+		<span class="bp">self</span><span class="o">.</span><span class="n">serviceURL</span> <span class="o">=</span> <span class="n">host</span>
174
+		<span class="bp">self</span><span class="o">.</span><span class="n">_serviceName</span> <span class="o">=</span> <span class="n">serviceName</span>
175
+		<span class="bp">self</span><span class="o">.</span><span class="n">_path</span> <span class="o">=</span> <span class="n">path</span>
176
+		<span class="bp">self</span><span class="o">.</span><span class="n">serviceURL</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_transformURL</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span>
177
+		<span class="bp">self</span><span class="o">.</span><span class="n">customize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_eventhandler</span><span class="p">)</span>
178
+
179
+
180
+
181
+	<span class="k">def</span> <span class="nf">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
182
+		<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_serviceName</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
183
+			<span class="n">name</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">.</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_serviceName</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
184
+		<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">serviceURL</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_path</span><span class="p">,</span> <span class="n">serviceName</span><span class="o">=</span><span class="n">name</span><span class="p">)</span>
185
+
186
+
187
+
188
+
189
+	<span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
190
+
191
+		<span class="n">url</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%(host)s%(path)s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="nb">dict</span><span class="p">(</span><span class="n">host</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">serviceURL</span><span class="p">,</span> <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_path</span><span class="p">)</span>
192
+		<span class="n">postdata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_postdata</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
193
+		<span class="n">respdata</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">postdata</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
194
+		<span class="n">resp</span> <span class="o">=</span> <span class="n">jsonrpc</span><span class="o">.</span><span class="n">jsonutil</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="n">respdata</span><span class="p">)</span>
195
+
196
+		<span class="k">if</span> <span class="n">resp</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;error&#39;</span><span class="p">)</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
197
+			<span class="k">raise</span> <span class="n">JSONRPCException</span><span class="p">(</span><span class="n">resp</span><span class="p">[</span><span class="s">&#39;error&#39;</span><span class="p">])</span>
198
+		<span class="k">else</span><span class="p">:</span>
199
+			<span class="n">resp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_eventhandler</span><span class="o">.</span><span class="n">proc_response</span><span class="p">(</span><span class="n">resp</span><span class="p">)</span>
200
+			<span class="n">result</span> <span class="o">=</span> <span class="n">resp</span><span class="p">[</span><span class="s">&#39;result&#39;</span><span class="p">]</span>
201
+			<span class="k">return</span> <span class="n">result</span>
202
+
203
+
204
+<div class="viewcode-block" id="JSONRPCProxy.call"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.JSONRPCProxy.call">[docs]</a>	<span class="k">def</span> <span class="nf">call</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
205
+		<span class="sd">&#39;&#39;&#39;call a JSON-RPC method</span>
206
+
207
+<span class="sd">		It&#39;s better to use instance.&lt;methodname&gt;(\\*args, \\*\\*kwargs),</span>
208
+<span class="sd">		but this version might be useful occasionally</span>
209
+<span class="sd">		&#39;&#39;&#39;</span>
210
+		<span class="n">p</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">serviceURL</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_path</span><span class="p">,</span> <span class="n">serviceName</span><span class="o">=</span><span class="n">method</span><span class="p">)</span>
211
+		<span class="k">return</span> <span class="n">p</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
212
+
213
+</div>
214
+<div class="viewcode-block" id="JSONRPCProxy.batch_call"><a class="viewcode-back" href="../../proxy.html#jsonrpc.proxy.JSONRPCProxy.batch_call">[docs]</a>	<span class="k">def</span> <span class="nf">batch_call</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">names</span><span class="p">,</span> <span class="o">*</span><span class="n">params</span><span class="p">):</span>
215
+		<span class="sd">&#39;&#39;&#39;call several methods at once, return a list of (result, error) pairs</span>
216
+
217
+<span class="sd">		:param names: a list of method names</span>
218
+<span class="sd">		:param \\*params: a list of (arg,kwarg) pairs corresponding to each method name</span>
219
+<span class="sd">		&#39;&#39;&#39;</span>
220
+		<span class="n">methods</span> <span class="o">=</span> <span class="p">(</span> <span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">),</span><span class="n">param</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span><span class="n">param</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">izip</span><span class="p">(</span><span class="n">names</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span> <span class="p">)</span>
221
+		<span class="n">data</span> <span class="o">=</span> <span class="p">(</span><span class="n">method</span><span class="o">.</span><span class="n">_get_postdata</span><span class="p">(</span><span class="o">*</span><span class="n">params</span><span class="p">)</span> <span class="k">for</span> <span class="n">method</span><span class="p">,</span> <span class="n">params</span> <span class="ow">in</span> <span class="n">methods</span><span class="p">)</span>
222
+		<span class="n">postdata</span> <span class="o">=</span> <span class="s">&#39;[</span><span class="si">%s</span><span class="s">]&#39;</span> <span class="o">%</span> <span class="s">&#39;,&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
223
+		<span class="n">respdata</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">serviceURL</span><span class="p">,</span> <span class="n">postdata</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
224
+		<span class="n">resp</span> <span class="o">=</span> <span class="n">jsonrpc</span><span class="o">.</span><span class="n">jsonutil</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="n">respdata</span><span class="p">)</span>
225
+		<span class="k">return</span> <span class="p">[(</span><span class="n">res</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;result&#39;</span><span class="p">),</span> <span class="n">res</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;error&#39;</span><span class="p">))</span> <span class="k">for</span> <span class="n">res</span> <span class="ow">in</span> <span class="n">resp</span><span class="p">]</span></div></div>
226
+</pre></div>
227
+
228
+          </div>
229
+        </div>
230
+      </div>
231
+      <div class="sphinxsidebar">
232
+        <div class="sphinxsidebarwrapper">
233
+<div id="searchbox" style="display: none">
234
+  <h3>Quick search</h3>
235
+    <form class="search" action="../../search.html" method="get">
236
+      <input type="text" name="q" size="18" />
237
+      <input type="submit" value="Go" />
238
+      <input type="hidden" name="check_keywords" value="yes" />
239
+      <input type="hidden" name="area" value="default" />
240
+    </form>
241
+    <p class="searchtip" style="font-size: 90%">
242
+    Enter search terms or a module, class or function name.
243
+    </p>
244
+</div>
245
+<script type="text/javascript">$('#searchbox').show(0);</script>
246
+        </div>
247
+      </div>
248
+      <div class="clearer"></div>
249
+    </div>
250
+    <div class="related">
251
+      <h3>Navigation</h3>
252
+      <ul>
253
+        <li class="right" style="margin-right: 10px">
254
+          <a href="../../genindex.html" title="General Index"
255
+             >index</a></li>
256
+        <li class="right" >
257
+          <a href="../../py-modindex.html" title="Python Module Index"
258
+             >modules</a> |</li>
259
+        <li><a href="../../index.html">JSONRPC v1.0 documentation</a> &raquo;</li>
260
+          <li><a href="../index.html" >Module code</a> &raquo;</li> 
261
+      </ul>
262
+    </div>
263
+    <div class="footer">
264
+        &copy; Copyright 2011, Edward Langley.
265
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
266
+    </div>
267
+  </body>
268
+</html>
0 269
\ No newline at end of file
1 270
new file mode 100644
... ...
@@ -0,0 +1,241 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>jsonrpc.server &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '../../',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="../../_static/jquery.js"></script>
23
+    <script type="text/javascript" src="../../_static/underscore.js"></script>
24
+    <script type="text/javascript" src="../../_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="../../index.html" />
26
+    <link rel="up" title="Module code" href="../index.html" /> 
27
+  </head>
28
+  <body>
29
+    <div class="related">
30
+      <h3>Navigation</h3>
31
+      <ul>
32
+        <li class="right" style="margin-right: 10px">
33
+          <a href="../../genindex.html" title="General Index"
34
+             accesskey="I">index</a></li>
35
+        <li class="right" >
36
+          <a href="../../py-modindex.html" title="Python Module Index"
37
+             >modules</a> |</li>
38
+        <li><a href="../../index.html">JSONRPC v1.0 documentation</a> &raquo;</li>
39
+          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
40
+      </ul>
41
+    </div>  
42
+
43
+    <div class="document">
44
+      <div class="documentwrapper">
45
+        <div class="bodywrapper">
46
+          <div class="body">
47
+            
48
+  <h1>Source code for jsonrpc.server</h1><div class="highlight"><pre>
49
+<span class="c"># $Id: server.py,v 1.8 2011/05/26 19:34:19 edwlan Exp $</span>
50
+<span class="kn">import</span> <span class="nn">cgi</span>
51
+<span class="kn">import</span> <span class="nn">time</span>
52
+<span class="kn">import</span> <span class="nn">jsonrpc.jsonutil</span>
53
+
54
+<span class="c"># Twisted imports</span>
55
+<span class="kn">from</span> <span class="nn">twisted.web</span> <span class="kn">import</span> <span class="n">server</span>
56
+<span class="kn">from</span> <span class="nn">twisted.internet</span> <span class="kn">import</span> <span class="n">threads</span>
57
+<span class="kn">from</span> <span class="nn">twisted.web.resource</span> <span class="kn">import</span> <span class="n">Resource</span>
58
+
59
+
60
+<span class="kn">import</span> <span class="nn">UserDict</span><span class="o">,</span> <span class="nn">collections</span>
61
+<span class="n">collections</span><span class="o">.</span><span class="n">Mapping</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">UserDict</span><span class="o">.</span><span class="n">DictMixin</span><span class="p">)</span>
62
+
63
+<div class="viewcode-block" id="ServerEvents"><a class="viewcode-back" href="../../server.html#jsonrpc.server.ServerEvents">[docs]</a><span class="k">class</span> <span class="nc">ServerEvents</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
64
+	<span class="sd">&#39;&#39;&#39;Subclass this and pass to :py:meth:`jsonrpc.customize` to customize the jsonrpc server&#39;&#39;&#39;</span>
65
+
66
+	<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">jsonrpc</span><span class="p">):</span>
67
+		<span class="c">#: A link to the JSON-RPC server instance</span>
68
+		<span class="bp">self</span><span class="o">.</span><span class="n">server</span> <span class="o">=</span> <span class="n">jsonrpc</span>
69
+
70
+<div class="viewcode-block" id="ServerEvents.callmethod"><a class="viewcode-back" href="../../server.html#jsonrpc.server.ServerEvents.callmethod">[docs]</a>	<span class="k">def</span> <span class="nf">callmethod</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">method</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">):</span>
71
+		<span class="sd">&#39;&#39;&#39;Override to implement the methods the server will make available&#39;&#39;&#39;</span>
72
+		<span class="k">return</span> <span class="s">&#39;Test Result&#39;</span>
73
+</div>
74
+<div class="viewcode-block" id="ServerEvents.processrequest"><a class="viewcode-back" href="../../server.html#jsonrpc.server.ServerEvents.processrequest">[docs]</a>	<span class="k">def</span> <span class="nf">processrequest</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span>
75
+		<span class="sd">&#39;&#39;&#39;Override to implement custom handling of the method result and request&#39;&#39;&#39;</span>
76
+		<span class="k">return</span> <span class="n">result</span>
77
+</div>
78
+<div class="viewcode-block" id="ServerEvents.logerror"><a class="viewcode-back" href="../../server.html#jsonrpc.server.ServerEvents.logerror">[docs]</a>	<span class="k">def</span> <span class="nf">logerror</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">request</span><span class="p">):</span>
79
+		<span class="sd">&#39;&#39;&#39;Override to implement custom error handling&#39;&#39;&#39;</span>
80
+		<span class="k">pass</span>
81
+
82
+
83
+
84
+
85
+<span class="c">## Base class providing a JSON-RPC 2.0 implementation with 2 customizable hooks</span></div></div>
86
+<div class="viewcode-block" id="JSON_RPC"><a class="viewcode-back" href="../../server.html#jsonrpc.server.JSON_RPC">[docs]</a><span class="k">class</span> <span class="nc">JSON_RPC</span><span class="p">(</span><span class="n">Resource</span><span class="p">):</span>
87
+	<span class="sd">&#39;&#39;&#39;This class implements a JSON-RPC 2.0 server as a Twisted Resource&#39;&#39;&#39;</span>
88
+	<span class="n">isLeaf</span> <span class="o">=</span> <span class="bp">True</span>
89
+
90
+	<span class="c">#: set by :py:meth:`customize` used to change the behavior of the server</span>
91
+	<span class="n">eventhandler</span> <span class="o">=</span> <span class="n">ServerEvents</span>
92
+
93
+<div class="viewcode-block" id="JSON_RPC.customize"><a class="viewcode-back" href="../../server.html#jsonrpc.server.JSON_RPC.customize">[docs]</a>	<span class="k">def</span> <span class="nf">customize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">eventhandler</span><span class="p">):</span>
94
+		<span class="sd">&#39;&#39;&#39;customize the behavior of the server&#39;&#39;&#39;</span>
95
+		<span class="bp">self</span><span class="o">.</span><span class="n">eventhandler</span> <span class="o">=</span> <span class="n">eventhandler</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
96
+		<span class="k">return</span> <span class="bp">self</span>
97
+
98
+</div>
99
+	<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
100
+		<span class="bp">self</span><span class="o">.</span><span class="n">customize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">eventhandler</span><span class="p">)</span>
101
+		<span class="n">Resource</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
102
+
103
+	<span class="k">def</span> <span class="nf">_parse_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">content</span><span class="p">):</span>
104
+		<span class="k">if</span> <span class="n">content</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;jsonrpc&#39;</span><span class="p">)</span> <span class="o">!=</span> <span class="s">&#39;2.0&#39;</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&#39;wrong JSON-RPC version&#39;</span>
105
+		<span class="n">method</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;method&#39;</span><span class="p">)</span>
106
+		<span class="n">kwargs</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;params&#39;</span><span class="p">,</span> <span class="p">{})</span>
107
+		<span class="n">args</span> <span class="o">=</span> <span class="p">()</span>
108
+		<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
109
+			<span class="n">args</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">kwargs</span><span class="p">)</span>
110
+			<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{}</span>
111
+		<span class="k">else</span><span class="p">:</span>
112
+			<span class="n">args</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;__args&#39;</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span>
113
+		<span class="n">kwargs</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">k</span><span class="p">),</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="p">)</span>
114
+		<span class="k">return</span> <span class="n">method</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">,</span> <span class="n">args</span>
115
+
116
+
117
+	<span class="k">def</span> <span class="nf">_cbRender</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">request</span><span class="p">):</span>
118
+		<span class="n">request</span><span class="o">.</span><span class="n">setHeader</span><span class="p">(</span><span class="s">&quot;content-type&quot;</span><span class="p">,</span> <span class="s">&#39;application/json&#39;</span><span class="p">)</span>
119
+		<span class="n">request</span><span class="o">.</span><span class="n">setResponseCode</span><span class="p">(</span><span class="mi">200</span><span class="p">)</span>
120
+		<span class="n">result</span> <span class="o">=</span> <span class="n">jsonrpc</span><span class="o">.</span><span class="n">jsonutil</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="n">result</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">&#39;utf-8&#39;</span><span class="p">)</span>
121
+		<span class="n">request</span><span class="o">.</span><span class="n">setHeader</span><span class="p">(</span><span class="s">&quot;content-length&quot;</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">result</span><span class="p">))</span>
122
+		<span class="n">request</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
123
+		<span class="n">request</span><span class="o">.</span><span class="n">finish</span><span class="p">()</span>
124
+
125
+
126
+	<span class="k">def</span> <span class="nf">_ebRender</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">content</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
127
+		<span class="n">result_template</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
128
+			<span class="n">jsonrpc</span><span class="o">=</span><span class="s">&#39;2.0&#39;</span><span class="p">,</span>
129
+			<span class="n">error</span><span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
130
+				<span class="n">code</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
131
+				<span class="n">message</span><span class="o">=</span><span class="s">&#39;Stub Message&#39;</span><span class="p">,</span>
132
+				<span class="n">data</span> <span class="o">=</span> <span class="s">&#39;Stub Data&#39;</span>
133
+		<span class="p">))</span>
134
+
135
+		<span class="k">try</span><span class="p">:</span>
136
+			<span class="n">request</span><span class="o">.</span><span class="n">setHeader</span><span class="p">(</span><span class="s">&quot;X-Error&quot;</span><span class="p">,</span> <span class="n">result</span><span class="o">.</span><span class="n">getErrorMessage</span><span class="p">())</span>
137
+			<span class="n">result_template</span><span class="p">[</span><span class="s">&#39;error&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span>
138
+					<span class="n">code</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
139
+					<span class="n">message</span><span class="o">=</span><span class="s">&#39; &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">value</span><span class="p">),</span>
140
+					<span class="n">data</span><span class="o">=</span><span class="n">content</span>
141
+			<span class="p">)</span>
142
+			<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">content</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
143
+				<span class="n">result_template</span><span class="p">[</span><span class="s">&#39;id&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="s">&#39;&lt;NULL&gt;&#39;</span><span class="p">)</span>
144
+				<span class="n">result_template</span> <span class="o">=</span> <span class="p">[</span><span class="n">result</span><span class="p">]</span>
145
+			<span class="k">else</span><span class="p">:</span> <span class="n">result_template</span><span class="p">[</span><span class="s">&#39;id&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;id&#39;</span><span class="p">)</span>
146
+		<span class="k">except</span> <span class="ne">Exception</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
147
+			<span class="n">result_template</span><span class="p">[</span><span class="s">&#39;error&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span>
148
+				<span class="n">code</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
149
+				<span class="n">message</span> <span class="o">=</span> <span class="s">&#39;Error in errorpage: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">e</span><span class="p">,</span>
150
+				<span class="n">data</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
151
+			<span class="p">)</span>
152
+
153
+		<span class="n">result</span> <span class="o">=</span> <span class="n">result_template</span>
154
+		<span class="n">result</span><span class="p">[</span><span class="s">&#39;error&#39;</span><span class="p">][</span><span class="s">&#39;message&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">cgi</span><span class="o">.</span><span class="n">escape</span><span class="p">(</span><span class="n">result</span><span class="p">[</span><span class="s">&#39;error&#39;</span><span class="p">][</span><span class="s">&#39;message&#39;</span><span class="p">])</span>
155
+		<span class="n">result</span> <span class="o">=</span> <span class="n">jsonrpc</span><span class="o">.</span><span class="n">jsonutil</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
156
+		<span class="n">result</span> <span class="o">=</span> <span class="n">result</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">&#39;utf-8&#39;</span><span class="p">)</span>
157
+		<span class="n">request</span><span class="o">.</span><span class="n">setHeader</span><span class="p">(</span><span class="s">&quot;content-length&quot;</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">result</span><span class="p">))</span>
158
+		<span class="n">request</span><span class="o">.</span><span class="n">setResponseCode</span><span class="p">(</span><span class="mi">500</span><span class="p">)</span>
159
+		<span class="bp">self</span><span class="o">.</span><span class="n">eventhandler</span><span class="o">.</span><span class="n">logerror</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
160
+		<span class="n">request</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
161
+		<span class="n">request</span><span class="o">.</span><span class="n">finish</span><span class="p">()</span>
162
+
163
+
164
+	<span class="k">def</span> <span class="nf">render</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request</span><span class="p">):</span>
165
+		<span class="n">ctxid</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getCookie</span><span class="p">(</span><span class="s">&quot;ctxid&quot;</span><span class="p">)</span> <span class="ow">or</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;ctxid&quot;</span><span class="p">,</span> <span class="p">[</span><span class="bp">None</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span>
166
+		<span class="n">host</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getClientIP</span><span class="p">()</span>
167
+
168
+		<span class="n">request</span><span class="o">.</span><span class="n">content</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
169
+		<span class="n">content</span> <span class="o">=</span> <span class="n">jsonrpc</span><span class="o">.</span><span class="n">jsonutil</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">content</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
170
+		<span class="n">d</span> <span class="o">=</span> <span class="n">threads</span><span class="o">.</span><span class="n">deferToThread</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_action</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">content</span><span class="p">,</span> <span class="n">ctxid</span><span class="o">=</span><span class="n">ctxid</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="n">host</span><span class="p">)</span>
171
+		<span class="n">d</span><span class="o">.</span><span class="n">addCallback</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_cbRender</span><span class="p">,</span> <span class="n">request</span><span class="p">)</span>
172
+		<span class="n">d</span><span class="o">.</span><span class="n">addErrback</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_ebRender</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">content</span><span class="p">)</span>
173
+		<span class="k">return</span> <span class="n">server</span><span class="o">.</span><span class="n">NOT_DONE_YET</span>
174
+
175
+
176
+	<span class="k">def</span> <span class="nf">_action</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">contents</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">):</span>
177
+		<span class="n">result</span> <span class="o">=</span> <span class="p">[]</span>
178
+		<span class="n">ol</span> <span class="o">=</span> <span class="p">(</span><span class="bp">True</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">contents</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="k">else</span> <span class="bp">False</span><span class="p">)</span>
179
+		<span class="k">if</span> <span class="ow">not</span> <span class="n">ol</span><span class="p">:</span>
180
+			<span class="n">contents</span> <span class="o">=</span> <span class="p">[</span><span class="n">contents</span><span class="p">]</span>
181
+
182
+		<span class="k">for</span> <span class="n">content</span> <span class="ow">in</span> <span class="n">contents</span><span class="p">:</span>
183
+			<span class="n">res</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
184
+				<span class="n">jsonrpc</span> <span class="o">=</span> <span class="s">&#39;2.0&#39;</span><span class="p">,</span>
185
+				<span class="nb">id</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;id&#39;</span><span class="p">),</span>
186
+				<span class="n">result</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">eventhandler</span><span class="o">.</span><span class="n">callmethod</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_data</span><span class="p">(</span><span class="n">content</span><span class="p">),</span> <span class="o">**</span><span class="n">kw</span><span class="p">)</span>
187
+			<span class="p">)</span>
188
+
189
+			<span class="n">res</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">eventhandler</span><span class="o">.</span><span class="n">processrequest</span><span class="p">(</span><span class="n">res</span><span class="p">,</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="p">)</span>
190
+
191
+			<span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
192
+
193
+
194
+		<span class="k">return</span> <span class="p">(</span> <span class="n">result</span> <span class="k">if</span> <span class="n">ol</span> <span class="k">else</span> <span class="n">result</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="p">)</span>
195
+
196
+
197
+</div>
198
+<span class="n">__version__</span> <span class="o">=</span> <span class="s">&quot;$Revision: 1.8 $&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;:&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
199
+</pre></div>
200
+
201
+          </div>
202
+        </div>
203
+      </div>
204
+      <div class="sphinxsidebar">
205
+        <div class="sphinxsidebarwrapper">
206
+<div id="searchbox" style="display: none">
207
+  <h3>Quick search</h3>
208
+    <form class="search" action="../../search.html" method="get">
209
+      <input type="text" name="q" size="18" />
210
+      <input type="submit" value="Go" />
211
+      <input type="hidden" name="check_keywords" value="yes" />
212
+      <input type="hidden" name="area" value="default" />
213
+    </form>
214
+    <p class="searchtip" style="font-size: 90%">
215
+    Enter search terms or a module, class or function name.
216
+    </p>
217
+</div>
218
+<script type="text/javascript">$('#searchbox').show(0);</script>
219
+        </div>
220
+      </div>
221
+      <div class="clearer"></div>
222
+    </div>
223
+    <div class="related">
224
+      <h3>Navigation</h3>
225
+      <ul>
226
+        <li class="right" style="margin-right: 10px">
227
+          <a href="../../genindex.html" title="General Index"
228
+             >index</a></li>
229
+        <li class="right" >
230
+          <a href="../../py-modindex.html" title="Python Module Index"
231
+             >modules</a> |</li>
232
+        <li><a href="../../index.html">JSONRPC v1.0 documentation</a> &raquo;</li>
233
+          <li><a href="../index.html" >Module code</a> &raquo;</li> 
234
+      </ul>
235
+    </div>
236
+    <div class="footer">
237
+        &copy; Copyright 2011, Edward Langley.
238
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
239
+    </div>
240
+  </body>
241
+</html>
0 242
\ No newline at end of file
1 243
new file mode 100644
... ...
@@ -0,0 +1,24 @@
1
+.. JSONRPC documentation master file, created by
2
+   sphinx-quickstart on Mon May 23 20:36:05 2011.
3
+   You can adapt this file completely to your liking, but it should at least
4
+   contain the root `toctree` directive.
5
+
6
+Welcome to JSONRPC's documentation!
7
+===================================
8
+
9
+Contents:
10
+
11
+.. toctree::
12
+   :maxdepth: 2
13
+
14
+   server
15
+   proxy
16
+   jsonutil
17
+
18
+Indices and tables
19
+==================
20
+
21
+* :ref:`genindex`
22
+* :ref:`modindex`
23
+* :ref:`search`
24
+
0 25
new file mode 100644
... ...
@@ -0,0 +1,12 @@
1
+jsonrpc.jsonutil
2
+================
3
+.. automodule:: jsonrpc.jsonutil
4
+
5
+.. py:function:: encode(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', **kw)
6
+
7
+   Serialize obj to json, if it is not of a type which the encoder can handle,
8
+   make it the proper type. Args and kw are as in json.dumps
9
+
10
+.. py:function:: decode(str, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw)
11
+
12
+   Return an object from a json string.  This is just :py:func:`json.loads` renamed
0 13
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+JSON-RPC Proxy
2
+==============
3
+
4
+.. automodule:: jsonrpc.proxy
5
+   :members:
0 6
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+JSON-RPC Server
2
+===============
3
+
4
+.. automodule:: jsonrpc.server
5
+   :members:
6
+
0 7
new file mode 100644
... ...
@@ -0,0 +1,528 @@
1
+/*
2
+ * basic.css
3
+ * ~~~~~~~~~
4
+ *
5
+ * Sphinx stylesheet -- basic theme.
6
+ *
7
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+/* -- main layout ----------------------------------------------------------- */
13
+
14
+div.clearer {
15
+    clear: both;
16
+}
17
+
18
+/* -- relbar ---------------------------------------------------------------- */
19
+
20
+div.related {
21
+    width: 100%;
22
+    font-size: 90%;
23
+}
24
+
25
+div.related h3 {
26
+    display: none;
27
+}
28
+
29
+div.related ul {
30
+    margin: 0;
31
+    padding: 0 0 0 10px;
32
+    list-style: none;
33
+}
34
+
35
+div.related li {
36
+    display: inline;
37
+}
38
+
39
+div.related li.right {
40
+    float: right;
41
+    margin-right: 5px;
42
+}
43
+
44
+/* -- sidebar --------------------------------------------------------------- */
45
+
46
+div.sphinxsidebarwrapper {
47
+    padding: 10px 5px 0 10px;
48
+}
49
+
50
+div.sphinxsidebar {
51
+    float: left;
52
+    width: 230px;
53
+    margin-left: -100%;
54
+    font-size: 90%;
55
+}
56
+
57
+div.sphinxsidebar ul {
58
+    list-style: none;
59
+}
60
+
61
+div.sphinxsidebar ul ul,
62
+div.sphinxsidebar ul.want-points {
63
+    margin-left: 20px;
64
+    list-style: square;
65
+}
66
+
67
+div.sphinxsidebar ul ul {
68
+    margin-top: 0;
69
+    margin-bottom: 0;
70
+}
71
+
72
+div.sphinxsidebar form {
73
+    margin-top: 10px;
74
+}
75
+
76
+div.sphinxsidebar input {
77
+    border: 1px solid #98dbcc;
78
+    font-family: sans-serif;
79
+    font-size: 1em;
80
+}
81
+
82
+img {
83
+    border: 0;
84
+}
85
+
86
+/* -- search page ----------------------------------------------------------- */
87
+
88
+ul.search {
89
+    margin: 10px 0 0 20px;
90
+    padding: 0;
91
+}
92
+
93
+ul.search li {
94
+    padding: 5px 0 5px 20px;
95
+    background-image: url(file.png);
96
+    background-repeat: no-repeat;
97
+    background-position: 0 7px;
98
+}
99
+
100
+ul.search li a {
101
+    font-weight: bold;
102
+}
103
+
104
+ul.search li div.context {
105
+    color: #888;
106
+    margin: 2px 0 0 30px;
107
+    text-align: left;
108
+}
109
+
110
+ul.keywordmatches li.goodmatch a {
111
+    font-weight: bold;
112
+}
113
+
114
+/* -- index page ------------------------------------------------------------ */
115
+
116
+table.contentstable {
117
+    width: 90%;
118
+}
119
+
120
+table.contentstable p.biglink {
121
+    line-height: 150%;
122
+}
123
+
124
+a.biglink {
125
+    font-size: 1.3em;
126
+}
127
+
128
+span.linkdescr {
129
+    font-style: italic;
130
+    padding-top: 5px;
131
+    font-size: 90%;
132
+}
133
+
134
+/* -- general index --------------------------------------------------------- */
135
+
136
+table.indextable {
137
+    width: 100%;
138
+}
139
+
140
+table.indextable td {
141
+    text-align: left;
142
+    vertical-align: top;
143
+}
144
+
145
+table.indextable dl, table.indextable dd {
146
+    margin-top: 0;
147
+    margin-bottom: 0;
148
+}
149
+
150
+table.indextable tr.pcap {
151
+    height: 10px;
152
+}
153
+
154
+table.indextable tr.cap {
155
+    margin-top: 10px;
156
+    background-color: #f2f2f2;
157
+}
158
+
159
+img.toggler {
160
+    margin-right: 3px;
161
+    margin-top: 3px;
162
+    cursor: pointer;
163
+}
164
+
165
+div.modindex-jumpbox {
166
+    border-top: 1px solid #ddd;
167
+    border-bottom: 1px solid #ddd;
168
+    margin: 1em 0 1em 0;
169
+    padding: 0.4em;
170
+}
171
+
172
+div.genindex-jumpbox {
173
+    border-top: 1px solid #ddd;
174
+    border-bottom: 1px solid #ddd;
175
+    margin: 1em 0 1em 0;
176
+    padding: 0.4em;
177
+}
178
+
179
+/* -- general body styles --------------------------------------------------- */
180
+
181
+a.headerlink {
182
+    visibility: hidden;
183
+}
184
+
185
+h1:hover > a.headerlink,
186
+h2:hover > a.headerlink,
187
+h3:hover > a.headerlink,
188
+h4:hover > a.headerlink,
189
+h5:hover > a.headerlink,
190
+h6:hover > a.headerlink,
191
+dt:hover > a.headerlink {
192
+    visibility: visible;
193
+}
194
+
195
+div.body p.caption {
196
+    text-align: inherit;
197
+}
198
+
199
+div.body td {
200
+    text-align: left;
201
+}
202
+
203
+.field-list ul {
204
+    padding-left: 1em;
205
+}
206
+
207
+.first {
208
+    margin-top: 0 !important;
209
+}
210
+
211
+p.rubric {
212
+    margin-top: 30px;
213
+    font-weight: bold;
214
+}
215
+
216
+img.align-left, .figure.align-left, object.align-left {
217
+    clear: left;
218
+    float: left;
219
+    margin-right: 1em;
220
+}
221
+
222
+img.align-right, .figure.align-right, object.align-right {
223
+    clear: right;
224
+    float: right;
225
+    margin-left: 1em;
226
+}
227
+
228
+img.align-center, .figure.align-center, object.align-center {
229
+  display: block;
230
+  margin-left: auto;
231
+  margin-right: auto;
232
+}
233
+
234
+.align-left {
235
+    text-align: left;
236
+}
237
+
238
+.align-center {
239
+    clear: both;
240
+    text-align: center;
241
+}
242
+
243
+.align-right {
244
+    text-align: right;
245
+}
246
+
247
+/* -- sidebars -------------------------------------------------------------- */
248
+
249
+div.sidebar {
250
+    margin: 0 0 0.5em 1em;
251
+    border: 1px solid #ddb;
252
+    padding: 7px 7px 0 7px;
253
+    background-color: #ffe;
254
+    width: 40%;
255
+    float: right;
256
+}
257
+
258
+p.sidebar-title {
259
+    font-weight: bold;
260
+}
261
+
262
+/* -- topics ---------------------------------------------------------------- */
263
+
264
+div.topic {
265
+    border: 1px solid #ccc;
266
+    padding: 7px 7px 0 7px;
267
+    margin: 10px 0 10px 0;
268
+}
269
+
270
+p.topic-title {
271
+    font-size: 1.1em;
272
+    font-weight: bold;
273
+    margin-top: 10px;
274
+}
275
+
276
+/* -- admonitions ----------------------------------------------------------- */
277
+
278
+div.admonition {
279
+    margin-top: 10px;
280
+    margin-bottom: 10px;
281
+    padding: 7px;
282
+}
283
+
284
+div.admonition dt {
285
+    font-weight: bold;
286
+}
287
+
288
+div.admonition dl {
289
+    margin-bottom: 0;
290
+}
291
+
292
+p.admonition-title {
293
+    margin: 0px 10px 5px 0px;
294
+    font-weight: bold;
295
+}
296
+
297
+div.body p.centered {
298
+    text-align: center;
299
+    margin-top: 25px;
300
+}
301
+
302
+/* -- tables ---------------------------------------------------------------- */
303
+
304
+table.docutils {
305
+    border: 0;
306
+    border-collapse: collapse;
307
+}
308
+
309
+table.docutils td, table.docutils th {
310
+    padding: 1px 8px 1px 5px;
311
+    border-top: 0;
312
+    border-left: 0;
313
+    border-right: 0;
314
+    border-bottom: 1px solid #aaa;
315
+}
316
+
317
+table.field-list td, table.field-list th {
318
+    border: 0 !important;
319
+}
320
+
321
+table.footnote td, table.footnote th {
322
+    border: 0 !important;
323
+}
324
+
325
+th {
326
+    text-align: left;
327
+    padding-right: 5px;
328
+}
329
+
330
+table.citation {
331
+    border-left: solid 1px gray;
332
+    margin-left: 1px;
333
+}
334
+
335
+table.citation td {
336
+    border-bottom: none;
337
+}
338
+
339
+/* -- other body styles ----------------------------------------------------- */
340
+
341
+ol.arabic {
342
+    list-style: decimal;
343
+}
344
+
345
+ol.loweralpha {
346
+    list-style: lower-alpha;
347
+}
348
+
349
+ol.upperalpha {
350
+    list-style: upper-alpha;
351
+}
352
+
353
+ol.lowerroman {
354
+    list-style: lower-roman;
355
+}
356
+
357
+ol.upperroman {
358
+    list-style: upper-roman;
359
+}
360
+
361
+dl {
362
+    margin-bottom: 15px;
363
+}
364
+
365
+dd p {
366
+    margin-top: 0px;
367
+}
368
+
369
+dd ul, dd table {
370
+    margin-bottom: 10px;
371
+}
372
+
373
+dd {
374
+    margin-top: 3px;
375
+    margin-bottom: 10px;
376
+    margin-left: 30px;
377
+}
378
+
379
+dt:target, .highlighted {
380
+    background-color: #fbe54e;
381
+}
382
+
383
+dl.glossary dt {
384
+    font-weight: bold;
385
+    font-size: 1.1em;
386
+}
387
+
388
+.field-list ul {
389
+    margin: 0;
390
+    padding-left: 1em;
391
+}
392
+
393
+.field-list p {
394
+    margin: 0;
395
+}
396
+
397
+.refcount {
398
+    color: #060;
399
+}
400
+
401
+.optional {
402
+    font-size: 1.3em;
403
+}
404
+
405
+.versionmodified {
406
+    font-style: italic;
407
+}
408
+
409
+.system-message {
410
+    background-color: #fda;
411
+    padding: 5px;
412
+    border: 3px solid red;
413
+}
414
+
415
+.footnote:target  {
416
+    background-color: #ffa;
417
+}
418
+
419
+.line-block {
420
+    display: block;
421
+    margin-top: 1em;
422
+    margin-bottom: 1em;
423
+}
424
+
425
+.line-block .line-block {
426
+    margin-top: 0;
427
+    margin-bottom: 0;
428
+    margin-left: 1.5em;
429
+}
430
+
431
+.guilabel, .menuselection {
432
+    font-family: sans-serif;
433
+}
434
+
435
+.accelerator {
436
+    text-decoration: underline;
437
+}
438
+
439
+.classifier {
440
+    font-style: oblique;
441
+}
442
+
443
+/* -- code displays --------------------------------------------------------- */
444
+
445
+pre {
446
+    overflow: auto;
447
+    overflow-y: hidden;  /* fixes display issues on Chrome browsers */
448
+}
449
+
450
+td.linenos pre {
451
+    padding: 5px 0px;
452
+    border: 0;
453
+    background-color: transparent;
454
+    color: #aaa;
455
+}
456
+
457
+table.highlighttable {
458
+    margin-left: 0.5em;
459
+}
460
+
461
+table.highlighttable td {
462
+    padding: 0 0.5em 0 0.5em;
463
+}
464
+
465
+tt.descname {
466
+    background-color: transparent;
467
+    font-weight: bold;
468
+    font-size: 1.2em;
469
+}
470
+
471
+tt.descclassname {
472
+    background-color: transparent;
473
+}
474
+
475
+tt.xref, a tt {
476
+    background-color: transparent;
477
+    font-weight: bold;
478
+}
479
+
480
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
481
+    background-color: transparent;
482
+}
483
+
484
+.viewcode-link {
485
+    float: right;
486
+}
487
+
488
+.viewcode-back {
489
+    float: right;
490
+    font-family: sans-serif;
491
+}
492
+
493
+div.viewcode-block:target {
494
+    margin: -1px -10px;
495
+    padding: 0 10px;
496
+}
497
+
498
+/* -- math display ---------------------------------------------------------- */
499
+
500
+img.math {
501
+    vertical-align: middle;
502
+}
503
+
504
+div.body div.math p {
505
+    text-align: center;
506
+}
507
+
508
+span.eqno {
509
+    float: right;
510
+}
511
+
512
+/* -- printout stylesheet --------------------------------------------------- */
513
+
514
+@media print {
515
+    div.document,
516
+    div.documentwrapper,
517
+    div.bodywrapper {
518
+        margin: 0 !important;
519
+        width: 100%;
520
+    }
521
+
522
+    div.sphinxsidebar,
523
+    div.related,
524
+    div.footer,
525
+    #top-link {
526
+        display: none;
527
+    }
528
+}
0 529
new file mode 100644
... ...
@@ -0,0 +1,256 @@
1
+/*
2
+ * default.css_t
3
+ * ~~~~~~~~~~~~~
4
+ *
5
+ * Sphinx stylesheet -- default theme.
6
+ *
7
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+@import url("basic.css");
13
+
14
+/* -- page layout ----------------------------------------------------------- */
15
+
16
+body {
17
+    font-family: sans-serif;
18
+    font-size: 100%;
19
+    background-color: #11303d;
20
+    color: #000;
21
+    margin: 0;
22
+    padding: 0;
23
+}
24
+
25
+div.document {
26
+    background-color: #1c4e63;
27
+}
28
+
29
+div.documentwrapper {
30
+    float: left;
31
+    width: 100%;
32
+}
33
+
34
+div.bodywrapper {
35
+    margin: 0 0 0 230px;
36
+}
37
+
38
+div.body {
39
+    background-color: #ffffff;
40
+    color: #000000;
41
+    padding: 0 20px 30px 20px;
42
+}
43
+
44
+div.footer {
45
+    color: #ffffff;
46
+    width: 100%;
47
+    padding: 9px 0 9px 0;
48
+    text-align: center;
49
+    font-size: 75%;
50
+}
51
+
52
+div.footer a {
53
+    color: #ffffff;
54
+    text-decoration: underline;
55
+}
56
+
57
+div.related {
58
+    background-color: #133f52;
59
+    line-height: 30px;
60
+    color: #ffffff;
61
+}
62
+
63
+div.related a {
64
+    color: #ffffff;
65
+}
66
+
67
+div.sphinxsidebar {
68
+}
69
+
70
+div.sphinxsidebar h3 {
71
+    font-family: 'Trebuchet MS', sans-serif;
72
+    color: #ffffff;
73
+    font-size: 1.4em;
74
+    font-weight: normal;
75
+    margin: 0;
76
+    padding: 0;
77
+}
78
+
79
+div.sphinxsidebar h3 a {
80
+    color: #ffffff;
81
+}
82
+
83
+div.sphinxsidebar h4 {
84
+    font-family: 'Trebuchet MS', sans-serif;
85
+    color: #ffffff;
86
+    font-size: 1.3em;
87
+    font-weight: normal;
88
+    margin: 5px 0 0 0;
89
+    padding: 0;
90
+}
91
+
92
+div.sphinxsidebar p {
93
+    color: #ffffff;
94
+}
95
+
96
+div.sphinxsidebar p.topless {
97
+    margin: 5px 10px 10px 10px;
98
+}
99
+
100
+div.sphinxsidebar ul {
101
+    margin: 10px;
102
+    padding: 0;
103
+    color: #ffffff;
104
+}
105
+
106
+div.sphinxsidebar a {
107
+    color: #98dbcc;
108
+}
109
+
110
+div.sphinxsidebar input {
111
+    border: 1px solid #98dbcc;
112
+    font-family: sans-serif;
113
+    font-size: 1em;
114
+}
115
+
116
+
117
+
118
+/* -- hyperlink styles ------------------------------------------------------ */
119
+
120
+a {
121
+    color: #355f7c;
122
+    text-decoration: none;
123
+}
124
+
125
+a:visited {
126
+    color: #355f7c;
127
+    text-decoration: none;
128
+}
129
+
130
+a:hover {
131
+    text-decoration: underline;
132
+}
133
+
134
+
135
+
136
+/* -- body styles ----------------------------------------------------------- */
137
+
138
+div.body h1,
139
+div.body h2,
140
+div.body h3,
141
+div.body h4,
142
+div.body h5,
143
+div.body h6 {
144
+    font-family: 'Trebuchet MS', sans-serif;
145
+    background-color: #f2f2f2;
146
+    font-weight: normal;
147
+    color: #20435c;
148
+    border-bottom: 1px solid #ccc;
149
+    margin: 20px -20px 10px -20px;
150
+    padding: 3px 0 3px 10px;
151
+}
152
+
153
+div.body h1 { margin-top: 0; font-size: 200%; }
154
+div.body h2 { font-size: 160%; }
155
+div.body h3 { font-size: 140%; }
156
+div.body h4 { font-size: 120%; }
157
+div.body h5 { font-size: 110%; }
158
+div.body h6 { font-size: 100%; }
159
+
160
+a.headerlink {
161
+    color: #c60f0f;
162
+    font-size: 0.8em;
163
+    padding: 0 4px 0 4px;
164
+    text-decoration: none;
165
+}
166
+
167
+a.headerlink:hover {
168
+    background-color: #c60f0f;
169
+    color: white;
170
+}
171
+
172
+div.body p, div.body dd, div.body li {
173
+    text-align: justify;
174
+    line-height: 130%;
175
+}
176
+
177
+div.admonition p.admonition-title + p {
178
+    display: inline;
179
+}
180
+
181
+div.admonition p {
182
+    margin-bottom: 5px;
183
+}
184
+
185
+div.admonition pre {
186
+    margin-bottom: 5px;
187
+}
188
+
189
+div.admonition ul, div.admonition ol {
190
+    margin-bottom: 5px;
191
+}
192
+
193
+div.note {
194
+    background-color: #eee;
195
+    border: 1px solid #ccc;
196
+}
197
+
198
+div.seealso {
199
+    background-color: #ffc;
200
+    border: 1px solid #ff6;
201
+}
202
+
203
+div.topic {
204
+    background-color: #eee;
205
+}
206
+
207
+div.warning {
208
+    background-color: #ffe4e4;
209
+    border: 1px solid #f66;
210
+}
211
+
212
+p.admonition-title {
213
+    display: inline;
214
+}
215
+
216
+p.admonition-title:after {
217
+    content: ":";
218
+}
219
+
220
+pre {
221
+    padding: 5px;
222
+    background-color: #eeffcc;
223
+    color: #333333;
224
+    line-height: 120%;
225
+    border: 1px solid #ac9;
226
+    border-left: none;
227
+    border-right: none;
228
+}
229
+
230
+tt {
231
+    background-color: #ecf0f3;
232
+    padding: 0 1px 0 1px;
233
+    font-size: 0.95em;
234
+}
235
+
236
+th {
237
+    background-color: #ede;
238
+}
239
+
240
+.warning tt {
241
+    background: #efc2c2;
242
+}
243
+
244
+.note tt {
245
+    background: #d6d6d6;
246
+}
247
+
248
+.viewcode-back {
249
+    font-family: sans-serif;
250
+}
251
+
252
+div.viewcode-block:target {
253
+    background-color: #f4debf;
254
+    border-top: 1px solid #ac9;
255
+    border-bottom: 1px solid #ac9;
256
+}
0 257
\ No newline at end of file
1 258
new file mode 100644
... ...
@@ -0,0 +1,247 @@
1
+/*
2
+ * doctools.js
3
+ * ~~~~~~~~~~~
4
+ *
5
+ * Sphinx JavaScript utilties for all documentation.
6
+ *
7
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+/**
13
+ * select a different prefix for underscore
14
+ */
15
+$u = _.noConflict();
16
+
17
+/**
18
+ * make the code below compatible with browsers without
19
+ * an installed firebug like debugger
20
+if (!window.console || !console.firebug) {
21
+  var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
22
+    "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
23
+    "profile", "profileEnd"];
24
+  window.console = {};
25
+  for (var i = 0; i < names.length; ++i)
26
+    window.console[names[i]] = function() {};
27
+}
28
+ */
29
+
30
+/**
31
+ * small helper function to urldecode strings
32
+ */
33
+jQuery.urldecode = function(x) {
34
+  return decodeURIComponent(x).replace(/\+/g, ' ');
35
+}
36
+
37
+/**
38
+ * small helper function to urlencode strings
39
+ */
40
+jQuery.urlencode = encodeURIComponent;
41
+
42
+/**
43
+ * This function returns the parsed url parameters of the
44
+ * current request. Multiple values per key are supported,
45
+ * it will always return arrays of strings for the value parts.
46
+ */
47
+jQuery.getQueryParameters = function(s) {
48
+  if (typeof s == 'undefined')
49
+    s = document.location.search;
50
+  var parts = s.substr(s.indexOf('?') + 1).split('&');
51
+  var result = {};
52
+  for (var i = 0; i < parts.length; i++) {
53
+    var tmp = parts[i].split('=', 2);
54
+    var key = jQuery.urldecode(tmp[0]);
55
+    var value = jQuery.urldecode(tmp[1]);
56
+    if (key in result)
57
+      result[key].push(value);
58
+    else
59
+      result[key] = [value];
60
+  }
61
+  return result;
62
+};
63
+
64
+/**
65
+ * small function to check if an array contains
66
+ * a given item.
67
+ */
68
+jQuery.contains = function(arr, item) {
69
+  for (var i = 0; i < arr.length; i++) {
70
+    if (arr[i] == item)
71
+      return true;
72
+  }
73
+  return false;
74
+};
75
+
76
+/**
77
+ * highlight a given string on a jquery object by wrapping it in
78
+ * span elements with the given class name.
79
+ */
80
+jQuery.fn.highlightText = function(text, className) {
81
+  function highlight(node) {
82
+    if (node.nodeType == 3) {
83
+      var val = node.nodeValue;
84
+      var pos = val.toLowerCase().indexOf(text);
85
+      if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
86
+        var span = document.createElement("span");
87
+        span.className = className;
88
+        span.appendChild(document.createTextNode(val.substr(pos, text.length)));
89
+        node.parentNode.insertBefore(span, node.parentNode.insertBefore(
90
+          document.createTextNode(val.substr(pos + text.length)),
91
+          node.nextSibling));
92
+        node.nodeValue = val.substr(0, pos);
93
+      }
94
+    }
95
+    else if (!jQuery(node).is("button, select, textarea")) {
96
+      jQuery.each(node.childNodes, function() {
97
+        highlight(this);
98
+      });
99
+    }
100
+  }
101
+  return this.each(function() {
102
+    highlight(this);
103
+  });
104
+};
105
+
106
+/**
107
+ * Small JavaScript module for the documentation.
108
+ */
109
+var Documentation = {
110
+
111
+  init : function() {
112
+    this.fixFirefoxAnchorBug();
113
+    this.highlightSearchWords();
114
+    this.initIndexTable();
115
+  },
116
+
117
+  /**
118
+   * i18n support
119
+   */
120
+  TRANSLATIONS : {},
121
+  PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
122
+  LOCALE : 'unknown',
123
+
124
+  // gettext and ngettext don't access this so that the functions
125
+  // can safely bound to a different name (_ = Documentation.gettext)
126
+  gettext : function(string) {
127
+    var translated = Documentation.TRANSLATIONS[string];
128
+    if (typeof translated == 'undefined')
129
+      return string;
130
+    return (typeof translated == 'string') ? translated : translated[0];
131
+  },
132
+
133
+  ngettext : function(singular, plural, n) {
134
+    var translated = Documentation.TRANSLATIONS[singular];
135
+    if (typeof translated == 'undefined')
136
+      return (n == 1) ? singular : plural;
137
+    return translated[Documentation.PLURALEXPR(n)];
138
+  },
139
+
140
+  addTranslations : function(catalog) {
141
+    for (var key in catalog.messages)
142
+      this.TRANSLATIONS[key] = catalog.messages[key];
143
+    this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
144
+    this.LOCALE = catalog.locale;
145
+  },
146
+
147
+  /**
148
+   * add context elements like header anchor links
149
+   */
150
+  addContextElements : function() {
151
+    $('div[id] > :header:first').each(function() {
152
+      $('<a class="headerlink">\u00B6</a>').
153
+      attr('href', '#' + this.id).
154
+      attr('title', _('Permalink to this headline')).
155
+      appendTo(this);
156
+    });
157
+    $('dt[id]').each(function() {
158
+      $('<a class="headerlink">\u00B6</a>').
159
+      attr('href', '#' + this.id).
160
+      attr('title', _('Permalink to this definition')).
161
+      appendTo(this);
162
+    });
163
+  },
164
+
165
+  /**
166
+   * workaround a firefox stupidity
167
+   */
168
+  fixFirefoxAnchorBug : function() {
169
+    if (document.location.hash && $.browser.mozilla)
170
+      window.setTimeout(function() {
171
+        document.location.href += '';
172
+      }, 10);
173
+  },
174
+
175
+  /**
176
+   * highlight the search words provided in the url in the text
177
+   */
178
+  highlightSearchWords : function() {
179
+    var params = $.getQueryParameters();
180
+    var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
181
+    if (terms.length) {
182
+      var body = $('div.body');
183
+      window.setTimeout(function() {
184
+        $.each(terms, function() {
185
+          body.highlightText(this.toLowerCase(), 'highlighted');
186
+        });
187
+      }, 10);
188
+      $('<li class="highlight-link"><a href="javascript:Documentation.' +
189
+        'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>')
190
+          .appendTo($('.sidebar .this-page-menu'));
191
+    }
192
+  },
193
+
194
+  /**
195
+   * init the domain index toggle buttons
196
+   */
197
+  initIndexTable : function() {
198
+    var togglers = $('img.toggler').click(function() {
199
+      var src = $(this).attr('src');
200
+      var idnum = $(this).attr('id').substr(7);
201
+      $('tr.cg-' + idnum).toggle();
202
+      if (src.substr(-9) == 'minus.png')
203
+        $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
204
+      else
205
+        $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
206
+    }).css('display', '');
207
+    if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
208
+        togglers.click();
209
+    }
210
+  },
211
+
212
+  /**
213
+   * helper function to hide the search marks again
214
+   */
215
+  hideSearchWords : function() {
216
+    $('.sidebar .this-page-menu li.highlight-link').fadeOut(300);
217
+    $('span.highlighted').removeClass('highlighted');
218
+  },
219
+
220
+  /**
221
+   * make the url absolute
222
+   */
223
+  makeURL : function(relativeURL) {
224
+    return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
225
+  },
226
+
227
+  /**
228
+   * get the current relative url
229
+   */
230
+  getCurrentURL : function() {
231
+    var path = document.location.pathname;
232
+    var parts = path.split(/\//);
233
+    $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
234
+      if (this == '..')
235
+        parts.pop();
236
+    });
237
+    var url = parts.join('/');
238
+    return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
239
+  }
240
+};
241
+
242
+// quick alias for translations
243
+_ = Documentation.gettext;
244
+
245
+$(document).ready(function() {
246
+  Documentation.init();
247
+});
0 248
new file mode 100644
1 249
Binary files /dev/null and b/doc/build/html/_static/file.png differ
2 250
new file mode 100644
... ...
@@ -0,0 +1,154 @@
1
+/*!
2
+ * jQuery JavaScript Library v1.4.2
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2010, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2010, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Sat Feb 13 22:33:48 2010 -0500
15
+ */
16
+(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
17
+e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
18
+j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
19
+"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
20
+true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
21
+Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
22
+(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
23
+a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
24
+"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
25
+function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
26
+c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
27
+L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
28
+"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
29
+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
30
+d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
31
+a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
32
+!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
33
+true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
34
+var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
35
+parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
36
+false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
37
+s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
38
+applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
39
+else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
40
+a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
41
+w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
42
+cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
43
+i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
44
+" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
45
+this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
46
+e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
47
+c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
48
+a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
49
+function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
50
+k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
51
+C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
52
+null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
53
+e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
54
+f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
55
+if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
56
+fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
57
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
58
+"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
59
+a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
60
+isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
61
+{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
62
+if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
63
+e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
64
+"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
65
+d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
66
+!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
67
+toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
68
+u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
69
+function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
70
+if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
71
+e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
72
+t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
73
+g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
74
+for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
75
+1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
76
+CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
77
+relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
78
+l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
79
+h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
80
+CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
81
+g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
82
+text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
83
+setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
84
+h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
85
+m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
86
+"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
87
+h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
88
+!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
89
+h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
90
+q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
91
+if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
92
+(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
93
+function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
94
+gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
95
+c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
96
+{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
97
+"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
98
+d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
99
+a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
100
+1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
101
+a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
102
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
103
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
104
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
105
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
106
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
107
+""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
108
+this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
109
+u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
110
+1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
111
+return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
112
+""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
113
+c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
114
+c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
115
+function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
116
+Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
117
+"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
118
+a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
119
+a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
120
+"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
121
+serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
122
+function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
123
+global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
124
+e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
125
+"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
126
+false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
127
+false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
128
+c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
129
+d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
130
+g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
131
+1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
132
+"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
133
+if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
134
+this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
135
+"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
136
+animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
137
+j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
138
+this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
139
+"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
140
+c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
141
+this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
142
+this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
143
+e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
144
+c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
145
+function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
146
+this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
147
+k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
148
+f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
149
+a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
150
+c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
151
+d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
152
+f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
153
+"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
154
+e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
0 155
new file mode 100644
1 156
Binary files /dev/null and b/doc/build/html/_static/minus.png differ
2 157
new file mode 100644
3 158
Binary files /dev/null and b/doc/build/html/_static/plus.png differ
4 159
new file mode 100644
... ...
@@ -0,0 +1,62 @@
1
+.highlight .hll { background-color: #ffffcc }
2
+.highlight  { background: #eeffcc; }
3
+.highlight .c { color: #408090; font-style: italic } /* Comment */
4
+.highlight .err { border: 1px solid #FF0000 } /* Error */
5
+.highlight .k { color: #007020; font-weight: bold } /* Keyword */
6
+.highlight .o { color: #666666 } /* Operator */
7
+.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
8
+.highlight .cp { color: #007020 } /* Comment.Preproc */
9
+.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
10
+.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
11
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
12
+.highlight .ge { font-style: italic } /* Generic.Emph */
13
+.highlight .gr { color: #FF0000 } /* Generic.Error */
14
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
15
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
16
+.highlight .go { color: #303030 } /* Generic.Output */
17
+.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
18
+.highlight .gs { font-weight: bold } /* Generic.Strong */
19
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
20
+.highlight .gt { color: #0040D0 } /* Generic.Traceback */
21
+.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
22
+.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
23
+.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
24
+.highlight .kp { color: #007020 } /* Keyword.Pseudo */
25
+.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
26
+.highlight .kt { color: #902000 } /* Keyword.Type */
27
+.highlight .m { color: #208050 } /* Literal.Number */
28
+.highlight .s { color: #4070a0 } /* Literal.String */
29
+.highlight .na { color: #4070a0 } /* Name.Attribute */
30
+.highlight .nb { color: #007020 } /* Name.Builtin */
31
+.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
32
+.highlight .no { color: #60add5 } /* Name.Constant */
33
+.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
34
+.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
35
+.highlight .ne { color: #007020 } /* Name.Exception */
36
+.highlight .nf { color: #06287e } /* Name.Function */
37
+.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
38
+.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
39
+.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
40
+.highlight .nv { color: #bb60d5 } /* Name.Variable */
41
+.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
42
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
43
+.highlight .mf { color: #208050 } /* Literal.Number.Float */
44
+.highlight .mh { color: #208050 } /* Literal.Number.Hex */
45
+.highlight .mi { color: #208050 } /* Literal.Number.Integer */
46
+.highlight .mo { color: #208050 } /* Literal.Number.Oct */
47
+.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
48
+.highlight .sc { color: #4070a0 } /* Literal.String.Char */
49
+.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
50
+.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
51
+.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
52
+.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
53
+.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
54
+.highlight .sx { color: #c65d09 } /* Literal.String.Other */
55
+.highlight .sr { color: #235388 } /* Literal.String.Regex */
56
+.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
57
+.highlight .ss { color: #517918 } /* Literal.String.Symbol */
58
+.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
59
+.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
60
+.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
61
+.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
62
+.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
0 63
\ No newline at end of file
1 64
new file mode 100644
... ...
@@ -0,0 +1,518 @@
1
+/*
2
+ * searchtools.js
3
+ * ~~~~~~~~~~~~~~
4
+ *
5
+ * Sphinx JavaScript utilties for the full-text search.
6
+ *
7
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+/**
13
+ * helper function to return a node containing the
14
+ * search summary for a given text. keywords is a list
15
+ * of stemmed words, hlwords is the list of normal, unstemmed
16
+ * words. the first one is used to find the occurance, the
17
+ * latter for highlighting it.
18
+ */
19
+
20
+jQuery.makeSearchSummary = function(text, keywords, hlwords) {
21
+  var textLower = text.toLowerCase();
22
+  var start = 0;
23
+  $.each(keywords, function() {
24
+    var i = textLower.indexOf(this.toLowerCase());
25
+    if (i > -1)
26
+      start = i;
27
+  });
28
+  start = Math.max(start - 120, 0);
29
+  var excerpt = ((start > 0) ? '...' : '') +
30
+  $.trim(text.substr(start, 240)) +
31
+  ((start + 240 - text.length) ? '...' : '');
32
+  var rv = $('<div class="context"></div>').text(excerpt);
33
+  $.each(hlwords, function() {
34
+    rv = rv.highlightText(this, 'highlighted');
35
+  });
36
+  return rv;
37
+}
38
+
39
+/**
40
+ * Porter Stemmer
41
+ */
42
+var PorterStemmer = function() {
43
+
44
+  var step2list = {
45
+    ational: 'ate',
46
+    tional: 'tion',
47
+    enci: 'ence',
48
+    anci: 'ance',
49
+    izer: 'ize',
50
+    bli: 'ble',
51
+    alli: 'al',
52
+    entli: 'ent',
53
+    eli: 'e',
54
+    ousli: 'ous',
55
+    ization: 'ize',
56
+    ation: 'ate',
57
+    ator: 'ate',
58
+    alism: 'al',
59
+    iveness: 'ive',
60
+    fulness: 'ful',
61
+    ousness: 'ous',
62
+    aliti: 'al',
63
+    iviti: 'ive',
64
+    biliti: 'ble',
65
+    logi: 'log'
66
+  };
67
+
68
+  var step3list = {
69
+    icate: 'ic',
70
+    ative: '',
71
+    alize: 'al',
72
+    iciti: 'ic',
73
+    ical: 'ic',
74
+    ful: '',
75
+    ness: ''
76
+  };
77
+
78
+  var c = "[^aeiou]";          // consonant
79
+  var v = "[aeiouy]";          // vowel
80
+  var C = c + "[^aeiouy]*";    // consonant sequence
81
+  var V = v + "[aeiou]*";      // vowel sequence
82
+
83
+  var mgr0 = "^(" + C + ")?" + V + C;                      // [C]VC... is m>0
84
+  var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$";    // [C]VC[V] is m=1
85
+  var mgr1 = "^(" + C + ")?" + V + C + V + C;              // [C]VCVC... is m>1
86
+  var s_v   = "^(" + C + ")?" + v;                         // vowel in stem
87
+
88
+  this.stemWord = function (w) {
89
+    var stem;
90
+    var suffix;
91
+    var firstch;
92
+    var origword = w;
93
+
94
+    if (w.length < 3)
95
+      return w;
96
+
97
+    var re;
98
+    var re2;
99
+    var re3;
100
+    var re4;
101
+
102
+    firstch = w.substr(0,1);
103
+    if (firstch == "y")
104
+      w = firstch.toUpperCase() + w.substr(1);
105
+
106
+    // Step 1a
107
+    re = /^(.+?)(ss|i)es$/;
108
+    re2 = /^(.+?)([^s])s$/;
109
+
110
+    if (re.test(w))
111
+      w = w.replace(re,"$1$2");
112
+    else if (re2.test(w))
113
+      w = w.replace(re2,"$1$2");
114
+
115
+    // Step 1b
116
+    re = /^(.+?)eed$/;
117
+    re2 = /^(.+?)(ed|ing)$/;
118
+    if (re.test(w)) {
119
+      var fp = re.exec(w);
120
+      re = new RegExp(mgr0);
121
+      if (re.test(fp[1])) {
122
+        re = /.$/;
123
+        w = w.replace(re,"");
124
+      }
125
+    }
126
+    else if (re2.test(w)) {
127
+      var fp = re2.exec(w);
128
+      stem = fp[1];
129
+      re2 = new RegExp(s_v);
130
+      if (re2.test(stem)) {
131
+        w = stem;
132
+        re2 = /(at|bl|iz)$/;
133
+        re3 = new RegExp("([^aeiouylsz])\\1$");
134
+        re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
135
+        if (re2.test(w))
136
+          w = w + "e";
137
+        else if (re3.test(w)) {
138
+          re = /.$/;
139
+          w = w.replace(re,"");
140
+        }
141
+        else if (re4.test(w))
142
+          w = w + "e";
143
+      }
144
+    }
145
+
146
+    // Step 1c
147
+    re = /^(.+?)y$/;
148
+    if (re.test(w)) {
149
+      var fp = re.exec(w);
150
+      stem = fp[1];
151
+      re = new RegExp(s_v);
152
+      if (re.test(stem))
153
+        w = stem + "i";
154
+    }
155
+
156
+    // Step 2
157
+    re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
158
+    if (re.test(w)) {
159
+      var fp = re.exec(w);
160
+      stem = fp[1];
161
+      suffix = fp[2];
162
+      re = new RegExp(mgr0);
163
+      if (re.test(stem))
164
+        w = stem + step2list[suffix];
165
+    }
166
+
167
+    // Step 3
168
+    re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
169
+    if (re.test(w)) {
170
+      var fp = re.exec(w);
171
+      stem = fp[1];
172
+      suffix = fp[2];
173
+      re = new RegExp(mgr0);
174
+      if (re.test(stem))
175
+        w = stem + step3list[suffix];
176
+    }
177
+
178
+    // Step 4
179
+    re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
180
+    re2 = /^(.+?)(s|t)(ion)$/;
181
+    if (re.test(w)) {
182
+      var fp = re.exec(w);
183
+      stem = fp[1];
184
+      re = new RegExp(mgr1);
185
+      if (re.test(stem))
186
+        w = stem;
187
+    }
188
+    else if (re2.test(w)) {
189
+      var fp = re2.exec(w);
190
+      stem = fp[1] + fp[2];
191
+      re2 = new RegExp(mgr1);
192
+      if (re2.test(stem))
193
+        w = stem;
194
+    }
195
+
196
+    // Step 5
197
+    re = /^(.+?)e$/;
198
+    if (re.test(w)) {
199
+      var fp = re.exec(w);
200
+      stem = fp[1];
201
+      re = new RegExp(mgr1);
202
+      re2 = new RegExp(meq1);
203
+      re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
204
+      if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
205
+        w = stem;
206
+    }
207
+    re = /ll$/;
208
+    re2 = new RegExp(mgr1);
209
+    if (re.test(w) && re2.test(w)) {
210
+      re = /.$/;
211
+      w = w.replace(re,"");
212
+    }
213
+
214
+    // and turn initial Y back to y
215
+    if (firstch == "y")
216
+      w = firstch.toLowerCase() + w.substr(1);
217
+    return w;
218
+  }
219
+}
220
+
221
+
222
+/**
223
+ * Search Module
224
+ */
225
+var Search = {
226
+
227
+  _index : null,
228
+  _queued_query : null,
229
+  _pulse_status : -1,
230
+
231
+  init : function() {
232
+      var params = $.getQueryParameters();
233
+      if (params.q) {
234
+          var query = params.q[0];
235
+          $('input[name="q"]')[0].value = query;
236
+          this.performSearch(query);
237
+      }
238
+  },
239
+
240
+  loadIndex : function(url) {
241
+    $.ajax({type: "GET", url: url, data: null, success: null,
242
+            dataType: "script", cache: true});
243
+  },
244
+
245
+  setIndex : function(index) {
246
+    var q;
247
+    this._index = index;
248
+    if ((q = this._queued_query) !== null) {
249
+      this._queued_query = null;
250
+      Search.query(q);
251
+    }
252
+  },
253
+
254
+  hasIndex : function() {
255
+      return this._index !== null;
256
+  },
257
+
258
+  deferQuery : function(query) {
259
+      this._queued_query = query;
260
+  },
261
+
262
+  stopPulse : function() {
263
+      this._pulse_status = 0;
264
+  },
265
+
266
+  startPulse : function() {
267
+    if (this._pulse_status >= 0)
268
+        return;
269
+    function pulse() {
270
+      Search._pulse_status = (Search._pulse_status + 1) % 4;
271
+      var dotString = '';
272
+      for (var i = 0; i < Search._pulse_status; i++)
273
+        dotString += '.';
274
+      Search.dots.text(dotString);
275
+      if (Search._pulse_status > -1)
276
+        window.setTimeout(pulse, 500);
277
+    };
278
+    pulse();
279
+  },
280
+
281
+  /**
282
+   * perform a search for something
283
+   */
284
+  performSearch : function(query) {
285
+    // create the required interface elements
286
+    this.out = $('#search-results');
287
+    this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
288
+    this.dots = $('<span></span>').appendTo(this.title);
289
+    this.status = $('<p style="display: none"></p>').appendTo(this.out);
290
+    this.output = $('<ul class="search"/>').appendTo(this.out);
291
+
292
+    $('#search-progress').text(_('Preparing search...'));
293
+    this.startPulse();
294
+
295
+    // index already loaded, the browser was quick!
296
+    if (this.hasIndex())
297
+      this.query(query);
298
+    else
299
+      this.deferQuery(query);
300
+  },
301
+
302
+  query : function(query) {
303
+    var stopwords = ['and', 'then', 'into', 'it', 'as', 'are', 'in',
304
+                     'if', 'for', 'no', 'there', 'their', 'was', 'is',
305
+                     'be', 'to', 'that', 'but', 'they', 'not', 'such',
306
+                     'with', 'by', 'a', 'on', 'these', 'of', 'will',
307
+                     'this', 'near', 'the', 'or', 'at'];
308
+
309
+    // stem the searchterms and add them to the correct list
310
+    var stemmer = new PorterStemmer();
311
+    var searchterms = [];
312
+    var excluded = [];
313
+    var hlterms = [];
314
+    var tmp = query.split(/\s+/);
315
+    var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null;
316
+    for (var i = 0; i < tmp.length; i++) {
317
+      if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
318
+          tmp[i] == "") {
319
+        // skip this "word"
320
+        continue;
321
+      }
322
+      // stem the word
323
+      var word = stemmer.stemWord(tmp[i]).toLowerCase();
324
+      // select the correct list
325
+      if (word[0] == '-') {
326
+        var toAppend = excluded;
327
+        word = word.substr(1);
328
+      }
329
+      else {
330
+        var toAppend = searchterms;
331
+        hlterms.push(tmp[i].toLowerCase());
332
+      }
333
+      // only add if not already in the list
334
+      if (!$.contains(toAppend, word))
335
+        toAppend.push(word);
336
+    };
337
+    var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
338
+
339
+    // console.debug('SEARCH: searching for:');
340
+    // console.info('required: ', searchterms);
341
+    // console.info('excluded: ', excluded);
342
+
343
+    // prepare search
344
+    var filenames = this._index.filenames;
345
+    var titles = this._index.titles;
346
+    var terms = this._index.terms;
347
+    var objects = this._index.objects;
348
+    var objtypes = this._index.objtypes;
349
+    var objnames = this._index.objnames;
350
+    var fileMap = {};
351
+    var files = null;
352
+    // different result priorities
353
+    var importantResults = [];
354
+    var objectResults = [];
355
+    var regularResults = [];
356
+    var unimportantResults = [];
357
+    $('#search-progress').empty();
358
+
359
+    // lookup as object
360
+    if (object != null) {
361
+      for (var prefix in objects) {
362
+        for (var name in objects[prefix]) {
363
+          var fullname = (prefix ? prefix + '.' : '') + name;
364
+          if (fullname.toLowerCase().indexOf(object) > -1) {
365
+            match = objects[prefix][name];
366
+            descr = objnames[match[1]] + _(', in ') + titles[match[0]];
367
+            // XXX the generated anchors are not generally correct
368
+            // XXX there may be custom prefixes
369
+            result = [filenames[match[0]], fullname, '#'+fullname, descr];
370
+            switch (match[2]) {
371
+            case 1: objectResults.push(result); break;
372
+            case 0: importantResults.push(result); break;
373
+            case 2: unimportantResults.push(result); break;
374
+            }
375
+          }
376
+        }
377
+      }
378
+    }
379
+
380
+    // sort results descending
381
+    objectResults.sort(function(a, b) {
382
+      return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
383
+    });
384
+
385
+    importantResults.sort(function(a, b) {
386
+      return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
387
+    });
388
+
389
+    unimportantResults.sort(function(a, b) {
390
+      return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
391
+    });
392
+
393
+
394
+    // perform the search on the required terms
395
+    for (var i = 0; i < searchterms.length; i++) {
396
+      var word = searchterms[i];
397
+      // no match but word was a required one
398
+      if ((files = terms[word]) == null)
399
+        break;
400
+      if (files.length == undefined) {
401
+        files = [files];
402
+      }
403
+      // create the mapping
404
+      for (var j = 0; j < files.length; j++) {
405
+        var file = files[j];
406
+        if (file in fileMap)
407
+          fileMap[file].push(word);
408
+        else
409
+          fileMap[file] = [word];
410
+      }
411
+    }
412
+
413
+    // now check if the files don't contain excluded terms
414
+    for (var file in fileMap) {
415
+      var valid = true;
416
+
417
+      // check if all requirements are matched
418
+      if (fileMap[file].length != searchterms.length)
419
+        continue;
420
+
421
+      // ensure that none of the excluded terms is in the
422
+      // search result.
423
+      for (var i = 0; i < excluded.length; i++) {
424
+        if (terms[excluded[i]] == file ||
425
+            $.contains(terms[excluded[i]] || [], file)) {
426
+          valid = false;
427
+          break;
428
+        }
429
+      }
430
+
431
+      // if we have still a valid result we can add it
432
+      // to the result list
433
+      if (valid)
434
+        regularResults.push([filenames[file], titles[file], '', null]);
435
+    }
436
+
437
+    // delete unused variables in order to not waste
438
+    // memory until list is retrieved completely
439
+    delete filenames, titles, terms;
440
+
441
+    // now sort the regular results descending by title
442
+    regularResults.sort(function(a, b) {
443
+      var left = a[1].toLowerCase();
444
+      var right = b[1].toLowerCase();
445
+      return (left > right) ? -1 : ((left < right) ? 1 : 0);
446
+    });
447
+
448
+    // combine all results
449
+    var results = unimportantResults.concat(regularResults)
450
+      .concat(objectResults).concat(importantResults);
451
+
452
+    // print the results
453
+    var resultCount = results.length;
454
+    function displayNextItem() {
455
+      // results left, load the summary and display it
456
+      if (results.length) {
457
+        var item = results.pop();
458
+        var listItem = $('<li style="display:none"></li>');
459
+        if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') {
460
+          // dirhtml builder
461
+          var dirname = item[0] + '/';
462
+          if (dirname.match(/\/index\/$/)) {
463
+            dirname = dirname.substring(0, dirname.length-6);
464
+          } else if (dirname == 'index/') {
465
+            dirname = '';
466
+          }
467
+          listItem.append($('<a/>').attr('href',
468
+            DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
469
+            highlightstring + item[2]).html(item[1]));
470
+        } else {
471
+          // normal html builders
472
+          listItem.append($('<a/>').attr('href',
473
+            item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
474
+            highlightstring + item[2]).html(item[1]));
475
+        }
476
+        if (item[3]) {
477
+          listItem.append($('<span> (' + item[3] + ')</span>'));
478
+          Search.output.append(listItem);
479
+          listItem.slideDown(5, function() {
480
+            displayNextItem();
481
+          });
482
+        } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
483
+          $.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
484
+                item[0] + '.txt', function(data) {
485
+            if (data != '') {
486
+              listItem.append($.makeSearchSummary(data, searchterms, hlterms));
487
+              Search.output.append(listItem);
488
+            }
489
+            listItem.slideDown(5, function() {
490
+              displayNextItem();
491
+            });
492
+          });
493
+        } else {
494
+          // no source available, just display title
495
+          Search.output.append(listItem);
496
+          listItem.slideDown(5, function() {
497
+            displayNextItem();
498
+          });
499
+        }
500
+      }
501
+      // search finished, update title and status message
502
+      else {
503
+        Search.stopPulse();
504
+        Search.title.text(_('Search Results'));
505
+        if (!resultCount)
506
+          Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
507
+        else
508
+            Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
509
+        Search.status.fadeIn(500);
510
+      }
511
+    }
512
+    displayNextItem();
513
+  }
514
+}
515
+
516
+$(document).ready(function() {
517
+  Search.init();
518
+});
0 519
new file mode 100644
... ...
@@ -0,0 +1,148 @@
1
+/*
2
+ * sidebar.js
3
+ * ~~~~~~~~~~
4
+ *
5
+ * This script makes the Sphinx sidebar collapsible.
6
+ *
7
+ * .sphinxsidebar contains .sphinxsidebarwrapper.  This script adds
8
+ * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
9
+ * used to collapse and expand the sidebar.
10
+ *
11
+ * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
12
+ * and the width of the sidebar and the margin-left of the document
13
+ * are decreased. When the sidebar is expanded the opposite happens.
14
+ * This script saves a per-browser/per-session cookie used to
15
+ * remember the position of the sidebar among the pages.
16
+ * Once the browser is closed the cookie is deleted and the position
17
+ * reset to the default (expanded).
18
+ *
19
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
20
+ * :license: BSD, see LICENSE for details.
21
+ *
22
+ */
23
+
24
+$(function() {
25
+  // global elements used by the functions.
26
+  // the 'sidebarbutton' element is defined as global after its
27
+  // creation, in the add_sidebar_button function
28
+  var bodywrapper = $('.bodywrapper');
29
+  var sidebar = $('.sphinxsidebar');
30
+  var sidebarwrapper = $('.sphinxsidebarwrapper');
31
+
32
+  // original margin-left of the bodywrapper and width of the sidebar
33
+  // with the sidebar expanded
34
+  var bw_margin_expanded = bodywrapper.css('margin-left');
35
+  var ssb_width_expanded = sidebar.width();
36
+
37
+  // margin-left of the bodywrapper and width of the sidebar
38
+  // with the sidebar collapsed
39
+  var bw_margin_collapsed = '.8em';
40
+  var ssb_width_collapsed = '.8em';
41
+
42
+  // colors used by the current theme
43
+  var dark_color = $('.related').css('background-color');
44
+  var light_color = $('.document').css('background-color');
45
+
46
+  function sidebar_is_collapsed() {
47
+    return sidebarwrapper.is(':not(:visible)');
48
+  }
49
+
50
+  function toggle_sidebar() {
51
+    if (sidebar_is_collapsed())
52
+      expand_sidebar();
53
+    else
54
+      collapse_sidebar();
55
+  }
56
+
57
+  function collapse_sidebar() {
58
+    sidebarwrapper.hide();
59
+    sidebar.css('width', ssb_width_collapsed);
60
+    bodywrapper.css('margin-left', bw_margin_collapsed);
61
+    sidebarbutton.css({
62
+        'margin-left': '0',
63
+        'height': bodywrapper.height()
64
+    });
65
+    sidebarbutton.find('span').text('»');
66
+    sidebarbutton.attr('title', _('Expand sidebar'));
67
+    document.cookie = 'sidebar=collapsed';
68
+  }
69
+
70
+  function expand_sidebar() {
71
+    bodywrapper.css('margin-left', bw_margin_expanded);
72
+    sidebar.css('width', ssb_width_expanded);
73
+    sidebarwrapper.show();
74
+    sidebarbutton.css({
75
+        'margin-left': ssb_width_expanded-12,
76
+        'height': bodywrapper.height()
77
+    });
78
+    sidebarbutton.find('span').text('«');
79
+    sidebarbutton.attr('title', _('Collapse sidebar'));
80
+    document.cookie = 'sidebar=expanded';
81
+  }
82
+
83
+  function add_sidebar_button() {
84
+    sidebarwrapper.css({
85
+        'float': 'left',
86
+        'margin-right': '0',
87
+        'width': ssb_width_expanded - 28
88
+    });
89
+    // create the button
90
+    sidebar.append(
91
+        '<div id="sidebarbutton"><span>&laquo;</span></div>'
92
+    );
93
+    var sidebarbutton = $('#sidebarbutton');
94
+    light_color = sidebarbutton.css('background-color');
95
+    // find the height of the viewport to center the '<<' in the page
96
+    var viewport_height;
97
+    if (window.innerHeight)
98
+ 	  viewport_height = window.innerHeight;
99
+    else
100
+	  viewport_height = $(window).height();
101
+    sidebarbutton.find('span').css({
102
+        'display': 'block',
103
+        'margin-top': (viewport_height - sidebar.position().top - 20) / 2
104
+    });
105
+
106
+    sidebarbutton.click(toggle_sidebar);
107
+    sidebarbutton.attr('title', _('Collapse sidebar'));
108
+    sidebarbutton.css({
109
+        'color': '#FFFFFF',
110
+        'border-left': '1px solid ' + dark_color,
111
+        'font-size': '1.2em',
112
+        'cursor': 'pointer',
113
+        'height': bodywrapper.height(),
114
+        'padding-top': '1px',
115
+        'margin-left': ssb_width_expanded - 12
116
+    });
117
+
118
+    sidebarbutton.hover(
119
+      function () {
120
+          $(this).css('background-color', dark_color);
121
+      },
122
+      function () {
123
+          $(this).css('background-color', light_color);
124
+      }
125
+    );
126
+  }
127
+
128
+  function set_position_from_cookie() {
129
+    if (!document.cookie)
130
+      return;
131
+    var items = document.cookie.split(';');
132
+    for(var k=0; k<items.length; k++) {
133
+      var key_val = items[k].split('=');
134
+      var key = key_val[0];
135
+      if (key == 'sidebar') {
136
+        var value = key_val[1];
137
+        if ((value == 'collapsed') && (!sidebar_is_collapsed()))
138
+          collapse_sidebar();
139
+        else if ((value == 'expanded') && (sidebar_is_collapsed()))
140
+          expand_sidebar();
141
+      }
142
+    }
143
+  }
144
+
145
+  add_sidebar_button();
146
+  var sidebarbutton = $('#sidebarbutton');
147
+  set_position_from_cookie();
148
+});
0 149
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+(function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.5";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e<f;e++)c.call(d,
2
+a[e],e,a);else{var g=b.keys(a);f=g.length;for(e=0;e<f;e++)c.call(d,a[g[e]],g[e],a)}}catch(h){if(h!=m)throw h;}return a};b.map=function(a,c,d){if(a&&b.isFunction(a.map))return a.map(c,d);var e=[];b.each(a,function(f,g,h){e.push(c.call(d,f,g,h))});return e};b.reduce=function(a,c,d,e){if(a&&b.isFunction(a.reduce))return a.reduce(b.bind(d,e),c);b.each(a,function(f,g,h){c=d.call(e,c,f,g,h)});return c};b.reduceRight=function(a,c,d,e){if(a&&b.isFunction(a.reduceRight))return a.reduceRight(b.bind(d,e),c);
3
+var f=b.clone(b.toArray(a)).reverse();b.each(f,function(g,h){c=d.call(e,c,g,h,a)});return c};b.detect=function(a,c,d){var e;b.each(a,function(f,g,h){if(c.call(d,f,g,h)){e=f;b.breakLoop()}});return e};b.select=function(a,c,d){if(a&&b.isFunction(a.filter))return a.filter(c,d);var e=[];b.each(a,function(f,g,h){c.call(d,f,g,h)&&e.push(f)});return e};b.reject=function(a,c,d){var e=[];b.each(a,function(f,g,h){!c.call(d,f,g,h)&&e.push(f)});return e};b.all=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.every))return a.every(c,
4
+d);var e=true;b.each(a,function(f,g,h){(e=e&&c.call(d,f,g,h))||b.breakLoop()});return e};b.any=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.some))return a.some(c,d);var e=false;b.each(a,function(f,g,h){if(e=c.call(d,f,g,h))b.breakLoop()});return e};b.include=function(a,c){if(b.isArray(a))return b.indexOf(a,c)!=-1;var d=false;b.each(a,function(e){if(d=e===c)b.breakLoop()});return d};b.invoke=function(a,c){var d=b.rest(arguments,2);return b.map(a,function(e){return(c?e[c]:e).apply(e,d)})};b.pluck=
5
+function(a,c){return b.map(a,function(d){return d[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g>=e.computed&&(e={value:f,computed:g})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g<e.computed&&(e={value:f,computed:g})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,
6
+function(e,f,g){return{value:e,criteria:c.call(d,e,f,g)}}).sort(function(e,f){e=e.criteria;f=f.criteria;return e<f?-1:e>f?1:0}),"value")};b.sortedIndex=function(a,c,d){d=d||b.identity;for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?(e=g+1):(f=g)}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return a;if(b.isArguments(a))return k.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=function(a,c,d){return c&&!d?k.call(a,
7
+0,c):a[0]};b.rest=function(a,c,d){return k.call(a,b.isUndefined(c)||d?1:c)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.select(a,function(c){return!!c})};b.flatten=function(a){return b.reduce(a,[],function(c,d){if(b.isArray(d))return c.concat(b.flatten(d));c.push(d);return c})};b.without=function(a){var c=b.rest(arguments);return b.select(a,function(d){return!b.include(c,d)})};b.uniq=function(a,c){return b.reduce(a,[],function(d,e,f){if(0==f||(c===true?b.last(d)!=e:!b.include(d,
8
+e)))d.push(e);return d})};b.intersect=function(a){var c=b.rest(arguments);return b.select(b.uniq(a),function(d){return b.all(c,function(e){return b.indexOf(e,d)>=0})})};b.zip=function(){for(var a=b.toArray(arguments),c=b.max(b.pluck(a,"length")),d=new Array(c),e=0;e<c;e++)d[e]=b.pluck(a,String(e));return d};b.indexOf=function(a,c){if(a.indexOf)return a.indexOf(c);for(var d=0,e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a.lastIndexOf)return a.lastIndexOf(c);for(var d=
9
+a.length;d--;)if(a[d]===c)return d;return-1};b.range=function(a,c,d){var e=b.toArray(arguments),f=e.length<=1;a=f?0:e[0];c=f?e[0]:e[1];d=e[2]||1;e=Math.ceil((c-a)/d);if(e<=0)return[];e=new Array(e);f=a;for(var g=0;1;f+=d){if((d>0?f-c:c-f)>=0)return e;e[g++]=f}};b.bind=function(a,c){var d=b.rest(arguments,2);return function(){return a.apply(c||j,d.concat(b.toArray(arguments)))}};b.bindAll=function(a){var c=b.rest(arguments);if(c.length==0)c=b.functions(a);b.each(c,function(d){a[d]=b.bind(a[d],a)});
10
+return a};b.delay=function(a,c){var d=b.rest(arguments,2);return setTimeout(function(){return a.apply(a,d)},c)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(b.rest(arguments)))};b.wrap=function(a,c){return function(){var d=[a].concat(b.toArray(arguments));return c.apply(c,d)}};b.compose=function(){var a=b.toArray(arguments);return function(){for(var c=b.toArray(arguments),d=a.length-1;d>=0;d--)c=[a[d].apply(this,c)];return c[0]}};b.keys=function(a){if(b.isArray(a))return b.range(0,a.length);
11
+var c=[];for(var d in a)q.call(a,d)&&c.push(d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=function(a){return b.select(b.keys(a),function(c){return b.isFunction(a[c])}).sort()};b.extend=function(a,c){for(var d in c)a[d]=c[d];return a};b.clone=function(a){if(b.isArray(a))return a.slice(0);return b.extend({},a)};b.tap=function(a,c){c(a);return a};b.isEqual=function(a,c){if(a===c)return true;var d=typeof a;if(d!=typeof c)return false;if(a==c)return true;if(!a&&c||a&&!c)return false;
12
+if(a.isEqual)return a.isEqual(c);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return true;if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return false;if(a.length&&a.length!==c.length)return false;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return false;for(var f in a)if(!b.isEqual(a[f],c[f]))return false;return true};b.isEmpty=function(a){return b.keys(a).length==
13
+0};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=function(a){return!!(a&&a.concat&&a.unshift)};b.isArguments=function(a){return a&&b.isNumber(a.length)&&!b.isArray(a)&&!r.call(a,"length")};b.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return p.call(a)==="[object Number]"};b.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};b.isRegExp=function(a){return!!(a&&
14
+a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};b.isNaN=function(a){return b.isNumber(a)&&isNaN(a)};b.isNull=function(a){return a===null};b.isUndefined=function(a){return typeof a=="undefined"};b.noConflict=function(){j._=n;return this};b.identity=function(a){return a};b.breakLoop=function(){throw m;};var s=0;b.uniqueId=function(a){var c=s++;return a?a+c:c};b.template=function(a,c){a=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g,
15
+" ").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"',$1,'").split("<%").join("');").split("%>").join("p.push('")+"');}return p.join('');");return c?a(c):a};b.forEach=b.each;b.foldl=b.inject=b.reduce;b.foldr=b.reduceRight;b.filter=b.select;b.every=b.all;b.some=b.any;b.head=b.first;b.tail=b.rest;b.methods=b.functions;var l=function(a,c){return c?b(a).chain():a};b.each(b.functions(b),function(a){var c=b[a];i.prototype[a]=function(){var d=b.toArray(arguments);
16
+o.call(d,this._wrapped);return l(c.apply(b,d),this._chain)}});b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){c.apply(this._wrapped,arguments);return l(this._wrapped,this._chain)}});b.each(["concat","join","slice"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){return l(c.apply(this._wrapped,arguments),this._chain)}});i.prototype.chain=function(){this._chain=true;return this};i.prototype.value=function(){return this._wrapped}})();
0 17
new file mode 100644
... ...
@@ -0,0 +1,193 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>Index &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="index.html" /> 
26
+  </head>
27
+  <body>
28
+    <div class="related">
29
+      <h3>Navigation</h3>
30
+      <ul>
31
+        <li class="right" style="margin-right: 10px">
32
+          <a href="#" title="General Index"
33
+             accesskey="I">index</a></li>
34
+        <li class="right" >
35
+          <a href="py-modindex.html" title="Python Module Index"
36
+             >modules</a> |</li>
37
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
38
+      </ul>
39
+    </div>  
40
+
41
+    <div class="document">
42
+      <div class="documentwrapper">
43
+        <div class="bodywrapper">
44
+          <div class="body">
45
+            
46
+
47
+   <h1 id="index">Index</h1>
48
+
49
+   <div class="genindex-jumpbox">
50
+   <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#J"><strong>J</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#S"><strong>S</strong></a> 
51
+   </div>
52
+<h2 id="B">B</h2>
53
+<table style="width: 100%" class="indextable genindextable"><tr>
54
+  <td style="width: 33%" valign="top"><dl>
55
+    <dt><a href="proxy.html#jsonrpc.proxy.JSONRPCProxy.batch_call">batch_call() (jsonrpc.proxy.JSONRPCProxy method)</a></dt>
56
+</dl></td>
57
+</tr></table>
58
+
59
+<h2 id="C">C</h2>
60
+<table style="width: 100%" class="indextable genindextable"><tr>
61
+  <td style="width: 33%" valign="top"><dl>
62
+    <dt><a href="proxy.html#jsonrpc.proxy.JSONRPCProxy.call">call() (jsonrpc.proxy.JSONRPCProxy method)</a></dt>
63
+    <dt><a href="server.html#jsonrpc.server.ServerEvents.callmethod">callmethod() (jsonrpc.server.ServerEvents method)</a></dt>
64
+</dl></td>
65
+  <td style="width: 33%" valign="top"><dl>
66
+    <dt><a href="server.html#jsonrpc.server.JSON_RPC.customize">customize() (jsonrpc.server.JSON_RPC method)</a></dt>
67
+</dl></td>
68
+</tr></table>
69
+
70
+<h2 id="D">D</h2>
71
+<table style="width: 100%" class="indextable genindextable"><tr>
72
+  <td style="width: 33%" valign="top"><dl>
73
+    <dt><a href="jsonutil.html#jsonrpc.jsonutil.decode">decode() (in module jsonrpc.jsonutil)</a></dt>
74
+</dl></td>
75
+</tr></table>
76
+
77
+<h2 id="E">E</h2>
78
+<table style="width: 100%" class="indextable genindextable"><tr>
79
+  <td style="width: 33%" valign="top"><dl>
80
+    <dt><a href="jsonutil.html#jsonrpc.jsonutil.encode">encode() (in module jsonrpc.jsonutil)</a></dt>
81
+</dl></td>
82
+  <td style="width: 33%" valign="top"><dl>
83
+    <dt><a href="server.html#jsonrpc.server.JSON_RPC.eventhandler">eventhandler (jsonrpc.server.JSON_RPC attribute)</a></dt>
84
+</dl></td>
85
+</tr></table>
86
+
87
+<h2 id="F">F</h2>
88
+<table style="width: 100%" class="indextable genindextable"><tr>
89
+  <td style="width: 33%" valign="top"><dl>
90
+    <dt><a href="proxy.html#jsonrpc.proxy.JSONRPCProxy.from_url">from_url() (jsonrpc.proxy.JSONRPCProxy class method)</a></dt>
91
+</dl></td>
92
+</tr></table>
93
+
94
+<h2 id="G">G</h2>
95
+<table style="width: 100%" class="indextable genindextable"><tr>
96
+  <td style="width: 33%" valign="top"><dl>
97
+    <dt><a href="proxy.html#jsonrpc.proxy.ProxyEvents.get_postdata">get_postdata() (jsonrpc.proxy.ProxyEvents method)</a></dt>
98
+</dl></td>
99
+</tr></table>
100
+
101
+<h2 id="I">I</h2>
102
+<table style="width: 100%" class="indextable genindextable"><tr>
103
+  <td style="width: 33%" valign="top"><dl>
104
+    <dt><a href="proxy.html#jsonrpc.proxy.ProxyEvents.IDGen">IDGen (jsonrpc.proxy.ProxyEvents attribute)</a></dt>
105
+</dl></td>
106
+</tr></table>
107
+
108
+<h2 id="J">J</h2>
109
+<table style="width: 100%" class="indextable genindextable"><tr>
110
+  <td style="width: 33%" valign="top"><dl>
111
+    <dt><a href="server.html#jsonrpc.server.JSON_RPC">JSON_RPC (class in jsonrpc.server)</a></dt>
112
+    <dt><a href="jsonutil.html#module-jsonrpc.jsonutil">jsonrpc.jsonutil (module)</a></dt>
113
+    <dt><a href="proxy.html#module-jsonrpc.proxy">jsonrpc.proxy (module)</a></dt>
114
+</dl></td>
115
+  <td style="width: 33%" valign="top"><dl>
116
+    <dt><a href="server.html#module-jsonrpc.server">jsonrpc.server (module)</a></dt>
117
+    <dt><a href="proxy.html#jsonrpc.proxy.JSONRPCProxy">JSONRPCProxy (class in jsonrpc.proxy)</a></dt>
118
+</dl></td>
119
+</tr></table>
120
+
121
+<h2 id="L">L</h2>
122
+<table style="width: 100%" class="indextable genindextable"><tr>
123
+  <td style="width: 33%" valign="top"><dl>
124
+    <dt><a href="server.html#jsonrpc.server.ServerEvents.logerror">logerror() (jsonrpc.server.ServerEvents method)</a></dt>
125
+</dl></td>
126
+</tr></table>
127
+
128
+<h2 id="P">P</h2>
129
+<table style="width: 100%" class="indextable genindextable"><tr>
130
+  <td style="width: 33%" valign="top"><dl>
131
+    <dt><a href="proxy.html#jsonrpc.proxy.ProxyEvents.proc_response">proc_response() (jsonrpc.proxy.ProxyEvents method)</a></dt>
132
+    <dt><a href="server.html#jsonrpc.server.ServerEvents.processrequest">processrequest() (jsonrpc.server.ServerEvents method)</a></dt>
133
+</dl></td>
134
+  <td style="width: 33%" valign="top"><dl>
135
+    <dt><a href="proxy.html#jsonrpc.proxy.ProxyEvents">ProxyEvents (class in jsonrpc.proxy)</a></dt>
136
+</dl></td>
137
+</tr></table>
138
+
139
+<h2 id="S">S</h2>
140
+<table style="width: 100%" class="indextable genindextable"><tr>
141
+  <td style="width: 33%" valign="top"><dl>
142
+    <dt><a href="server.html#jsonrpc.server.ServerEvents.server">server (jsonrpc.server.ServerEvents attribute)</a></dt>
143
+</dl></td>
144
+  <td style="width: 33%" valign="top"><dl>
145
+    <dt><a href="server.html#jsonrpc.server.ServerEvents">ServerEvents (class in jsonrpc.server)</a></dt>
146
+</dl></td>
147
+</tr></table>
148
+
149
+
150
+
151
+          </div>
152
+        </div>
153
+      </div>
154
+      <div class="sphinxsidebar">
155
+        <div class="sphinxsidebarwrapper">
156
+
157
+   
158
+
159
+<div id="searchbox" style="display: none">
160
+  <h3>Quick search</h3>
161
+    <form class="search" action="search.html" method="get">
162
+      <input type="text" name="q" size="18" />
163
+      <input type="submit" value="Go" />
164
+      <input type="hidden" name="check_keywords" value="yes" />
165
+      <input type="hidden" name="area" value="default" />
166
+    </form>
167
+    <p class="searchtip" style="font-size: 90%">
168
+    Enter search terms or a module, class or function name.
169
+    </p>
170
+</div>
171
+<script type="text/javascript">$('#searchbox').show(0);</script>
172
+        </div>
173
+      </div>
174
+      <div class="clearer"></div>
175
+    </div>
176
+    <div class="related">
177
+      <h3>Navigation</h3>
178
+      <ul>
179
+        <li class="right" style="margin-right: 10px">
180
+          <a href="#" title="General Index"
181
+             >index</a></li>
182
+        <li class="right" >
183
+          <a href="py-modindex.html" title="Python Module Index"
184
+             >modules</a> |</li>
185
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
186
+      </ul>
187
+    </div>
188
+    <div class="footer">
189
+        &copy; Copyright 2011, Edward Langley.
190
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
191
+    </div>
192
+  </body>
193
+</html>
0 194
\ No newline at end of file
1 195
new file mode 100644
... ...
@@ -0,0 +1,129 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>Welcome to JSONRPC’s documentation! &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="#" />
26
+    <link rel="next" title="JSON-RPC Server" href="server.html" /> 
27
+  </head>
28
+  <body>
29
+    <div class="related">
30
+      <h3>Navigation</h3>
31
+      <ul>
32
+        <li class="right" style="margin-right: 10px">
33
+          <a href="genindex.html" title="General Index"
34
+             accesskey="I">index</a></li>
35
+        <li class="right" >
36
+          <a href="py-modindex.html" title="Python Module Index"
37
+             >modules</a> |</li>
38
+        <li class="right" >
39
+          <a href="server.html" title="JSON-RPC Server"
40
+             accesskey="N">next</a> |</li>
41
+        <li><a href="#">JSONRPC v1.0 documentation</a> &raquo;</li> 
42
+      </ul>
43
+    </div>  
44
+
45
+    <div class="document">
46
+      <div class="documentwrapper">
47
+        <div class="bodywrapper">
48
+          <div class="body">
49
+            
50
+  <div class="section" id="welcome-to-jsonrpc-s-documentation">
51
+<h1>Welcome to JSONRPC&#8217;s documentation!<a class="headerlink" href="#welcome-to-jsonrpc-s-documentation" title="Permalink to this headline">¶</a></h1>
52
+<p>Contents:</p>
53
+<div class="toctree-wrapper compound">
54
+<ul>
55
+<li class="toctree-l1"><a class="reference internal" href="server.html">JSON-RPC Server</a></li>
56
+<li class="toctree-l1"><a class="reference internal" href="proxy.html">JSON-RPC Proxy</a></li>
57
+<li class="toctree-l1"><a class="reference internal" href="jsonutil.html">jsonrpc.jsonutil</a></li>
58
+</ul>
59
+</div>
60
+</div>
61
+<div class="section" id="indices-and-tables">
62
+<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
63
+<ul class="simple">
64
+<li><a class="reference internal" href="genindex.html"><em>Index</em></a></li>
65
+<li><a class="reference internal" href="py-modindex.html"><em>Module Index</em></a></li>
66
+<li><a class="reference internal" href="search.html"><em>Search Page</em></a></li>
67
+</ul>
68
+</div>
69
+
70
+
71
+          </div>
72
+        </div>
73
+      </div>
74
+      <div class="sphinxsidebar">
75
+        <div class="sphinxsidebarwrapper">
76
+  <h3><a href="#">Table Of Contents</a></h3>
77
+  <ul>
78
+<li><a class="reference internal" href="#">Welcome to JSONRPC&#8217;s documentation!</a><ul>
79
+</ul>
80
+</li>
81
+<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
82
+</ul>
83
+
84
+  <h4>Next topic</h4>
85
+  <p class="topless"><a href="server.html"
86
+                        title="next chapter">JSON-RPC Server</a></p>
87
+  <h3>This Page</h3>
88
+  <ul class="this-page-menu">
89
+    <li><a href="_sources/index.txt"
90
+           rel="nofollow">Show Source</a></li>
91
+  </ul>
92
+<div id="searchbox" style="display: none">
93
+  <h3>Quick search</h3>
94
+    <form class="search" action="search.html" method="get">
95
+      <input type="text" name="q" size="18" />
96
+      <input type="submit" value="Go" />
97
+      <input type="hidden" name="check_keywords" value="yes" />
98
+      <input type="hidden" name="area" value="default" />
99
+    </form>
100
+    <p class="searchtip" style="font-size: 90%">
101
+    Enter search terms or a module, class or function name.
102
+    </p>
103
+</div>
104
+<script type="text/javascript">$('#searchbox').show(0);</script>
105
+        </div>
106
+      </div>
107
+      <div class="clearer"></div>
108
+    </div>
109
+    <div class="related">
110
+      <h3>Navigation</h3>
111
+      <ul>
112
+        <li class="right" style="margin-right: 10px">
113
+          <a href="genindex.html" title="General Index"
114
+             >index</a></li>
115
+        <li class="right" >
116
+          <a href="py-modindex.html" title="Python Module Index"
117
+             >modules</a> |</li>
118
+        <li class="right" >
119
+          <a href="server.html" title="JSON-RPC Server"
120
+             >next</a> |</li>
121
+        <li><a href="#">JSONRPC v1.0 documentation</a> &raquo;</li> 
122
+      </ul>
123
+    </div>
124
+    <div class="footer">
125
+        &copy; Copyright 2011, Edward Langley.
126
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
127
+    </div>
128
+  </body>
129
+</html>
0 130
\ No newline at end of file
1 131
new file mode 100644
... ...
@@ -0,0 +1,140 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>jsonrpc.jsonutil &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="index.html" />
26
+    <link rel="prev" title="JSON-RPC Proxy" href="proxy.html" /> 
27
+  </head>
28
+  <body>
29
+    <div class="related">
30
+      <h3>Navigation</h3>
31
+      <ul>
32
+        <li class="right" style="margin-right: 10px">
33
+          <a href="genindex.html" title="General Index"
34
+             accesskey="I">index</a></li>
35
+        <li class="right" >
36
+          <a href="py-modindex.html" title="Python Module Index"
37
+             >modules</a> |</li>
38
+        <li class="right" >
39
+          <a href="proxy.html" title="JSON-RPC Proxy"
40
+             accesskey="P">previous</a> |</li>
41
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
42
+      </ul>
43
+    </div>  
44
+
45
+    <div class="document">
46
+      <div class="documentwrapper">
47
+        <div class="bodywrapper">
48
+          <div class="body">
49
+            
50
+  <div class="section" id="module-jsonrpc.jsonutil">
51
+<span id="jsonrpc-jsonutil"></span><h1>jsonrpc.jsonutil<a class="headerlink" href="#module-jsonrpc.jsonutil" title="Permalink to this headline">¶</a></h1>
52
+<p>This module is primarily a wrapper around simplejson in order to make
53
+it behave like demjson</p>
54
+<ul>
55
+<li><dl class="first docutils">
56
+<dt>If an object being encoded has a &#8216;json_equivalent&#8217; attribute, that will be called to get a (more)</dt>
57
+<dd><p class="first last">serializable object</p>
58
+</dd>
59
+</dl>
60
+</li>
61
+<li><dl class="first docutils">
62
+<dt>if it has an &#8216;items&#8217; method, it will be called</dt>
63
+<dd><ul class="first last simple">
64
+<li>if it defines both items and iteritems, the second will be used)</li>
65
+</ul>
66
+</dd>
67
+</dl>
68
+</li>
69
+<li><p class="first">if it is iterable, it will be made into a list</p>
70
+</li>
71
+<li><p class="first">otherwise &#8216;str&#8217; will be called on the object, and that result will be used</p>
72
+</li>
73
+</ul>
74
+<dl class="function">
75
+<dt id="jsonrpc.jsonutil.encode">
76
+<tt class="descclassname">jsonrpc.jsonutil.</tt><tt class="descname">encode</tt><big>(</big><em>obj</em>, <em>skipkeys=False</em>, <em>ensure_ascii=True</em>, <em>check_circular=True</em>, <em>allow_nan=True</em>, <em>cls=None</em>, <em>indent=None</em>, <em>separators=None</em>, <em>encoding='utf-8'</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#jsonrpc.jsonutil.encode" title="Permalink to this definition">¶</a></dt>
77
+<dd><p>Serialize obj to json, if it is not of a type which the encoder can handle,
78
+make it the proper type. Args and kw are as in json.dumps</p>
79
+</dd></dl>
80
+
81
+<dl class="function">
82
+<dt id="jsonrpc.jsonutil.decode">
83
+<tt class="descclassname">jsonrpc.jsonutil.</tt><tt class="descname">decode</tt><big>(</big><em>str</em>, <em>encoding=None</em>, <em>cls=None</em>, <em>object_hook=None</em>, <em>parse_float=None</em>, <em>parse_int=None</em>, <em>parse_constant=None</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#jsonrpc.jsonutil.decode" title="Permalink to this definition">¶</a></dt>
84
+<dd><p>Return an object from a json string.  This is just <a class="reference external" href="http://docs.python.org/2.7/library/json.html#json.loads" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">json.loads()</span></tt></a> renamed</p>
85
+</dd></dl>
86
+
87
+</div>
88
+
89
+
90
+          </div>
91
+        </div>
92
+      </div>
93
+      <div class="sphinxsidebar">
94
+        <div class="sphinxsidebarwrapper">
95
+  <h4>Previous topic</h4>
96
+  <p class="topless"><a href="proxy.html"
97
+                        title="previous chapter">JSON-RPC Proxy</a></p>
98
+  <h3>This Page</h3>
99
+  <ul class="this-page-menu">
100
+    <li><a href="_sources/jsonutil.txt"
101
+           rel="nofollow">Show Source</a></li>
102
+  </ul>
103
+<div id="searchbox" style="display: none">
104
+  <h3>Quick search</h3>
105
+    <form class="search" action="search.html" method="get">
106
+      <input type="text" name="q" size="18" />
107
+      <input type="submit" value="Go" />
108
+      <input type="hidden" name="check_keywords" value="yes" />
109
+      <input type="hidden" name="area" value="default" />
110
+    </form>
111
+    <p class="searchtip" style="font-size: 90%">
112
+    Enter search terms or a module, class or function name.
113
+    </p>
114
+</div>
115
+<script type="text/javascript">$('#searchbox').show(0);</script>
116
+        </div>
117
+      </div>
118
+      <div class="clearer"></div>
119
+    </div>
120
+    <div class="related">
121
+      <h3>Navigation</h3>
122
+      <ul>
123
+        <li class="right" style="margin-right: 10px">
124
+          <a href="genindex.html" title="General Index"
125
+             >index</a></li>
126
+        <li class="right" >
127
+          <a href="py-modindex.html" title="Python Module Index"
128
+             >modules</a> |</li>
129
+        <li class="right" >
130
+          <a href="proxy.html" title="JSON-RPC Proxy"
131
+             >previous</a> |</li>
132
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
133
+      </ul>
134
+    </div>
135
+    <div class="footer">
136
+        &copy; Copyright 2011, Edward Langley.
137
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
138
+    </div>
139
+  </body>
140
+</html>
0 141
\ No newline at end of file
1 142
new file mode 100644
2 143
Binary files /dev/null and b/doc/build/html/objects.inv differ
3 144
new file mode 100644
... ...
@@ -0,0 +1,194 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>JSON-RPC Proxy &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="index.html" />
26
+    <link rel="next" title="jsonrpc.jsonutil" href="jsonutil.html" />
27
+    <link rel="prev" title="JSON-RPC Server" href="server.html" /> 
28
+  </head>
29
+  <body>
30
+    <div class="related">
31
+      <h3>Navigation</h3>
32
+      <ul>
33
+        <li class="right" style="margin-right: 10px">
34
+          <a href="genindex.html" title="General Index"
35
+             accesskey="I">index</a></li>
36
+        <li class="right" >
37
+          <a href="py-modindex.html" title="Python Module Index"
38
+             >modules</a> |</li>
39
+        <li class="right" >
40
+          <a href="jsonutil.html" title="jsonrpc.jsonutil"
41
+             accesskey="N">next</a> |</li>
42
+        <li class="right" >
43
+          <a href="server.html" title="JSON-RPC Server"
44
+             accesskey="P">previous</a> |</li>
45
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
46
+      </ul>
47
+    </div>  
48
+
49
+    <div class="document">
50
+      <div class="documentwrapper">
51
+        <div class="bodywrapper">
52
+          <div class="body">
53
+            
54
+  <div class="section" id="module-jsonrpc.proxy">
55
+<span id="json-rpc-proxy"></span><h1>JSON-RPC Proxy<a class="headerlink" href="#module-jsonrpc.proxy" title="Permalink to this headline">¶</a></h1>
56
+<dl class="class">
57
+<dt id="jsonrpc.proxy.JSONRPCProxy">
58
+<em class="property">class </em><tt class="descclassname">jsonrpc.proxy.</tt><tt class="descname">JSONRPCProxy</tt><big>(</big><em>host</em>, <em>path='/jsonrpc'</em>, <em>serviceName=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy" title="Permalink to this definition">¶</a></dt>
59
+<dd><p>A class implementing a JSON-RPC Proxy.</p>
60
+<table class="docutils field-list" frame="void" rules="none">
61
+<col class="field-name" />
62
+<col class="field-body" />
63
+<tbody valign="top">
64
+<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
65
+<li><strong>host</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; The HTTP server hosting the JSON-RPC server</li>
66
+<li><strong>path</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; The path where the JSON-RPC server can be found</li>
67
+</ul>
68
+</td>
69
+</tr>
70
+</tbody>
71
+</table>
72
+<p>There are two ways of instantiating this class:
73
+- JSONRPCProxy.from_url(url) &#8211; give the absolute url to the JSON-RPC server
74
+- JSONRPC(host, path) &#8211; break up the url into smaller parts</p>
75
+<dl class="method">
76
+<dt id="jsonrpc.proxy.JSONRPCProxy.batch_call">
77
+<tt class="descname">batch_call</tt><big>(</big><em>names</em>, <em>*params</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy.batch_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy.batch_call" title="Permalink to this definition">¶</a></dt>
78
+<dd><p>call several methods at once, return a list of (result, error) pairs</p>
79
+<table class="docutils field-list" frame="void" rules="none">
80
+<col class="field-name" />
81
+<col class="field-body" />
82
+<tbody valign="top">
83
+<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
84
+<li><strong>names</strong> &#8211; a list of method names</li>
85
+<li><strong>*params</strong> &#8211; a list of (arg,kwarg) pairs corresponding to each method name</li>
86
+</ul>
87
+</td>
88
+</tr>
89
+</tbody>
90
+</table>
91
+</dd></dl>
92
+
93
+<dl class="method">
94
+<dt id="jsonrpc.proxy.JSONRPCProxy.call">
95
+<tt class="descname">call</tt><big>(</big><em>method</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy.call" title="Permalink to this definition">¶</a></dt>
96
+<dd><p>call a JSON-RPC method</p>
97
+<p>It&#8217;s better to use instance.&lt;methodname&gt;(*args, **kwargs),
98
+but this version might be useful occasionally</p>
99
+</dd></dl>
100
+
101
+<dl class="classmethod">
102
+<dt id="jsonrpc.proxy.JSONRPCProxy.from_url">
103
+<em class="property">classmethod </em><tt class="descname">from_url</tt><big>(</big><em>url</em>, <em>ctxid=None</em>, <em>serviceName=None</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy.from_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy.from_url" title="Permalink to this definition">¶</a></dt>
104
+<dd><p>Create a JSONRPCProxy from a URL</p>
105
+</dd></dl>
106
+
107
+</dd></dl>
108
+
109
+<dl class="class">
110
+<dt id="jsonrpc.proxy.ProxyEvents">
111
+<em class="property">class </em><tt class="descclassname">jsonrpc.proxy.</tt><tt class="descname">ProxyEvents</tt><big>(</big><em>proxy</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#ProxyEvents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents" title="Permalink to this definition">¶</a></dt>
112
+<dd><p>An event handler for JSONRPCProxy</p>
113
+<p>Allow a subclass to do its own initialization, gets any arguments leftover from __init__</p>
114
+<dl class="attribute">
115
+<dt id="jsonrpc.proxy.ProxyEvents.IDGen">
116
+<tt class="descname">IDGen</tt><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents.IDGen" title="Permalink to this definition">¶</a></dt>
117
+<dd><p>an instance of a class which defines a __get__ method, used to generate a request id</p>
118
+</dd></dl>
119
+
120
+<dl class="method">
121
+<dt id="jsonrpc.proxy.ProxyEvents.get_postdata">
122
+<tt class="descname">get_postdata</tt><big>(</big><em>args</em>, <em>kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#ProxyEvents.get_postdata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents.get_postdata" title="Permalink to this definition">¶</a></dt>
123
+<dd><p>allow a subclass to modify the method&#8217;s arguments</p>
124
+<p>e.g. if an authentication token is necessary, the subclass can automatically insert it into every call</p>
125
+</dd></dl>
126
+
127
+<dl class="method">
128
+<dt id="jsonrpc.proxy.ProxyEvents.proc_response">
129
+<tt class="descname">proc_response</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#ProxyEvents.proc_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents.proc_response" title="Permalink to this definition">¶</a></dt>
130
+<dd><p>allow a subclass to access the response data before it is returned to the user</p>
131
+</dd></dl>
132
+
133
+</dd></dl>
134
+
135
+</div>
136
+
137
+
138
+          </div>
139
+        </div>
140
+      </div>
141
+      <div class="sphinxsidebar">
142
+        <div class="sphinxsidebarwrapper">
143
+  <h4>Previous topic</h4>
144
+  <p class="topless"><a href="server.html"
145
+                        title="previous chapter">JSON-RPC Server</a></p>
146
+  <h4>Next topic</h4>
147
+  <p class="topless"><a href="jsonutil.html"
148
+                        title="next chapter">jsonrpc.jsonutil</a></p>
149
+  <h3>This Page</h3>
150
+  <ul class="this-page-menu">
151
+    <li><a href="_sources/proxy.txt"
152
+           rel="nofollow">Show Source</a></li>
153
+  </ul>
154
+<div id="searchbox" style="display: none">
155
+  <h3>Quick search</h3>
156
+    <form class="search" action="search.html" method="get">
157
+      <input type="text" name="q" size="18" />
158
+      <input type="submit" value="Go" />
159
+      <input type="hidden" name="check_keywords" value="yes" />
160
+      <input type="hidden" name="area" value="default" />
161
+    </form>
162
+    <p class="searchtip" style="font-size: 90%">
163
+    Enter search terms or a module, class or function name.
164
+    </p>
165
+</div>
166
+<script type="text/javascript">$('#searchbox').show(0);</script>
167
+        </div>
168
+      </div>
169
+      <div class="clearer"></div>
170
+    </div>
171
+    <div class="related">
172
+      <h3>Navigation</h3>
173
+      <ul>
174
+        <li class="right" style="margin-right: 10px">
175
+          <a href="genindex.html" title="General Index"
176
+             >index</a></li>
177
+        <li class="right" >
178
+          <a href="py-modindex.html" title="Python Module Index"
179
+             >modules</a> |</li>
180
+        <li class="right" >
181
+          <a href="jsonutil.html" title="jsonrpc.jsonutil"
182
+             >next</a> |</li>
183
+        <li class="right" >
184
+          <a href="server.html" title="JSON-RPC Server"
185
+             >previous</a> |</li>
186
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
187
+      </ul>
188
+    </div>
189
+    <div class="footer">
190
+        &copy; Copyright 2011, Edward Langley.
191
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
192
+    </div>
193
+  </body>
194
+</html>
0 195
\ No newline at end of file
1 196
new file mode 100644
... ...
@@ -0,0 +1,123 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>Python Module Index &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="index.html" />
26
+ 
27
+
28
+
29
+  </head>
30
+  <body>
31
+    <div class="related">
32
+      <h3>Navigation</h3>
33
+      <ul>
34
+        <li class="right" style="margin-right: 10px">
35
+          <a href="genindex.html" title="General Index"
36
+             accesskey="I">index</a></li>
37
+        <li class="right" >
38
+          <a href="#" title="Python Module Index"
39
+             >modules</a> |</li>
40
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
41
+      </ul>
42
+    </div>  
43
+
44
+    <div class="document">
45
+      <div class="documentwrapper">
46
+        <div class="bodywrapper">
47
+          <div class="body">
48
+            
49
+
50
+   <h1>Python Module Index</h1>
51
+
52
+   <div class="modindex-jumpbox">
53
+   <a href="#cap-j"><strong>j</strong></a>
54
+   </div>
55
+
56
+   <table class="indextable modindextable" cellspacing="0" cellpadding="2">
57
+     <tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
58
+     <tr class="cap" id="cap-j"><td></td><td>
59
+       <strong>j</strong></td><td></td></tr>
60
+     <tr>
61
+       <td><img src="_static/minus.png" class="toggler"
62
+              id="toggle-1" style="display: none" alt="-" /></td>
63
+       <td>
64
+       <tt class="xref">jsonrpc</tt></td><td>
65
+       <em></em></td></tr>
66
+     <tr class="cg-1">
67
+       <td></td>
68
+       <td>&nbsp;&nbsp;&nbsp;
69
+       <a href="jsonutil.html#module-jsonrpc.jsonutil"><tt class="xref">jsonrpc.jsonutil</tt></a></td><td>
70
+       <em></em></td></tr>
71
+     <tr class="cg-1">
72
+       <td></td>
73
+       <td>&nbsp;&nbsp;&nbsp;
74
+       <a href="proxy.html#module-jsonrpc.proxy"><tt class="xref">jsonrpc.proxy</tt></a></td><td>
75
+       <em></em></td></tr>
76
+     <tr class="cg-1">
77
+       <td></td>
78
+       <td>&nbsp;&nbsp;&nbsp;
79
+       <a href="server.html#module-jsonrpc.server"><tt class="xref">jsonrpc.server</tt></a></td><td>
80
+       <em></em></td></tr>
81
+   </table>
82
+
83
+
84
+          </div>
85
+        </div>
86
+      </div>
87
+      <div class="sphinxsidebar">
88
+        <div class="sphinxsidebarwrapper">
89
+<div id="searchbox" style="display: none">
90
+  <h3>Quick search</h3>
91
+    <form class="search" action="search.html" method="get">
92
+      <input type="text" name="q" size="18" />
93
+      <input type="submit" value="Go" />
94
+      <input type="hidden" name="check_keywords" value="yes" />
95
+      <input type="hidden" name="area" value="default" />
96
+    </form>
97
+    <p class="searchtip" style="font-size: 90%">
98
+    Enter search terms or a module, class or function name.
99
+    </p>
100
+</div>
101
+<script type="text/javascript">$('#searchbox').show(0);</script>
102
+        </div>
103
+      </div>
104
+      <div class="clearer"></div>
105
+    </div>
106
+    <div class="related">
107
+      <h3>Navigation</h3>
108
+      <ul>
109
+        <li class="right" style="margin-right: 10px">
110
+          <a href="genindex.html" title="General Index"
111
+             >index</a></li>
112
+        <li class="right" >
113
+          <a href="#" title="Python Module Index"
114
+             >modules</a> |</li>
115
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
116
+      </ul>
117
+    </div>
118
+    <div class="footer">
119
+        &copy; Copyright 2011, Edward Langley.
120
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
121
+    </div>
122
+  </body>
123
+</html>
0 124
\ No newline at end of file
1 125
new file mode 100644
... ...
@@ -0,0 +1,102 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>Search &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <script type="text/javascript" src="_static/searchtools.js"></script>
26
+    <link rel="top" title="JSONRPC v1.0 documentation" href="index.html" />
27
+  <script type="text/javascript">
28
+    jQuery(function() { Search.loadIndex("searchindex.js"); });
29
+  </script>
30
+   
31
+
32
+  </head>
33
+  <body>
34
+    <div class="related">
35
+      <h3>Navigation</h3>
36
+      <ul>
37
+        <li class="right" style="margin-right: 10px">
38
+          <a href="genindex.html" title="General Index"
39
+             accesskey="I">index</a></li>
40
+        <li class="right" >
41
+          <a href="py-modindex.html" title="Python Module Index"
42
+             >modules</a> |</li>
43
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
44
+      </ul>
45
+    </div>  
46
+
47
+    <div class="document">
48
+      <div class="documentwrapper">
49
+        <div class="bodywrapper">
50
+          <div class="body">
51
+            
52
+  <h1 id="search-documentation">Search</h1>
53
+  <div id="fallback" class="admonition warning">
54
+  <script type="text/javascript">$('#fallback').hide();</script>
55
+  <p>
56
+    Please activate JavaScript to enable the search
57
+    functionality.
58
+  </p>
59
+  </div>
60
+  <p>
61
+    From here you can search these documents. Enter your search
62
+    words into the box below and click "search". Note that the search
63
+    function will automatically search for all of the words. Pages
64
+    containing fewer words won't appear in the result list.
65
+  </p>
66
+  <form action="" method="get">
67
+    <input type="text" name="q" value="" />
68
+    <input type="submit" value="search" />
69
+    <span id="search-progress" style="padding-left: 10px"></span>
70
+  </form>
71
+  
72
+  <div id="search-results">
73
+  
74
+  </div>
75
+
76
+          </div>
77
+        </div>
78
+      </div>
79
+      <div class="sphinxsidebar">
80
+        <div class="sphinxsidebarwrapper">
81
+        </div>
82
+      </div>
83
+      <div class="clearer"></div>
84
+    </div>
85
+    <div class="related">
86
+      <h3>Navigation</h3>
87
+      <ul>
88
+        <li class="right" style="margin-right: 10px">
89
+          <a href="genindex.html" title="General Index"
90
+             >index</a></li>
91
+        <li class="right" >
92
+          <a href="py-modindex.html" title="Python Module Index"
93
+             >modules</a> |</li>
94
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
95
+      </ul>
96
+    </div>
97
+    <div class="footer">
98
+        &copy; Copyright 2011, Edward Langley.
99
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
100
+    </div>
101
+  </body>
102
+</html>
0 103
\ No newline at end of file
1 104
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+Search.setIndex({objects:{"jsonrpc.proxy":{ProxyEvents:[2,2,1],JSONRPCProxy:[2,2,1]},"jsonrpc.server":{JSON_RPC:[3,2,1],ServerEvents:[3,2,1]},"jsonrpc.proxy.ProxyEvents":{IDGen:[2,3,1],get_postdata:[2,1,1],proc_response:[2,1,1]},"jsonrpc.proxy.JSONRPCProxy":{batch_call:[2,1,1],from_url:[2,4,1],call:[2,1,1]},"jsonrpc.jsonutil":{decode:[1,5,1],encode:[1,5,1]},"jsonrpc.server.JSON_RPC":{eventhandler:[3,3,1],customize:[3,1,1]},jsonrpc:{jsonutil:[1,0,1],proxy:[2,0,1],server:[3,0,1]},"jsonrpc.server.ServerEvents":{processrequest:[3,1,1],callmethod:[3,1,1],logerror:[3,1,1],server:[3,3,1]}},terms:{serializ:1,just:1,json_equival:1,paramet:2,absolut:2,parse_int:1,parse_float:1,proc_respons:2,param:2,better:2,might:2,servicenam:2,sourc:[2,3],"return":[1,2],string:1,object_hook:1,get:[1,2],handl:[1,3],jsonutil:[0,1],batch_cal:2,initi:2,"break":2,proxyev:2,allow_nan:1,get_postdata:2,name:2,insert:2,like:1,leftov:2,list:[1,2],iter:1,server:[0,2,3],separ:1,item:1,token:2,necessari:2,each:2,found:2,where:2,page:0,smaller:2,dump:1,check_circular:1,methodnam:2,second:1,result:[1,2,3],arg:[1,2,3],proper:1,http:2,event:2,index:0,serverev:3,subclass:[2,3],content:0,version:2,method:[1,2,3],attribut:1,proxi:[0,2],iteritem:1,parse_const:1,host:2,json_rpc:3,jsonrpcproxi:2,path:2,from_url:2,modifi:2,both:1,search:0,obj:1,instanc:[2,3],behav:1,gener:2,chang:3,load:1,own:2,primarili:1,instanti:2,onc:2,modul:[0,1],encod:1,automat:2,rpc:[0,2,3],set:3,url:2,demjson:1,from:[1,2],wai:2,data:2,two:2,wrapper:1,custom:3,avail:3,json:[0,1,2,3],handler:2,call:[1,2],type:1,more:1,simplejson:1,ani:2,part:2,link:3,jsonrpc:[0,1,2,3],"true":1,"__get__":2,none:[1,2],made:1,utf:1,access:2,skipkei:1,defin:[1,2],can:[1,2],str:[1,2],error:[2,3],otherwis:1,ensure_ascii:1,authent:2,overrid:3,logerror:3,behavior:3,creat:2,give:2,idgen:2,pass:3,argument:2,indic:0,twist:3,kwarg:[2,3],indent:1,tabl:0,everi:2,serial:1,"__init__":2,around:1,welcom:0,make:[1,3],processrequest:3,fals:1,decod:1,sever:2,which:[1,2],document:0,callmethod:3,resourc:3,thi:[1,2,3],"class":[2,3],object:1,ctxid:2,befor:2,user:2,pair:2,eventhandl:3,respons:2,implement:[2,3],renam:1,classmethod:2,request:[2,3],correspond:2,allow:2,occasion:2,order:1},objtypes:{"0":"py:module","1":"py:method","2":"py:class","3":"py:attribute","4":"py:classmethod","5":"py:function"},titles:["Welcome to JSONRPC&#8217;s documentation!","jsonrpc.jsonutil","JSON-RPC Proxy","JSON-RPC Server"],objnames:{"0":"Python module","1":"Python method","2":"Python class","3":"Python attribute","4":"Python class method","5":"Python function"},filenames:["index","jsonutil","proxy","server"]})
0 2
\ No newline at end of file
1 3
new file mode 100644
... ...
@@ -0,0 +1,163 @@
1
+
2
+
3
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+<html xmlns="http://www.w3.org/1999/xhtml">
7
+  <head>
8
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
+    
10
+    <title>JSON-RPC Server &mdash; JSONRPC v1.0 documentation</title>
11
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
12
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
+    <script type="text/javascript">
14
+      var DOCUMENTATION_OPTIONS = {
15
+        URL_ROOT:    '',
16
+        VERSION:     '1.0',
17
+        COLLAPSE_INDEX: false,
18
+        FILE_SUFFIX: '.html',
19
+        HAS_SOURCE:  true
20
+      };
21
+    </script>
22
+    <script type="text/javascript" src="_static/jquery.js"></script>
23
+    <script type="text/javascript" src="_static/underscore.js"></script>
24
+    <script type="text/javascript" src="_static/doctools.js"></script>
25
+    <link rel="top" title="JSONRPC v1.0 documentation" href="index.html" />
26
+    <link rel="next" title="JSON-RPC Proxy" href="proxy.html" />
27
+    <link rel="prev" title="Welcome to JSONRPC’s documentation!" href="index.html" /> 
28
+  </head>
29
+  <body>
30
+    <div class="related">
31
+      <h3>Navigation</h3>
32
+      <ul>
33
+        <li class="right" style="margin-right: 10px">
34
+          <a href="genindex.html" title="General Index"
35
+             accesskey="I">index</a></li>
36
+        <li class="right" >
37
+          <a href="py-modindex.html" title="Python Module Index"
38
+             >modules</a> |</li>
39
+        <li class="right" >
40
+          <a href="proxy.html" title="JSON-RPC Proxy"
41
+             accesskey="N">next</a> |</li>
42
+        <li class="right" >
43
+          <a href="index.html" title="Welcome to JSONRPC’s documentation!"
44
+             accesskey="P">previous</a> |</li>
45
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
46
+      </ul>
47
+    </div>  
48
+
49
+    <div class="document">
50
+      <div class="documentwrapper">
51
+        <div class="bodywrapper">
52
+          <div class="body">
53
+            
54
+  <div class="section" id="module-jsonrpc.server">
55
+<span id="json-rpc-server"></span><h1>JSON-RPC Server<a class="headerlink" href="#module-jsonrpc.server" title="Permalink to this headline">¶</a></h1>
56
+<dl class="class">
57
+<dt id="jsonrpc.server.JSON_RPC">
58
+<em class="property">class </em><tt class="descclassname">jsonrpc.server.</tt><tt class="descname">JSON_RPC</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/server.html#JSON_RPC"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.server.JSON_RPC" title="Permalink to this definition">¶</a></dt>
59
+<dd><p>This class implements a JSON-RPC 2.0 server as a Twisted Resource</p>
60
+<dl class="method">
61
+<dt id="jsonrpc.server.JSON_RPC.customize">
62
+<tt class="descname">customize</tt><big>(</big><em>eventhandler</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/server.html#JSON_RPC.customize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.server.JSON_RPC.customize" title="Permalink to this definition">¶</a></dt>
63
+<dd><p>customize the behavior of the server</p>
64
+</dd></dl>
65
+
66
+<dl class="attribute">
67
+<dt id="jsonrpc.server.JSON_RPC.eventhandler">
68
+<tt class="descname">eventhandler</tt><a class="headerlink" href="#jsonrpc.server.JSON_RPC.eventhandler" title="Permalink to this definition">¶</a></dt>
69
+<dd><p>set by <a class="reference internal" href="#jsonrpc.server.JSON_RPC.customize" title="jsonrpc.server.JSON_RPC.customize"><tt class="xref py py-meth docutils literal"><span class="pre">customize()</span></tt></a> used to change the behavior of the server</p>
70
+</dd></dl>
71
+
72
+</dd></dl>
73
+
74
+<dl class="class">
75
+<dt id="jsonrpc.server.ServerEvents">
76
+<em class="property">class </em><tt class="descclassname">jsonrpc.server.</tt><tt class="descname">ServerEvents</tt><big>(</big><em>jsonrpc</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/server.html#ServerEvents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.server.ServerEvents" title="Permalink to this definition">¶</a></dt>
77
+<dd><p>Subclass this and pass to <tt class="xref py py-meth docutils literal"><span class="pre">jsonrpc.customize()</span></tt> to customize the jsonrpc server</p>
78
+<dl class="method">
79
+<dt id="jsonrpc.server.ServerEvents.callmethod">
80
+<tt class="descname">callmethod</tt><big>(</big><em>request</em>, <em>method</em>, <em>kwargs</em>, <em>args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/server.html#ServerEvents.callmethod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.server.ServerEvents.callmethod" title="Permalink to this definition">¶</a></dt>
81
+<dd><p>Override to implement the methods the server will make available</p>
82
+</dd></dl>
83
+
84
+<dl class="method">
85
+<dt id="jsonrpc.server.ServerEvents.logerror">
86
+<tt class="descname">logerror</tt><big>(</big><em>result</em>, <em>request</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/server.html#ServerEvents.logerror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.server.ServerEvents.logerror" title="Permalink to this definition">¶</a></dt>
87
+<dd><p>Override to implement custom error handling</p>
88
+</dd></dl>
89
+
90
+<dl class="method">
91
+<dt id="jsonrpc.server.ServerEvents.processrequest">
92
+<tt class="descname">processrequest</tt><big>(</big><em>result</em>, <em>args</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/server.html#ServerEvents.processrequest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.server.ServerEvents.processrequest" title="Permalink to this definition">¶</a></dt>
93
+<dd><p>Override to implement custom handling of the method result and request</p>
94
+</dd></dl>
95
+
96
+<dl class="attribute">
97
+<dt id="jsonrpc.server.ServerEvents.server">
98
+<tt class="descname">server</tt><a class="headerlink" href="#jsonrpc.server.ServerEvents.server" title="Permalink to this definition">¶</a></dt>
99
+<dd><p>A link to the JSON-RPC server instance</p>
100
+</dd></dl>
101
+
102
+</dd></dl>
103
+
104
+</div>
105
+
106
+
107
+          </div>
108
+        </div>
109
+      </div>
110
+      <div class="sphinxsidebar">
111
+        <div class="sphinxsidebarwrapper">
112
+  <h4>Previous topic</h4>
113
+  <p class="topless"><a href="index.html"
114
+                        title="previous chapter">Welcome to JSONRPC&#8217;s documentation!</a></p>
115
+  <h4>Next topic</h4>
116
+  <p class="topless"><a href="proxy.html"
117
+                        title="next chapter">JSON-RPC Proxy</a></p>
118
+  <h3>This Page</h3>
119
+  <ul class="this-page-menu">
120
+    <li><a href="_sources/server.txt"
121
+           rel="nofollow">Show Source</a></li>
122
+  </ul>
123
+<div id="searchbox" style="display: none">
124
+  <h3>Quick search</h3>
125
+    <form class="search" action="search.html" method="get">
126
+      <input type="text" name="q" size="18" />
127
+      <input type="submit" value="Go" />
128
+      <input type="hidden" name="check_keywords" value="yes" />
129
+      <input type="hidden" name="area" value="default" />
130
+    </form>
131
+    <p class="searchtip" style="font-size: 90%">
132
+    Enter search terms or a module, class or function name.
133
+    </p>
134
+</div>
135
+<script type="text/javascript">$('#searchbox').show(0);</script>
136
+        </div>
137
+      </div>
138
+      <div class="clearer"></div>
139
+    </div>
140
+    <div class="related">
141
+      <h3>Navigation</h3>
142
+      <ul>
143
+        <li class="right" style="margin-right: 10px">
144
+          <a href="genindex.html" title="General Index"
145
+             >index</a></li>
146
+        <li class="right" >
147
+          <a href="py-modindex.html" title="Python Module Index"
148
+             >modules</a> |</li>
149
+        <li class="right" >
150
+          <a href="proxy.html" title="JSON-RPC Proxy"
151
+             >next</a> |</li>
152
+        <li class="right" >
153
+          <a href="index.html" title="Welcome to JSONRPC’s documentation!"
154
+             >previous</a> |</li>
155
+        <li><a href="index.html">JSONRPC v1.0 documentation</a> &raquo;</li> 
156
+      </ul>
157
+    </div>
158
+    <div class="footer">
159
+        &copy; Copyright 2011, Edward Langley.
160
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
161
+    </div>
162
+  </body>
163
+</html>
0 164
\ No newline at end of file
1 165
new file mode 100644
... ...
@@ -0,0 +1,256 @@
1
+# -*- coding: utf-8 -*-
2
+#  
3
+#  Copyright (c) 2011 Edward Langley
4
+#  All rights reserved.
5
+#  
6
+#  Redistribution and use in source and binary forms, with or without
7
+#  modification, are permitted provided that the following conditions
8
+#  are met:
9
+#  
10
+#  Redistributions of source code must retain the above copyright notice,
11
+#  this list of conditions and the following disclaimer.
12
+#  
13
+#  Redistributions in binary form must reproduce the above copyright
14
+#  notice, this list of conditions and the following disclaimer in the
15
+#  documentation and/or other materials provided with the distribution.
16
+#  
17
+#  Neither the name of the project's author nor the names of its
18
+#  contributors may be used to endorse or promote products derived from
19
+#  this software without specific prior written permission.
20
+#  
21
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+#  
33
+#
34
+
35
+#
36
+# JSONRPC documentation build configuration file, created by
37
+# sphinx-quickstart on Mon May 23 20:36:05 2011.
38
+#
39
+# This file is execfile()d with the current directory set to its containing dir.
40
+#
41
+# Note that not all possible configuration values are present in this
42
+# autogenerated file.
43
+#
44
+# All configuration values have a default; values that are commented out
45
+# serve to show the default.
46
+
47
+import sys, os
48
+
49
+# If extensions (or modules to document with autodoc) are in another directory,
50
+# add these directories to sys.path here. If the directory is relative to the
51
+# documentation root, use os.path.abspath to make it absolute, like shown here.
52
+sys.path.insert(0, os.path.abspath('../../..'))
53
+
54
+# -- General configuration -----------------------------------------------------
55
+
56
+# If your documentation needs a minimal Sphinx version, state it here.
57
+#needs_sphinx = '1.0'
58
+
59
+# Add any Sphinx extension module names here, as strings. They can be extensions
60
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
61
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.viewcode']
62
+
63
+autoclass_content = 'both'
64
+autodoc_member_order = 'source'
65
+
66
+# Add any paths that contain templates here, relative to this directory.
67
+templates_path = ['_templates']
68
+
69
+# The suffix of source filenames.
70
+source_suffix = '.rst'
71
+
72
+# The encoding of source files.
73
+#source_encoding = 'utf-8-sig'
74
+
75
+# The master toctree document.
76
+master_doc = 'index'
77
+
78
+# General information about the project.
79
+project = u'JSONRPC'
80
+copyright = u'2011, Edward Langley'
81
+
82
+# The version info for the project you're documenting, acts as replacement for
83
+# |version| and |release|, also used in various other places throughout the
84
+# built documents.
85
+#
86
+# The short X.Y version.
87
+version = '1.0'
88
+# The full version, including alpha/beta/rc tags.
89
+release = '1.0'
90
+
91
+# The language for content autogenerated by Sphinx. Refer to documentation
92
+# for a list of supported languages.
93
+#language = None
94
+
95
+# There are two options for replacing |today|: either, you set today to some
96
+# non-false value, then it is used:
97
+#today = ''
98
+# Else, today_fmt is used as the format for a strftime call.
99
+#today_fmt = '%B %d, %Y'
100
+
101
+# List of patterns, relative to source directory, that match files and
102
+# directories to ignore when looking for source files.
103
+exclude_patterns = []
104
+
105
+# The reST default role (used for this markup: `text`) to use for all documents.
106
+#default_role = None
107
+
108
+# If true, '()' will be appended to :func: etc. cross-reference text.
109
+#add_function_parentheses = True
110
+
111
+# If true, the current module name will be prepended to all description
112
+# unit titles (such as .. function::).
113
+#add_module_names = True
114
+
115
+# If true, sectionauthor and moduleauthor directives will be shown in the
116
+# output. They are ignored by default.
117
+#show_authors = False
118
+
119
+# The name of the Pygments (syntax highlighting) style to use.
120
+pygments_style = 'sphinx'
121
+
122
+# A list of ignored prefixes for module index sorting.
123
+#modindex_common_prefix = []
124
+
125
+
126
+# -- Options for HTML output ---------------------------------------------------
127
+
128
+# The theme to use for HTML and HTML Help pages.  See the documentation for
129
+# a list of builtin themes.
130
+html_theme = 'default'
131
+
132
+# Theme options are theme-specific and customize the look and feel of a theme
133
+# further.  For a list of options available for each theme, see the
134
+# documentation.
135
+#html_theme_options = {}
136
+
137
+# Add any paths that contain custom themes here, relative to this directory.
138
+#html_theme_path = []
139
+
140
+# The name for this set of Sphinx documents.  If None, it defaults to
141
+# "<project> v<release> documentation".
142
+#html_title = None
143
+
144
+# A shorter title for the navigation bar.  Default is the same as html_title.
145
+#html_short_title = None
146
+
147
+# The name of an image file (relative to this directory) to place at the top
148
+# of the sidebar.
149
+#html_logo = None
150
+
151
+# The name of an image file (within the static path) to use as favicon of the
152
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
153
+# pixels large.
154
+#html_favicon = None
155
+
156
+# Add any paths that contain custom static files (such as style sheets) here,
157
+# relative to this directory. They are copied after the builtin static files,
158
+# so a file named "default.css" will overwrite the builtin "default.css".
159
+html_static_path = ['_static']
160
+
161
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
162
+# using the given strftime format.
163
+#html_last_updated_fmt = '%b %d, %Y'
164
+
165
+# If true, SmartyPants will be used to convert quotes and dashes to
166
+# typographically correct entities.
167
+#html_use_smartypants = True
168
+
169
+# Custom sidebar templates, maps document names to template names.
170
+#html_sidebars = {}
171
+
172
+# Additional templates that should be rendered to pages, maps page names to
173
+# template names.
174
+#html_additional_pages = {}
175
+
176
+# If false, no module index is generated.
177
+#html_domain_indices = True
178
+
179
+# If false, no index is generated.
180
+#html_use_index = True
181
+
182
+# If true, the index is split into individual pages for each letter.
183
+#html_split_index = False
184
+
185
+# If true, links to the reST sources are added to the pages.
186
+#html_show_sourcelink = True
187
+
188
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
189
+#html_show_sphinx = True
190
+
191
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
192
+#html_show_copyright = True
193
+
194
+# If true, an OpenSearch description file will be output, and all pages will
195
+# contain a <link> tag referring to it.  The value of this option must be the
196
+# base URL from which the finished HTML is served.
197
+#html_use_opensearch = ''
198
+
199
+# This is the file name suffix for HTML files (e.g. ".xhtml").
200
+#html_file_suffix = None
201
+
202
+# Output file base name for HTML help builder.
203
+htmlhelp_basename = 'JSONRPCdoc'
204
+
205
+
206
+# -- Options for LaTeX output --------------------------------------------------
207
+
208
+# The paper size ('letter' or 'a4').
209
+#latex_paper_size = 'letter'
210
+
211
+# The font size ('10pt', '11pt' or '12pt').
212
+#latex_font_size = '10pt'
213
+
214
+# Grouping the document tree into LaTeX files. List of tuples
215
+# (source start file, target name, title, author, documentclass [howto/manual]).
216
+latex_documents = [
217
+  ('index', 'JSONRPC.tex', u'JSONRPC Documentation',
218
+   u'Edward Langley', 'manual'),
219
+]
220
+
221
+# The name of an image file (relative to this directory) to place at the top of
222
+# the title page.
223
+#latex_logo = None
224
+
225
+# For "manual" documents, if this is true, then toplevel headings are parts,
226
+# not chapters.
227
+#latex_use_parts = False
228
+
229
+# If true, show page references after internal links.
230
+#latex_show_pagerefs = False
231
+
232
+# If true, show URL addresses after external links.
233
+#latex_show_urls = False
234
+
235
+# Additional stuff for the LaTeX preamble.
236
+#latex_preamble = ''
237
+
238
+# Documents to append as an appendix to all manuals.
239
+#latex_appendices = []
240
+
241
+# If false, no module index is generated.
242
+#latex_domain_indices = True
243
+
244
+
245
+# -- Options for manual page output --------------------------------------------
246
+
247
+# One entry per manual page. List of tuples
248
+# (source start file, name, description, authors, manual section).
249
+man_pages = [
250
+    ('index', 'jsonrpc', u'JSONRPC Documentation',
251
+     [u'Edward Langley'], 1)
252
+]
253
+
254
+
255
+# Example configuration for intersphinx: refer to the Python standard library.
256
+intersphinx_mapping = {'python':('http://docs.python.org/2.7', None)}
0 257
new file mode 100644
... ...
@@ -0,0 +1,57 @@
1
+.. JSONRPC documentation master file, created by
2
+   sphinx-quickstart on Mon May 23 20:36:05 2011.
3
+   You can adapt this file completely to your liking, but it should at least
4
+   contain the root `toctree` directive.
5
+
6
+ 
7
+.. Copyright (c) 2011 Edward Langley
8
+   All rights reserved.
9
+   
10
+   Redistribution and use in source and binary forms, with or without
11
+   modification, are permitted provided that the following conditions
12
+   are met:
13
+   
14
+   Redistributions of source code must retain the above copyright notice,
15
+   this list of conditions and the following disclaimer.
16
+   
17
+   Redistributions in binary form must reproduce the above copyright
18
+   notice, this list of conditions and the following disclaimer in the
19
+   documentation and/or other materials provided with the distribution.
20
+   
21
+   Neither the name of the project's author nor the names of its
22
+   contributors may be used to endorse or promote products derived from
23
+   this software without specific prior written permission.
24
+   
25
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28
+   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
31
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ 
37
+
38
+
39
+Welcome to JSONRPC's documentation!
40
+===================================
41
+
42
+Contents:
43
+
44
+.. toctree::
45
+   :maxdepth: 2
46
+
47
+   server
48
+   proxy
49
+   jsonutil
50
+
51
+Indices and tables
52
+==================
53
+
54
+* :ref:`genindex`
55
+* :ref:`modindex`
56
+* :ref:`search`
57
+
0 58
new file mode 100644
... ...
@@ -0,0 +1,42 @@
1
+.. Copyright (c) 2011 Edward Langley
2
+   All rights reserved.
3
+   
4
+   Redistribution and use in source and binary forms, with or without
5
+   modification, are permitted provided that the following conditions
6
+   are met:
7
+   
8
+   Redistributions of source code must retain the above copyright notice,
9
+   this list of conditions and the following disclaimer.
10
+   
11
+   Redistributions in binary form must reproduce the above copyright
12
+   notice, this list of conditions and the following disclaimer in the
13
+   documentation and/or other materials provided with the distribution.
14
+   
15
+   Neither the name of the project's author nor the names of its
16
+   contributors may be used to endorse or promote products derived from
17
+   this software without specific prior written permission.
18
+   
19
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22
+   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ 
31
+jsonrpc.jsonutil
32
+================
33
+.. automodule:: jsonrpc.jsonutil
34
+
35
+.. py:function:: encode(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', **kw)
36
+
37
+   Serialize obj to json, if it is not of a type which the encoder can handle,
38
+   make it the proper type. Args and kw are as in json.dumps
39
+
40
+.. py:function:: decode(str, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw)
41
+
42
+   Return an object from a json string.  This is just :py:func:`json.loads` renamed
0 43
new file mode 100644
... ...
@@ -0,0 +1,35 @@
1
+.. Copyright (c) 2011 Edward Langley
2
+   All rights reserved.
3
+   
4
+   Redistribution and use in source and binary forms, with or without
5
+   modification, are permitted provided that the following conditions
6
+   are met:
7
+   
8
+   Redistributions of source code must retain the above copyright notice,
9
+   this list of conditions and the following disclaimer.
10
+   
11
+   Redistributions in binary form must reproduce the above copyright
12
+   notice, this list of conditions and the following disclaimer in the
13
+   documentation and/or other materials provided with the distribution.
14
+   
15
+   Neither the name of the project's author nor the names of its
16
+   contributors may be used to endorse or promote products derived from
17
+   this software without specific prior written permission.
18
+   
19
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22
+   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ 
31
+JSON-RPC Proxy
32
+==============
33
+
34
+.. automodule:: jsonrpc.proxy
35
+   :members:
0 36
new file mode 100644
... ...
@@ -0,0 +1,36 @@
1
+.. Copyright (c) 2011 Edward Langley
2
+   All rights reserved.
3
+   
4
+   Redistribution and use in source and binary forms, with or without
5
+   modification, are permitted provided that the following conditions
6
+   are met:
7
+   
8
+   Redistributions of source code must retain the above copyright notice,
9
+   this list of conditions and the following disclaimer.
10
+   
11
+   Redistributions in binary form must reproduce the above copyright
12
+   notice, this list of conditions and the following disclaimer in the
13
+   documentation and/or other materials provided with the distribution.
14
+   
15
+   Neither the name of the project's author nor the names of its
16
+   contributors may be used to endorse or promote products derived from
17
+   this software without specific prior written permission.
18
+   
19
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22
+   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ 
31
+JSON-RPC Server
32
+===============
33
+
34
+.. automodule:: jsonrpc.server
35
+   :members:
36
+
0 37
new file mode 100644
... ...
@@ -0,0 +1,88 @@
1
+# $Id: jsonutil.py,v 1.2 2011/05/26 19:34:19 edwlan Exp $
2
+
3
+#  
4
+#  Copyright (c) 2011 Edward Langley
5
+#  All rights reserved.
6
+#  
7
+#  Redistribution and use in source and binary forms, with or without
8
+#  modification, are permitted provided that the following conditions
9
+#  are met:
10
+#  
11
+#  Redistributions of source code must retain the above copyright notice,
12
+#  this list of conditions and the following disclaimer.
13
+#  
14
+#  Redistributions in binary form must reproduce the above copyright
15
+#  notice, this list of conditions and the following disclaimer in the
16
+#  documentation and/or other materials provided with the distribution.
17
+#  
18
+#  Neither the name of the project's author nor the names of its
19
+#  contributors may be used to endorse or promote products derived from
20
+#  this software without specific prior written permission.
21
+#  
22
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+#  
34
+#  
35
+
36
+"""
37
+This module is primarily a wrapper around simplejson in order to make
38
+it behave like demjson
39
+
40
+- If an object being encoded has a 'json_equivalent' attribute, that will be called to get a (more)
41
+	serializable object
42
+
43
+- if it has an 'items' method, it will be called
44
+	- if it defines both items and iteritems, the second will be used)
45
+
46
+- if it is iterable, it will be made into a list
47
+
48
+- otherwise 'str' will be called on the object, and that result will be used
49
+"""
50
+__all__ = ['encode', 'decode']
51
+
52
+import functools
53
+
54
+try:
55
+	import json
56
+except ImportError:
57
+	import simplejson as json
58
+
59
+
60
+def dict_encode(obj):
61
+	items = getattr(obj, 'iteritems', obj.items)
62
+	return dict( (encode_(k),encode_(v)) for k,v in items() )
63
+
64
+def list_encode(obj):
65
+	return list(encode_(i) for i in obj)
66
+
67
+def safe_encode(obj):
68
+	'''Always return something, even if it is useless for serialization'''
69
+	try: json.dumps(obj)
70
+	except TypeError: obj = str(obj)
71
+	return obj
72
+
73
+def encode_(obj, **kw):
74
+	obj = getattr(obj, 'json_equivalent', lambda: obj)()
75
+	func = lambda x: x
76
+	if hasattr(obj, 'items'):
77
+		func = dict_encode
78
+	elif hasattr(obj, '__iter__'):
79
+		func = list_encode
80
+	else:
81
+		func = safe_encode
82
+	return func(obj)
83
+
84
+
85
+encode = functools.partial(json.dumps, default=encode_)
86
+decode = json.loads
87
+
88
+__version__ = "$Revision: 1.2 $".split(":")[1][:-1].strip()
0 89
new file mode 100644
... ...
@@ -0,0 +1,210 @@
1
+# $Id: proxy.py,v 1.20 2011/05/26 20:19:17 edwlan Exp $
2
+
3
+#  
4
+#  Copyright (c) 2011 Edward Langley
5
+#  All rights reserved.
6
+#  
7
+#  Redistribution and use in source and binary forms, with or without
8
+#  modification, are permitted provided that the following conditions
9
+#  are met:
10
+#  
11
+#  Redistributions of source code must retain the above copyright notice,
12
+#  this list of conditions and the following disclaimer.
13
+#  
14
+#  Redistributions in binary form must reproduce the above copyright
15
+#  notice, this list of conditions and the following disclaimer in the
16
+#  documentation and/or other materials provided with the distribution.
17
+#  
18
+#  Neither the name of the project's author nor the names of its
19
+#  contributors may be used to endorse or promote products derived from
20
+#  this software without specific prior written permission.
21
+#  
22
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+#  
34
+#
35
+import copy
36
+import urllib
37
+import urlparse
38
+import itertools
39
+import traceback
40
+import random
41
+import time
42
+import UserDict, collections
43
+collections.Mapping.register(UserDict.DictMixin)
44
+
45
+from hashlib import sha1
46
+import jsonrpc.jsonutil
47
+
48
+__all__ = ['JSONRPCProxy', 'ProxyEvents']
49
+
50
+class NewStyleBaseException(Exception):
51
+    def _get_message(self):
52
+        return self._message
53
+    def _set_message(self, message):
54
+        self._message = message
55
+
56
+    message = property(_get_message, _set_message)
57
+
58
+
59
+class JSONRPCException(NewStyleBaseException):
60
+	def __init__(self, rpcError):
61
+		Exception.__init__(self, rpcError.get('message'))
62
+		self.data = rpcError.get('data')
63
+		self.message = rpcError.get('message')
64
+		self.code = rpcError.get('code')
65
+
66
+class IDGen(object):
67
+	def __init__(self):
68
+		self._hasher = sha1()
69
+		self._id = 0
70
+	def __get__(self, *_, **__):
71
+		self._id += 1
72
+		self._hasher.update(str(self._id))
73
+		self._hasher.update(time.ctime())
74
+		self._hasher.update(str(random.random))
75
+		return self._hasher.hexdigest()
76
+
77
+
78
+
79
+class ProxyEvents(object):
80
+	'''An event handler for JSONRPCProxy'''
81
+
82
+	#: an instance of a class which defines a __get__ method, used to generate a request id
83
+	IDGen = IDGen()
84
+
85
+
86
+	def __init__(self, proxy):
87
+		'''Allow a subclass to do its own initialization, gets any arguments leftover from __init__'''
88
+		self.proxy = proxy
89
+
90
+	def get_postdata(self, args, kwargs):
91
+		'''allow a subclass to modify the method's arguments
92
+
93
+		e.g. if an authentication token is necessary, the subclass can automatically insert it into every call'''
94
+		return args, kwargs
95
+
96
+	def proc_response(self, data):
97
+		'''allow a subclass to access the response data before it is returned to the user'''
98
+		return data
99
+
100
+
101
+
102
+
103
+inst = lambda x:x()
104
+class JSONRPCProxy(object):
105
+	'''A class implementing a JSON-RPC Proxy.
106
+
107
+	:param str host: The HTTP server hosting the JSON-RPC server
108
+	:param str path: The path where the JSON-RPC server can be found
109
+
110
+	There are two ways of instantiating this class:
111
+	- JSONRPCProxy.from_url(url) -- give the absolute url to the JSON-RPC server
112
+	- JSONRPC(host, path) -- break up the url into smaller parts
113
+
114
+	'''
115
+
116
+	#: Override this attribute to customize proxy behavior
117
+	_eventhandler = ProxyEvents
118
+	def customize(self, eventhandler):
119
+		self._eventhandler = eventhandler(self)
120
+
121
+	def _transformURL(self, serviceURL, path):
122
+		if serviceURL[-1] == '/':
123
+			serviceURL = serviceURL[:-1]
124
+		if path[0] != '/':
125
+			path = '/%s'%path
126
+		if path[-1] != '/' and '?' not in path:
127
+			path = '%s/'%path
128
+		return serviceURL, path
129
+
130
+
131
+	def _get_postdata(self, args, kwargs):
132
+		args,kwargs = self._eventhandler.get_postdata(args, kwargs)
133
+
134
+		if kwargs.has_key('__args'):
135
+			raise ValueError, 'invalid argument name: __args'
136
+		kwargs['__args'] = args or ()
137
+		postdata = jsonrpc.jsonutil.encode({
138
+			"method": self._serviceName,
139
+			'params': kwargs,
140
+			'id': self._eventhandler.IDGen,
141
+			'jsonrpc': '2.0'
142
+		})
143
+		return postdata
144
+
145
+	## Public interface
146
+	@classmethod
147
+	def from_url(cls, url, ctxid=None, serviceName=None):
148
+		'''Create a JSONRPCProxy from a URL'''
149
+		urlsp = urlparse.urlsplit(url)
150
+		url = '%s://%s' % (urlsp.scheme, urlsp.netloc)
151
+		path = urlsp.path
152
+		if urlsp.query: path = '%s?%s' % (path, urlsp.query)
153
+		if urlsp.fragment: path = '%s#%s' % (path, urlsp.fragment)
154
+		return cls(url, path, serviceName, ctxid)
155
+
156
+
157
+	def __init__(self, host, path='/jsonrpc', serviceName=None, *args, **kwargs):
158
+		self.serviceURL = host
159
+		self._serviceName = serviceName
160
+		self._path = path
161
+		self.serviceURL, self._path = self._transformURL(host, path)
162
+		self.customize(self._eventhandler)
163
+
164
+
165
+
166
+	def __getattr__(self, name):
167
+		if self._serviceName != None:
168
+			name = "%s.%s" % (self._serviceName, name)
169
+		return self.__class__(self.serviceURL, path=self._path, serviceName=name)
170
+
171
+
172
+
173
+
174
+	def __call__(self, *args, **kwargs):
175
+
176
+		url = '%(host)s%(path)s' % dict(host = self.serviceURL, path = self._path)
177
+		postdata = self._get_postdata(args, kwargs)
178
+		respdata = urllib.urlopen(url, postdata).read()
179
+		resp = jsonrpc.jsonutil.decode(respdata)
180
+
181
+		if resp.get('error') != None:
182
+			raise JSONRPCException(resp['error'])
183
+		else:
184
+			resp = self._eventhandler.proc_response(resp)
185
+			result = resp['result']
186
+			return result
187
+
188
+
189
+	def call(self, method, *args, **kwargs):
190
+		'''call a JSON-RPC method
191
+
192
+		It's better to use instance.<methodname>(\\*args, \\*\\*kwargs),
193
+		but this version might be useful occasionally
194
+		'''
195
+		p = self.__class__(self.serviceURL, path=self._path, serviceName=method)
196
+		return p(*args, **kwargs)
197
+
198
+
199
+	def batch_call(self, names, *params):
200
+		'''call several methods at once, return a list of (result, error) pairs
201
+
202
+		:param names: a list of method names
203
+		:param \\*params: a list of (arg,kwarg) pairs corresponding to each method name
204
+		'''
205
+		methods = ( (getattr(self, name),param) for name,param in itertools.izip(names, params) )
206
+		data = (method._get_postdata(*params) for method, params in methods)
207
+		postdata = '[%s]' % ','.join(data)
208
+		respdata = urllib.urlopen(self.serviceURL, postdata).read()
209
+		resp = jsonrpc.jsonutil.decode(respdata)
210
+		return [(res.get('result'), res.get('error')) for res in resp]
0 211
new file mode 100644
... ...
@@ -0,0 +1,183 @@
1
+# $Id: server.py,v 1.8 2011/05/26 19:34:19 edwlan Exp $
2
+
3
+#  
4
+#  Copyright (c) 2011 Edward Langley
5
+#  All rights reserved.
6
+#  
7
+#  Redistribution and use in source and binary forms, with or without
8
+#  modification, are permitted provided that the following conditions
9
+#  are met:
10
+#  
11
+#  Redistributions of source code must retain the above copyright notice,
12
+#  this list of conditions and the following disclaimer.
13
+#  
14
+#  Redistributions in binary form must reproduce the above copyright
15
+#  notice, this list of conditions and the following disclaimer in the
16
+#  documentation and/or other materials provided with the distribution.
17
+#  
18
+#  Neither the name of the project's author nor the names of its
19
+#  contributors may be used to endorse or promote products derived from
20
+#  this software without specific prior written permission.
21
+#  
22
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+#  
34
+#
35
+import cgi
36
+import time
37
+import jsonrpc.jsonutil
38
+
39
+# Twisted imports
40
+from twisted.web import server
41
+from twisted.internet import threads
42
+from twisted.web.resource import Resource
43
+
44
+
45
+import UserDict, collections
46
+collections.Mapping.register(UserDict.DictMixin)
47
+
48
+class ServerEvents(object):
49
+	'''Subclass this and pass to :py:meth:`jsonrpc.customize` to customize the jsonrpc server'''
50
+
51
+	def __init__(self, jsonrpc):
52
+		#: A link to the JSON-RPC server instance
53
+		self.server = jsonrpc
54
+
55
+	def callmethod(self, request, method, kwargs, args, **kw):
56
+		'''Override to implement the methods the server will make available'''
57
+		return 'Test Result'
58
+
59
+	def processrequest(self, result, args):
60
+		'''Override to implement custom handling of the method result and request'''
61
+		return result
62
+
63
+	def logerror(self, result, request):
64
+		'''Override to implement custom error handling'''
65
+		pass
66
+
67
+
68
+
69
+
70
+## Base class providing a JSON-RPC 2.0 implementation with 2 customizable hooks
71
+class JSON_RPC(Resource):
72
+	'''This class implements a JSON-RPC 2.0 server as a Twisted Resource'''
73
+	isLeaf = True
74
+
75
+	#: set by :py:meth:`customize` used to change the behavior of the server
76
+	eventhandler = ServerEvents
77
+
78
+	def customize(self, eventhandler):
79
+		'''customize the behavior of the server'''
80
+		self.eventhandler = eventhandler(self)
81
+		return self
82
+
83
+
84
+	def __init__(self, *args, **kwargs):
85
+		self.customize(self.eventhandler)
86
+		Resource.__init__(self,*args, **kwargs)
87
+
88
+	def _parse_data(self, content):
89
+		if content.get('jsonrpc') != '2.0': raise ValueError, 'wrong JSON-RPC version'
90
+		method = content.get('method')
91
+		kwargs = content.get('params', {})
92
+		args = ()
93
+		if not isinstance(kwargs, dict):
94
+			args = tuple(kwargs)
95
+			kwargs = {}
96
+		else:
97
+			args = kwargs.pop('__args', args)
98
+		kwargs = dict( (str(k), v) for k,v in kwargs.items() )
99
+		return method, kwargs, args
100
+
101
+
102
+	def _cbRender(self, result, request):
103
+		request.setHeader("content-type", 'application/json')
104
+		request.setResponseCode(200)
105
+		result = jsonrpc.jsonutil.encode(result).encode('utf-8')
106
+		request.setHeader("content-length", len(result))
107
+		request.write(result)
108
+		request.finish()
109
+
110
+
111
+	def _ebRender(self, result, request, content, *args, **kwargs):
112
+		result_template = dict(
113
+			jsonrpc='2.0',
114
+			error= dict(
115
+				code=0,
116
+				message='Stub Message',
117
+				data = 'Stub Data'
118
+		))
119
+
120
+		try:
121
+			request.setHeader("X-Error", result.getErrorMessage())
122
+			result_template['error'].update(
123
+					code=0,
124
+					message=' '.join(str(x) for x in result.value),
125
+					data=content
126
+			)
127
+			if isinstance(content, list):
128
+				result_template['id'] = content[0].get('id', '<NULL>')
129
+				result_template = [result]
130
+			else: result_template['id'] = content.get('id')
131
+		except Exception, e:
132
+			result_template['error'].update(
133
+				code = 0,
134
+				message = 'Error in errorpage: %s' % e,
135
+				data = ''
136
+			)
137
+
138
+		result = result_template
139
+		result['error']['message'] = cgi.escape(result['error']['message'])
140
+		result = jsonrpc.jsonutil.encode(result)
141
+		result = result.encode('utf-8')
142
+		request.setHeader("content-length", len(result))
143
+		request.setResponseCode(500)
144
+		self.eventhandler.logerror(result, request)
145
+		request.write(result)
146
+		request.finish()
147
+
148
+
149
+	def render(self, request):
150
+		ctxid = request.getCookie("ctxid") or request.args.get("ctxid", [None])[0]
151
+		host = request.getClientIP()
152
+
153
+		request.content.seek(0, 0)
154
+		content = jsonrpc.jsonutil.decode(request.content.read())
155
+		d = threads.deferToThread(self._action, request, content, ctxid=ctxid, host=host)
156
+		d.addCallback(self._cbRender, request)
157
+		d.addErrback(self._ebRender, request, content)
158
+		return server.NOT_DONE_YET
159
+
160
+
161
+	def _action(self, request, contents, **kw):
162
+		result = []
163
+		ol = (True if isinstance(contents, list) else False)
164
+		if not ol:
165
+			contents = [contents]
166
+
167
+		for content in contents:
168
+			res = dict(
169
+				jsonrpc = '2.0',
170
+				id = content.get('id'),
171
+				result = self.eventhandler.callmethod(request, *self._parse_data(content), **kw)
172
+			)
173
+
174
+			res = self.eventhandler.processrequest(res, request.args)
175
+
176
+			result.append(res)
177
+
178
+
179
+		return ( result if ol else result[0] )
180
+
181
+
182
+
183
+__version__ = "$Revision: 1.8 $".split(":")[1][:-1].strip()
0 184
new file mode 100644
... ...
@@ -0,0 +1,98 @@
1
+#  
2
+#  Copyright (c) 2011 Edward Langley
3
+#  All rights reserved.
4
+#  
5
+#  Redistribution and use in source and binary forms, with or without
6
+#  modification, are permitted provided that the following conditions
7
+#  are met:
8
+#  
9
+#  Redistributions of source code must retain the above copyright notice,
10
+#  this list of conditions and the following disclaimer.
11
+#  
12
+#  Redistributions in binary form must reproduce the above copyright
13
+#  notice, this list of conditions and the following disclaimer in the
14
+#  documentation and/or other materials provided with the distribution.
15
+#  
16
+#  Neither the name of the project's author nor the names of its
17
+#  contributors may be used to endorse or promote products derived from
18
+#  this software without specific prior written permission.
19
+#  
20
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+#  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+#  
32
+#
33
+import json
34
+import unittest
35
+import collections
36
+
37
+from jsonrpc import jsonutil
38
+
39
+class testobj(object):
40
+	value = 'This is the json value'
41
+	def json_equivalent(self): return self.value
42
+
43
+class TestSequenceFunctions(unittest.TestCase):
44
+
45
+	def setUp(self):
46
+		# simple tests
47
+		self.lis = [1,2,3]
48
+		self.jlis = json.dumps(self.lis)
49
+		self.int = 1
50
+		self.jint = json.dumps(self.int)
51
+		self.str = 'asdasd'
52
+		self.jstr = json.dumps(self.str)
53
+		self.none = None
54
+		self.jnone = json.dumps(self.none)
55
+
56
+		# more complicated tests
57
+		self.obj1 = dict(a=1,b=2,c=3)
58
+		self.jobj1 = json.dumps(self.obj1)
59
+		self.obj2 = dict(a=[1,2,3],b={2:2,3:3,4:4},c=(3,4,5))
60
+		self.jobj2 = json.dumps(self.obj2)
61
+
62
+		# extended functionality
63
+		self.obj3 = dict(a=set([1]),b=frozenset([2]),c=[1,2,3])
64
+		self.obj3_roundtrip = dict( (k,list(v)) for k,v in self.obj3.items())
65
+
66
+		self.obj4 = testobj()
67
+		self.jobj4 = json.dumps(testobj.value)
68
+
69
+	def test_encode(self):
70
+		self.assertEqual(jsonutil.encode(self.lis), self.jlis)
71
+		self.assertEqual(jsonutil.encode(self.int), self.jint)
72
+		self.assertEqual(jsonutil.encode(self.str), self.jstr)
73
+		self.assertEqual(jsonutil.encode(self.none), self.jnone)
74
+
75
+		self.assertEqual(jsonutil.encode(self.obj1), self.jobj1)
76
+		self.assertEqual(jsonutil.encode(self.obj2), self.jobj2)
77
+		self.assertEqual(jsonutil.encode(self.obj4), self.jobj4)
78
+
79
+	def test_decode(self):
80
+		self.assertEqual(jsonutil.decode(self.jlis), self.lis)
81
+		self.assertEqual(jsonutil.decode(self.jint), self.int)
82
+		self.assertEqual(jsonutil.decode(self.jstr), self.str)
83
+		self.assertEqual(jsonutil.decode(self.jnone), self.none)
84
+
85
+		self.assertEqual(jsonutil.decode(self.jobj1), self.obj1)
86
+		self.assertEqual(jsonutil.decode(self.jobj2), json.loads(self.jobj2))
87
+		self.assertEqual(jsonutil.decode(self.jobj4), testobj.value)
88
+
89
+	def test_roundtrip(self):
90
+		self.assertEqual(jsonutil.decode(jsonutil.encode(self.lis)), self.lis)
91
+		self.assertEqual(jsonutil.decode(jsonutil.encode(self.int)), self.int)
92
+		self.assertEqual(jsonutil.decode(jsonutil.encode(self.str)), self.str)
93
+		self.assertEqual(jsonutil.decode(jsonutil.encode(self.none)), self.none)
94
+
95
+		self.assertEqual(jsonutil.decode(jsonutil.encode(self.obj3)), self.obj3_roundtrip)
96
+
97
+if __name__ == '__main__':
98
+	unittest.main()