Skip to content

Commit

Permalink
* Updated docs in master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dploeger committed Feb 3, 2015
1 parent 5344f45 commit c1216c7
Show file tree
Hide file tree
Showing 47 changed files with 1,893 additions and 541 deletions.
4 changes: 2 additions & 2 deletions docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 864aef17626eb911700f18d511ce68de
tags: 645f666f9bcd5a90fca523b33c5a78b7
config: c0831ea5325cface34c44033ee43d950
tags: fbb0d17656682115ca4d033fb2f83ba1
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
Binary file modified docs/.doctrees/pythonzimbra.doctree
Binary file not shown.
Binary file modified docs/.doctrees/pythonzimbra.exceptions.doctree
Binary file not shown.
Binary file modified docs/.doctrees/pythonzimbra.tools.doctree
Binary file not shown.
Binary file modified docs/.doctrees/tests.doctree
Binary file not shown.
4 changes: 3 additions & 1 deletion docs/_modules/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Expand Down Expand Up @@ -104,7 +106,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2013, Dennis Ploeger &lt;[email protected]&gt;.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
58 changes: 46 additions & 12 deletions docs/_modules/pythonzimbra/communication.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Expand Down Expand Up @@ -49,12 +51,24 @@ <h3>Navigation</h3>
<h1>Source code for pythonzimbra.communication</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot; Zimbra communication handler. &quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">urllib2</span>
<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">unicode_literals</span>

<span class="kn">import</span> <span class="nn">sys</span>

<span class="c"># Py2-Compatibility</span>

<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">version</span> <span class="o">&lt;</span> <span class="s">&#39;3&#39;</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">urllib2</span> <span class="kn">as</span> <span class="nn">ur</span> <span class="c"># pragma: no cover py3</span>
<span class="kn">import</span> <span class="nn">urllib2</span> <span class="kn">as</span> <span class="nn">ue</span> <span class="c"># pragma: no cover py3</span>
<span class="k">else</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">urllib.request</span> <span class="kn">as</span> <span class="nn">ur</span> <span class="c"># pragma: no cover py2</span>
<span class="kn">import</span> <span class="nn">urllib.error</span> <span class="kn">as</span> <span class="nn">ue</span> <span class="c"># pragma: no cover py2</span>

<span class="kn">from</span> <span class="nn">pythonzimbra.request_json</span> <span class="kn">import</span> <span class="n">RequestJson</span>
<span class="kn">from</span> <span class="nn">pythonzimbra.request_xml</span> <span class="kn">import</span> <span class="n">RequestXml</span>
<span class="kn">from</span> <span class="nn">pythonzimbra.response_xml</span> <span class="kn">import</span> <span class="n">ResponseXml</span>
<span class="kn">from</span> <span class="nn">pythonzimbra.response_json</span> <span class="kn">import</span> <span class="n">ResponseJson</span>
<span class="kn">from</span> <span class="nn">exceptions.communication</span> <span class="kn">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">.exceptions.communication</span> <span class="kn">import</span> <span class="o">*</span>


<div class="viewcode-block" id="Communication"><a class="viewcode-back" href="../../pythonzimbra.html#pythonzimbra.communication.Communication">[docs]</a><span class="k">class</span> <span class="nc">Communication</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
Expand Down Expand Up @@ -82,8 +96,14 @@ <h1>Source code for pythonzimbra.communication</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">url</span> <span class="o">=</span> <span class="n">url</span>
<span class="bp">self</span><span class="o">.</span><span class="n">timeout</span> <span class="o">=</span> <span class="n">timeout</span>

<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">version</span> <span class="o">&lt;</span> <span class="s">&#39;3&#39;</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">url</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&quot;https&quot;</span><span class="p">):</span>

<span class="c"># Force tlsv1 on https-requests in Python 2</span>

<span class="kn">import</span> <span class="nn">tools.urllib2_tls</span> <span class="c"># pragma: no cover py3</span>

<div class="viewcode-block" id="Communication.gen_request"><a class="viewcode-back" href="../../pythonzimbra.html#pythonzimbra.communication.Communication.gen_request">[docs]</a> <span class="k">def</span> <span class="nf">gen_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request_type</span><span class="o">=</span><span class="s">&quot;json&quot;</span><span class="p">,</span> <span class="n">token</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">set_batch</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
<span class="n">batch_onerror</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="n">batch_onerror</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>

<span class="sd">&quot;&quot;&quot; Convenience method to quickly generate a token</span>

Expand All @@ -106,7 +126,7 @@ <h1>Source code for pythonzimbra.communication</h1><div class="highlight"><pre>

<span class="k">raise</span> <span class="n">UnknownRequestType</span><span class="p">()</span>

<span class="k">if</span> <span class="ow">not</span> <span class="n">token</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">if</span> <span class="n">token</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">local_request</span><span class="o">.</span><span class="n">set_auth_token</span><span class="p">(</span><span class="n">token</span><span class="p">)</span>

<span class="k">if</span> <span class="n">set_batch</span><span class="p">:</span>
Expand Down Expand Up @@ -150,33 +170,47 @@ <h1>Source code for pythonzimbra.communication</h1><div class="highlight"><pre>

<span class="k">try</span><span class="p">:</span>

<span class="n">server_request</span> <span class="o">=</span> <span class="n">urllib2</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span>
<span class="n">server_request</span> <span class="o">=</span> <span class="n">ur</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">url</span><span class="p">,</span>
<span class="n">request</span><span class="o">.</span><span class="n">get_request</span><span class="p">(),</span>
<span class="n">request</span><span class="o">.</span><span class="n">get_request</span><span class="p">()</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">&quot;utf-8&quot;</span><span class="p">),</span>
<span class="bp">self</span><span class="o">.</span><span class="n">timeout</span>
<span class="p">)</span>

<span class="n">server_response</span> <span class="o">=</span> <span class="n">server_request</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">server_response</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">):</span>

<span class="n">server_response</span> <span class="o">=</span> <span class="n">server_response</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s">&quot;utf-8&quot;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">response</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>

<span class="n">local_response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">server_request</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<span class="n">local_response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span>
<span class="n">server_response</span>
<span class="p">)</span>

<span class="k">else</span><span class="p">:</span>

<span class="n">response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">server_request</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<span class="n">response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">server_response</span><span class="p">)</span>

<span class="k">except</span> <span class="n">urllib2</span><span class="o">.</span><span class="n">HTTPError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">except</span> <span class="n">ue</span><span class="o">.</span><span class="n">HTTPError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>

<span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">code</span> <span class="o">==</span> <span class="mi">500</span><span class="p">:</span>

<span class="c"># 500 codes normally returns a SoapFault, that we can use</span>

<span class="n">server_response</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">server_response</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">):</span>

<span class="n">server_response</span> <span class="o">=</span> <span class="n">server_response</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s">&quot;utf-8&quot;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">response</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>

<span class="n">local_response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<span class="n">local_response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">server_response</span><span class="p">)</span>

<span class="k">else</span><span class="p">:</span>

<span class="n">response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">fp</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<span class="n">response</span><span class="o">.</span><span class="n">set_response</span><span class="p">(</span><span class="n">server_response</span><span class="p">)</span>

<span class="k">else</span><span class="p">:</span>

Expand Down Expand Up @@ -223,7 +257,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2013, Dennis Ploeger &lt;[email protected]&gt;.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
14 changes: 7 additions & 7 deletions docs/_modules/pythonzimbra/exceptions/request.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Expand Down Expand Up @@ -49,24 +51,22 @@ <h3>Navigation</h3>
<h1>Source code for pythonzimbra.exceptions.request</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot; Request exceptions &quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">exceptions</span>


<div class="viewcode-block" id="RequestHeaderContextException"><a class="viewcode-back" href="../../../pythonzimbra.exceptions.html#pythonzimbra.exceptions.request.RequestHeaderContextException">[docs]</a><span class="k">class</span> <span class="nc">RequestHeaderContextException</span><span class="p">(</span><span class="n">exceptions</span><span class="o">.</span><span class="n">BaseException</span><span class="p">):</span>
<div class="viewcode-block" id="RequestHeaderContextException"><a class="viewcode-back" href="../../../pythonzimbra.exceptions.html#pythonzimbra.exceptions.request.RequestHeaderContextException">[docs]</a><span class="k">class</span> <span class="nc">RequestHeaderContextException</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>

<span class="sd">&quot;&quot;&quot; Invalid context parameter specified</span>

<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">pass</span>
<span class="k">pass</span> <span class="c"># pragma: no cover</span>

</div>
<div class="viewcode-block" id="NoNamespaceGiven"><a class="viewcode-back" href="../../../pythonzimbra.exceptions.html#pythonzimbra.exceptions.request.NoNamespaceGiven">[docs]</a><span class="k">class</span> <span class="nc">NoNamespaceGiven</span><span class="p">(</span><span class="n">exceptions</span><span class="o">.</span><span class="n">BaseException</span><span class="p">):</span>
<div class="viewcode-block" id="NoNamespaceGiven"><a class="viewcode-back" href="../../../pythonzimbra.exceptions.html#pythonzimbra.exceptions.request.NoNamespaceGiven">[docs]</a><span class="k">class</span> <span class="nc">NoNamespaceGiven</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>

<span class="sd">&quot;&quot;&quot; No namespace specified, when it should be</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">pass</span></div>
<span class="k">pass</span> <span class="c"># pragma: no cover</span></div>
</pre></div>

</div>
Expand Down Expand Up @@ -106,7 +106,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2013, Dennis Ploeger &lt;[email protected]&gt;.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
16 changes: 9 additions & 7 deletions docs/_modules/pythonzimbra/request.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Expand Down Expand Up @@ -98,7 +100,7 @@ <h1>Source code for pythonzimbra.request</h1><div class="highlight"><pre>
<span class="sd"> :param params: A Dict containing context parameters.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">params</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">params</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>

<span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">valid_context_params</span><span class="p">:</span>

Expand Down Expand Up @@ -144,7 +146,7 @@ <h1>Source code for pythonzimbra.request</h1><div class="highlight"><pre>
<span class="sd"> The params are like in enable_batch</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">pass</span>
<span class="k">pass</span> <span class="c"># pragma: no cover</span>

<div class="viewcode-block" id="Request.add_request"><a class="viewcode-back" href="../../pythonzimbra.html#pythonzimbra.request.Request.add_request">[docs]</a> <span class="k">def</span> <span class="nf">add_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request_name</span><span class="p">,</span> <span class="n">request_dict</span><span class="p">,</span> <span class="n">namespace</span><span class="p">):</span>

Expand All @@ -167,20 +169,20 @@ <h1>Source code for pythonzimbra.request</h1><div class="highlight"><pre>

<span class="c"># Currently no checks</span>

<span class="k">pass</span>
<span class="k">pass</span> <span class="c"># pragma: no cover</span>
</div>
<div class="viewcode-block" id="Request.get_request"><a class="viewcode-back" href="../../pythonzimbra.html#pythonzimbra.request.Request.get_request">[docs]</a> <span class="k">def</span> <span class="nf">get_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

<span class="sd">&quot;&quot;&quot; Return the request in the native form.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">pass</span>
<span class="k">pass</span> <span class="c"># pragma: no cover</span>
</div>
<span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">unicode</span><span class="p">(</span><span class="bp">self</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>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</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> <span class="c"># pragma: no cover</span>

<span class="k">def</span> <span class="nf">__unicode__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_request</span><span class="p">()</span></div>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_request</span><span class="p">()</span> <span class="c"># pragma: no cover</span></div>
</pre></div>

</div>
Expand Down Expand Up @@ -220,7 +222,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2013, Dennis Ploeger &lt;[email protected]&gt;.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
Loading

0 comments on commit c1216c7

Please sign in to comment.