[docs] Changed the theme to the Flask theme

I like it because it doesn't allow the text to fill horizontally
over the entire screen.
This commit is contained in:
Joar Wandborg 2013-12-20 16:00:09 +01:00
parent 574cef4c9c
commit 36d91dd0b3
51 changed files with 2744 additions and 2118 deletions

17
LICENSE
View file

@ -35,15 +35,24 @@ are, unless specified as other by the file's contents, generated by sphinx
full license can be found in SPHINX-LICENSE. full license can be found in SPHINX-LICENSE.
Python 3 Sphinx Theme Flask Sphinx Theme
--------------------- ------------------
The files (an asterisk "*" indicates wildcard substitution) The files (an asterisk "*" indicates wildcard substitution)
doc/source/_themes/ doc/source/_themes/
are from the python 3 sphinx documentation source code and are licensed under are from the flask-sphinx-themes project by Armin Ronacher and are licensed
the PSF. For the full license, see the file PSF-PY3.3-LICENSE. under the 3-clase BSD license. The full license can be found in
doc/source/_themes/LICENSE.
accounting-api logo
-------------------
The file doc/source/_static/accounting-api-logo.svg is from the Open Clip Art
Library and is released under the public domain (CC0 1.0). The color has been
changed to better fit the theme of the documentation.
Bootstrap, AngularJS and jQuery Bootstrap, AngularJS and jQuery

View file

@ -1,4 +1,4 @@
# Sphinx build info version 1 # 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. # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 8b75ea2eddb26034f4ae6f4f86a1f854 config: 552d0a651eb779240d5654552064830f
tags: 645f666f9bcd5a90fca523b33c5a78b7 tags: 645f666f9bcd5a90fca523b33c5a78b7

View file

@ -8,7 +8,7 @@
<title>The Accounting API &mdash; Accounting API 0.1-beta documentation</title> <title>The Accounting API &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -26,20 +26,27 @@
<link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" />
<link rel="next" title="REST API" href="restapi.html" /> <link rel="next" title="REST API" href="restapi.html" />
<link rel="prev" title="Welcome to Accounting APIs documentation!" href="index.html" /> <link rel="prev" title="Welcome to Accounting APIs documentation!" href="index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
<li class="right" style="margin-right: 10px"> <li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index" <a href="genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" > <li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table" <a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li> >routing table</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" > <li class="right" >
<a href="restapi.html" title="REST API" <a href="restapi.html" title="REST API"
accesskey="N">next</a> |</li> accesskey="N">next</a> |</li>
@ -137,6 +144,9 @@ sudo apt-get install ledger
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3> <h3><a href="index.html">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">The Accounting API</a><ul> <li><a class="reference internal" href="#">The Accounting API</a><ul>
@ -152,13 +162,13 @@ sudo apt-get install ledger
</ul> </ul>
</li> </li>
</ul> </ul>
<h3>Related Topics</h3>
<h4>Previous topic</h4> <ul>
<p class="topless"><a href="index.html" <li><a href="index.html">Documentation overview</a><ul>
title="previous chapter">Welcome to Accounting API&#8217;s documentation!</a></p> <li>Previous: <a href="index.html" title="previous chapter">Welcome to Accounting API&#8217;s documentation!</a></li>
<h4>Next topic</h4> <li>Next: <a href="restapi.html" title="next chapter">REST API</a></li>
<p class="topless"><a href="restapi.html" </ul></li>
title="next chapter">REST API</a></p> </ul>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="_sources/README.txt" <li><a href="_sources/README.txt"
@ -181,30 +191,10 @@ sudo apt-get install ledger
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="restapi.html" title="REST API"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to Accounting APIs documentation!"
>previous</a> |</li>
<li><a href="index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,418 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>accounting &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1-beta',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
<link rel="up" title="Module code" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1>Source code for accounting</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">subprocess</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">xml.etree</span> <span class="kn">import</span> <span class="n">ElementTree</span>
<span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">contextmanager</span>
<span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Account</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span>
<span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
<div class="viewcode-block" id="Ledger"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger">[docs]</a><span class="k">class</span> <span class="nc">Ledger</span><span class="p">:</span>
<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">ledger_file</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">ledger_bin</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">if</span> <span class="n">ledger_file</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&#39;ledger_file cannot be None&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_bin</span> <span class="o">=</span> <span class="n">ledger_bin</span> <span class="ow">or</span> <span class="s">&#39;ledger&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_file</span> <span class="o">=</span> <span class="n">ledger_file</span>
<span class="n">_log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&#39;ledger file: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">ledger_file</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">locked</span> <span class="o">=</span> <span class="bp">False</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span> <span class="o">=</span> <span class="bp">None</span>
<span class="nd">@contextmanager</span>
<div class="viewcode-block" id="Ledger.locked_process"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.locked_process">[docs]</a> <span class="k">def</span> <span class="nf">locked_process</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">r&#39;&#39;&#39;</span>
<span class="sd"> Context manager that checks that the ledger process is not already</span>
<span class="sd"> locked, then &quot;locks&quot; the process and yields the process handle and</span>
<span class="sd"> unlocks the process when execution is returned.</span>
<span class="sd"> Since this decorated as a :func:`contextlib.contextmanager` the</span>
<span class="sd"> recommended use is with the ``with``-statement.</span>
<span class="sd"> .. code-block:: python</span>
<span class="sd"> with self.locked_process() as p:</span>
<span class="sd"> p.stdin.write(b&#39;bal\n&#39;)</span>
<span class="sd"> output = self.read_until_prompt(p)</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">locked</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;The process has already been locked,&#39;</span>
<span class="s">&#39; something</span><span class="se">\&#39;</span><span class="s">s out of order.&#39;</span><span class="p">)</span>
<span class="c"># XXX: This code has no purpose in a single-threaded process</span>
<span class="n">timeout</span> <span class="o">=</span> <span class="mi">5</span> <span class="c"># Seconds</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">timeout</span> <span class="o">+</span> <span class="mi">2</span><span class="p">):</span>
<span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="n">timeout</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;Ledger process is already locked&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">locked</span><span class="p">:</span>
<span class="k">break</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&#39;Waiting for one second... </span><span class="si">%d</span><span class="s">/</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">i</span><span class="p">,</span> <span class="n">timeout</span><span class="p">)</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">process</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_process</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">locked</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Lock enabled&#39;</span><span class="p">)</span>
<span class="k">yield</span> <span class="n">process</span>
<span class="bp">self</span><span class="o">.</span><span class="n">locked</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Lock disabled&#39;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Ledger.assemble_arguments"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.assemble_arguments">[docs]</a> <span class="k">def</span> <span class="nf">assemble_arguments</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Returns a list of arguments suitable for :class:`subprocess.Popen` based on</span>
<span class="sd"> :attr:`self.ledger_bin` and :attr:`self.ledger_file`.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">return</span> <span class="p">[</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_bin</span><span class="p">,</span>
<span class="s">&#39;-f&#39;</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_file</span><span class="p">,</span>
<span class="p">]</span>
</div>
<div class="viewcode-block" id="Ledger.init_process"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.init_process">[docs]</a> <span class="k">def</span> <span class="nf">init_process</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Creates a new (presumably) ledger subprocess based on the args from</span>
<span class="sd"> :meth:`Ledger.assemble_arguments()` and then runs</span>
<span class="sd"> :meth:`Ledger.read_until_prompt()` once (which should return the banner</span>
<span class="sd"> text) and discards the output.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Starting ledger process...&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span> <span class="o">=</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">Popen</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assemble_arguments</span><span class="p">(),</span>
<span class="n">stdout</span><span class="o">=</span><span class="n">subprocess</span><span class="o">.</span><span class="n">PIPE</span><span class="p">,</span>
<span class="n">stdin</span><span class="o">=</span><span class="n">subprocess</span><span class="o">.</span><span class="n">PIPE</span><span class="p">,</span>
<span class="n">stderr</span><span class="o">=</span><span class="n">subprocess</span><span class="o">.</span><span class="n">PIPE</span><span class="p">)</span>
<span class="c"># Swallow the banner</span>
<span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">locked_process</span><span class="p">()</span> <span class="k">as</span> <span class="n">p</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">read_until_prompt</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span>
</div>
<div class="viewcode-block" id="Ledger.get_process"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.get_process">[docs]</a> <span class="k">def</span> <span class="nf">get_process</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Returns :attr:`self.ledger_process` if it evaluates to ``True``. If</span>
<span class="sd"> :attr:`self.ledger_process` is not set the result of</span>
<span class="sd"> :meth:`self.init_process() &lt;Ledger.init_process&gt;` is returned.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">init_process</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="Ledger.read_until_prompt"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.read_until_prompt">[docs]</a> <span class="k">def</span> <span class="nf">read_until_prompt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">process</span><span class="p">):</span>
<span class="sd">r&#39;&#39;&#39;</span>
<span class="sd"> Reads from the subprocess instance :data:`process` until it finds a</span>
<span class="sd"> combination of ``\n]\x20`` (the prompt), then returns the output</span>
<span class="sd"> without the prompt.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">b</span><span class="s">&#39;&#39;</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="n">line</span> <span class="o">=</span> <span class="n">process</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c"># XXX: This is a hack</span>
<span class="n">output</span> <span class="o">+=</span> <span class="n">line</span>
<span class="k">if</span> <span class="n">b</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">] &#39;</span> <span class="ow">in</span> <span class="n">output</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Found prompt!&#39;</span><span class="p">)</span>
<span class="k">break</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">output</span><span class="p">[:</span><span class="o">-</span><span class="mi">3</span><span class="p">]</span> <span class="c"># Cut away the prompt</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;output: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">output</span><span class="p">)</span>
<span class="k">return</span> <span class="n">output</span>
</div>
<div class="viewcode-block" id="Ledger.send_command"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.send_command">[docs]</a> <span class="k">def</span> <span class="nf">send_command</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">command</span><span class="p">):</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">locked_process</span><span class="p">()</span> <span class="k">as</span> <span class="n">p</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="n">command</span> <span class="o">=</span> <span class="n">command</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">&#39;utf8&#39;</span><span class="p">)</span>
<span class="n">p</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">command</span> <span class="o">+</span> <span class="n">b</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
<span class="n">p</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">flush</span><span class="p">()</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">read_until_prompt</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span><span class="o">.</span><span class="n">send_signal</span><span class="p">(</span><span class="n">subprocess</span><span class="o">.</span><span class="n">signal</span><span class="o">.</span><span class="n">SIGTERM</span><span class="p">)</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Waiting for ledger to shut down&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ledger_process</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">return</span> <span class="n">output</span>
</div>
<div class="viewcode-block" id="Ledger.add_transaction"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.add_transaction">[docs]</a> <span class="k">def</span> <span class="nf">add_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Writes a transaction to the ledger file by opening it in &#39;ab&#39; mode and</span>
<span class="sd"> writing a ledger transaction based on the</span>
<span class="sd"> :class:`~accounting.models.Transaction` instance in :data:`transaction`.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">transaction</span><span class="o">.</span><span class="n">metadata</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="n">transaction</span><span class="o">.</span><span class="n">generate_id</span><span class="p">()</span>
<span class="n">transaction_template</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">{date} {t.payee}</span><span class="se">\n</span><span class="s">&#39;</span>
<span class="s">&#39;{tags}&#39;</span>
<span class="s">&#39;{postings}&#39;</span><span class="p">)</span>
<span class="n">metadata_template</span> <span class="o">=</span> <span class="s">&#39; ;{0}: {1}</span><span class="se">\n</span><span class="s">&#39;</span>
<span class="c"># TODO: Generate metadata for postings</span>
<span class="n">posting_template</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39; {account} {p.amount.symbol}&#39;</span>
<span class="s">&#39; {p.amount.amount}</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">b</span><span class="s">&#39;&#39;</span>
<span class="c"># XXX: Even I hardly understands what this does, however I indent it it</span>
<span class="c"># stays unreadable.</span>
<span class="n">output</span> <span class="o">+=</span> <span class="n">transaction_template</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">date</span><span class="o">=</span><span class="n">transaction</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">),</span>
<span class="n">t</span><span class="o">=</span><span class="n">transaction</span><span class="p">,</span>
<span class="n">tags</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">metadata_template</span><span class="o">.</span><span class="n">format</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">transaction</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">items</span><span class="p">()]),</span>
<span class="n">postings</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">posting_template</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">p</span><span class="o">=</span><span class="n">p</span><span class="p">,</span>
<span class="n">account</span><span class="o">=</span><span class="n">p</span><span class="o">.</span><span class="n">account</span> <span class="o">+</span> <span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="p">(</span>
<span class="mi">80</span> <span class="o">-</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">account</span><span class="p">)</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span><span class="p">)</span> <span class="o">+</span>
<span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">))</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">2</span><span class="p">)</span>
<span class="p">))</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">transaction</span><span class="o">.</span><span class="n">postings</span>
<span class="p">])</span>
<span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">&#39;utf8&#39;</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ledger_file</span><span class="p">,</span> <span class="s">&#39;ab&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;written to file: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">output</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Ledger.bal"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.bal">[docs]</a> <span class="k">def</span> <span class="nf">bal</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">send_command</span><span class="p">(</span><span class="s">&#39;xml&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">output</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;bal call returned no output&#39;</span><span class="p">)</span>
<span class="n">accounts</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">xml</span> <span class="o">=</span> <span class="n">ElementTree</span><span class="o">.</span><span class="n">fromstring</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s">&#39;utf8&#39;</span><span class="p">))</span>
<span class="n">accounts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_recurse_accounts</span><span class="p">(</span><span class="n">xml</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./accounts&#39;</span><span class="p">))</span>
<span class="k">return</span> <span class="n">accounts</span>
</div>
<span class="k">def</span> <span class="nf">_recurse_accounts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">root</span><span class="p">):</span>
<span class="n">accounts</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">account</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./account&#39;</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">account</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./fullname&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">amounts</span> <span class="o">=</span> <span class="p">[]</span>
<span class="c"># Try to find an account total value, then try to find the account</span>
<span class="c"># balance</span>
<span class="n">account_amounts</span> <span class="o">=</span> <span class="n">account</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span>
<span class="s">&#39;./account-total/balance/amount&#39;</span><span class="p">)</span> <span class="ow">or</span> \
<span class="n">account</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./account-amount/amount&#39;</span><span class="p">)</span> <span class="ow">or</span> \
<span class="n">account</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./account-total/amount&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">account_amounts</span><span class="p">:</span>
<span class="k">for</span> <span class="n">amount</span> <span class="ow">in</span> <span class="n">account_amounts</span><span class="p">:</span>
<span class="n">quantity</span> <span class="o">=</span> <span class="n">amount</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./quantity&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">symbol</span> <span class="o">=</span> <span class="n">amount</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./commodity/symbol&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">amounts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Amount</span><span class="p">(</span><span class="n">amount</span><span class="o">=</span><span class="n">quantity</span><span class="p">,</span> <span class="n">symbol</span><span class="o">=</span><span class="n">symbol</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s">&#39;Account </span><span class="si">%s</span><span class="s"> does not have any amounts&#39;</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="n">accounts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Account</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
<span class="n">amounts</span><span class="o">=</span><span class="n">amounts</span><span class="p">,</span>
<span class="n">accounts</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_recurse_accounts</span><span class="p">(</span><span class="n">account</span><span class="p">)))</span>
<span class="k">return</span> <span class="n">accounts</span>
<div class="viewcode-block" id="Ledger.reg"><a class="viewcode-back" href="../api/accounting.html#accounting.Ledger.reg">[docs]</a> <span class="k">def</span> <span class="nf">reg</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">send_command</span><span class="p">(</span><span class="s">&#39;xml&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">output</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;reg call returned no output&#39;</span><span class="p">)</span>
<span class="n">entries</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">reg_xml</span> <span class="o">=</span> <span class="n">ElementTree</span><span class="o">.</span><span class="n">fromstring</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s">&#39;utf8&#39;</span><span class="p">))</span>
<span class="k">for</span> <span class="n">transaction</span> <span class="ow">in</span> <span class="n">reg_xml</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./transactions/transaction&#39;</span><span class="p">):</span>
<span class="n">date</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./date&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span><span class="p">,</span>
<span class="s">&#39;%Y/%m/</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">)</span>
<span class="n">payee</span> <span class="o">=</span> <span class="n">transaction</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./payee&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">postings</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">posting</span> <span class="ow">in</span> <span class="n">transaction</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./postings/posting&#39;</span><span class="p">):</span>
<span class="n">account</span> <span class="o">=</span> <span class="n">posting</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./account/name&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">amount</span> <span class="o">=</span> <span class="n">posting</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./post-amount/amount/quantity&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">symbol</span> <span class="o">=</span> <span class="n">posting</span><span class="o">.</span><span class="n">find</span><span class="p">(</span>
<span class="s">&#39;./post-amount/amount/commodity/symbol&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="c"># Get the posting metadata</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">values</span> <span class="o">=</span> <span class="n">posting</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./metadata/value&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">values</span><span class="p">:</span>
<span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">:</span>
<span class="n">key</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;key&#39;</span><span class="p">)</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./string&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;metadata: </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="n">metadata</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="n">key</span><span class="p">:</span> <span class="n">value</span><span class="p">})</span>
<span class="n">postings</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
<span class="n">Posting</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">account</span><span class="p">,</span>
<span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">,</span>
<span class="n">amount</span><span class="o">=</span><span class="n">Amount</span><span class="p">(</span><span class="n">amount</span><span class="o">=</span><span class="n">amount</span><span class="p">,</span> <span class="n">symbol</span><span class="o">=</span><span class="n">symbol</span><span class="p">)))</span>
<span class="c"># Get the transaction metadata</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">values</span> <span class="o">=</span> <span class="n">transaction</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">&#39;./metadata/value&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">values</span><span class="p">:</span>
<span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">:</span>
<span class="n">key</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;key&#39;</span><span class="p">)</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&#39;./string&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;metadata: </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="n">metadata</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="n">key</span><span class="p">:</span> <span class="n">value</span><span class="p">})</span>
<span class="c"># Add a Transaction instance to the list</span>
<span class="n">entries</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
<span class="n">Transaction</span><span class="p">(</span><span class="n">date</span><span class="o">=</span><span class="n">date</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="n">payee</span><span class="p">,</span> <span class="n">postings</span><span class="o">=</span><span class="n">postings</span><span class="p">,</span>
<span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">))</span>
<span class="k">return</span> <span class="n">entries</span>
</div></div>
<div class="viewcode-block" id="main"><a class="viewcode-back" href="../api/accounting.html#accounting.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="kn">import</span> <span class="nn">argparse</span>
<span class="k">if</span> <span class="n">argv</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">argv</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span>
<span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">()</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;-v&#39;</span><span class="p">,</span> <span class="s">&#39;--verbosity&#39;</span><span class="p">,</span>
<span class="n">default</span><span class="o">=</span><span class="s">&#39;INFO&#39;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="p">(</span><span class="s">&#39;Filter logging output. Possible values:&#39;</span> <span class="o">+</span>
<span class="s">&#39; CRITICAL, ERROR, WARNING, INFO, DEBUG&#39;</span><span class="p">))</span>
<span class="n">args</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span>
<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="nb">getattr</span><span class="p">(</span><span class="n">logging</span><span class="p">,</span> <span class="n">args</span><span class="o">.</span><span class="n">verbosity</span><span class="p">,</span> <span class="s">&#39;INFO&#39;</span><span class="p">))</span>
<span class="n">ledger</span> <span class="o">=</span> <span class="n">Ledger</span><span class="p">(</span><span class="n">ledger_file</span><span class="o">=</span><span class="s">&#39;non-profit-test-data.ledger&#39;</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">ledger</span><span class="o">.</span><span class="n">bal</span><span class="p">())</span>
<span class="k">print</span><span class="p">(</span><span class="n">ledger</span><span class="o">.</span><span class="n">reg</span><span class="p">())</span>
</div>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="n">main</span><span class="p">())</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="index.html" >Module code</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.
</div>
</body>
</html>

View file

@ -8,7 +8,7 @@
<title>accounting.client &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.client &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,10 +57,15 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.client</h1><div class="highlight"><pre> <h1>Source code for accounting.client</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">import</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">argparse</span> <span class="kn">import</span> <span class="nn">argparse</span>
<span class="kn">import</span> <span class="nn">json</span> <span class="kn">import</span> <span class="nn">json</span>
<span class="kn">import</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">locale</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span> <span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span> <span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span>
@ -64,6 +75,8 @@
<span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span> <span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span>
<span class="kn">from</span> <span class="nn">accounting.transport</span> <span class="kn">import</span> <span class="n">AccountingDecoder</span><span class="p">,</span> <span class="n">AccountingEncoder</span> <span class="kn">from</span> <span class="nn">accounting.transport</span> <span class="kn">import</span> <span class="n">AccountingDecoder</span><span class="p">,</span> <span class="n">AccountingEncoder</span>
<span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
<span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span> <span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
@ -96,24 +109,29 @@
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_decode_response</span><span class="p">(</span><span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">host</span> <span class="o">+</span> <span class="n">path</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">))</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_decode_response</span><span class="p">(</span><span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">host</span> <span class="o">+</span> <span class="n">path</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">))</span>
</div> </div>
<div class="viewcode-block" id="Client.simple_transaction"><a class="viewcode-back" href="../../api/accounting.html#accounting.client.Client.simple_transaction">[docs]</a> <span class="k">def</span> <span class="nf">simple_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">from_acc</span><span class="p">,</span> <span class="n">to_acc</span><span class="p">,</span> <span class="n">amount</span><span class="p">):</span> <div class="viewcode-block" id="Client.simple_transaction"><a class="viewcode-back" href="../../api/accounting.html#accounting.client.Client.simple_transaction">[docs]</a> <span class="k">def</span> <span class="nf">simple_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">from_acc</span><span class="p">,</span> <span class="n">to_acc</span><span class="p">,</span> <span class="n">amount</span><span class="p">,</span> <span class="n">symbol</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">payee</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">if</span> <span class="n">symbol</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="c"># Get the currency from the environment locale</span>
<span class="n">symbol</span> <span class="o">=</span> <span class="n">locale</span><span class="o">.</span><span class="n">localeconv</span><span class="p">()[</span><span class="s">&#39;int_curr_symbol&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="n">t</span> <span class="o">=</span> <span class="n">Transaction</span><span class="p">(</span> <span class="n">t</span> <span class="o">=</span> <span class="n">Transaction</span><span class="p">(</span>
<span class="n">date</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">today</span><span class="p">(),</span> <span class="n">date</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">today</span><span class="p">(),</span>
<span class="n">payee</span><span class="o">=</span><span class="s">&#39;PayPal donation&#39;</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="n">payee</span><span class="p">,</span>
<span class="n">postings</span><span class="o">=</span><span class="p">[</span> <span class="n">postings</span><span class="o">=</span><span class="p">[</span>
<span class="n">Posting</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">from_acc</span><span class="p">,</span> <span class="n">Posting</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">from_acc</span><span class="p">,</span>
<span class="n">amount</span><span class="o">=</span><span class="n">Amount</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="s">&#39;$&#39;</span><span class="p">,</span> <span class="n">amount</span><span class="o">=-</span><span class="n">amount</span><span class="p">)),</span> <span class="n">amount</span><span class="o">=</span><span class="n">Amount</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="n">symbol</span><span class="p">,</span> <span class="n">amount</span><span class="o">=-</span><span class="n">amount</span><span class="p">)),</span>
<span class="n">Posting</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">to_acc</span><span class="p">,</span> <span class="n">Posting</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">to_acc</span><span class="p">,</span>
<span class="n">amount</span><span class="o">=</span><span class="n">Amount</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="s">&#39;$&#39;</span><span class="p">,</span> <span class="n">amount</span><span class="o">=</span><span class="n">amount</span><span class="p">))</span> <span class="n">amount</span><span class="o">=</span><span class="n">Amount</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="n">symbol</span><span class="p">,</span> <span class="n">amount</span><span class="o">=</span><span class="n">amount</span><span class="p">))</span>
<span class="p">]</span> <span class="p">]</span>
<span class="p">)</span> <span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;transactions&#39;</span><span class="p">:</span> <span class="p">[</span><span class="n">t</span><span class="p">]})</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;transactions&#39;</span><span class="p">:</span> <span class="p">[</span><span class="n">t</span><span class="p">]})</span>
</div> </div>
<div class="viewcode-block" id="Client.get_register"><a class="viewcode-back" href="../../api/accounting.html#accounting.client.Client.get_register">[docs]</a> <span class="k">def</span> <span class="nf">get_register</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <div class="viewcode-block" id="Client.get_register"><a class="viewcode-back" href="../../api/accounting.html#accounting.client.Client.get_register">[docs]</a> <span class="k">def</span> <span class="nf">get_register</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">register</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/register&#39;</span><span class="p">)</span> <span class="n">register</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">register</span><span class="p">[</span><span class="s">&#39;register_report&#39;</span><span class="p">]</span> <span class="k">return</span> <span class="n">register</span><span class="p">[</span><span class="s">&#39;transactions&#39;</span><span class="p">]</span>
</div></div> </div></div>
<div class="viewcode-block" id="print_transactions"><a class="viewcode-back" href="../../api/accounting.html#accounting.client.print_transactions">[docs]</a><span class="k">def</span> <span class="nf">print_transactions</span><span class="p">(</span><span class="n">transactions</span><span class="p">):</span> <div class="viewcode-block" id="print_transactions"><a class="viewcode-back" href="../../api/accounting.html#accounting.client.print_transactions">[docs]</a><span class="k">def</span> <span class="nf">print_transactions</span><span class="p">(</span><span class="n">transactions</span><span class="p">):</span>
@ -124,7 +142,8 @@
<span class="k">for</span> <span class="n">posting</span> <span class="ow">in</span> <span class="n">transaction</span><span class="o">.</span><span class="n">postings</span><span class="p">:</span> <span class="k">for</span> <span class="n">posting</span> <span class="ow">in</span> <span class="n">transaction</span><span class="o">.</span><span class="n">postings</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="n">posting</span><span class="o">.</span><span class="n">account</span> <span class="o">+</span> <span class="k">print</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="n">posting</span><span class="o">.</span><span class="n">account</span> <span class="o">+</span>
<span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="p">(</span><span class="mi">80</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">account</span><span class="p">)</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span><span class="p">)</span> <span class="o">-</span> <span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="p">(</span><span class="mi">80</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">account</span><span class="p">)</span> <span class="o">-</span>
<span class="nb">len</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span><span class="p">)</span> <span class="o">-</span>
<span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">))</span> <span class="o">-</span> <span class="mi">1</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">))</span> <span class="o">-</span> <span class="mi">1</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">+</span>
<span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span> <span class="o">+</span> <span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">))</span> <span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span> <span class="o">+</span> <span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">))</span>
@ -133,9 +152,11 @@
<span class="k">for</span> <span class="n">account</span> <span class="ow">in</span> <span class="n">accounts</span><span class="p">:</span> <span class="k">for</span> <span class="n">account</span> <span class="ow">in</span> <span class="n">accounts</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="n">level</span> <span class="o">+</span> <span class="s">&#39; + {account.name}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">account</span><span class="p">)</span> <span class="o">+</span> <span class="k">print</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="n">level</span> <span class="o">+</span> <span class="s">&#39; + {account.name}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">account</span><span class="o">=</span><span class="n">account</span><span class="p">)</span> <span class="o">+</span>
<span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="s">&#39;-&#39;</span> <span class="o">*</span> <span class="p">(</span><span class="mi">80</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">account</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> <span class="o">-</span> <span class="n">level</span><span class="p">))</span> <span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="s">&#39;-&#39;</span> <span class="o">*</span> <span class="p">(</span><span class="mi">80</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">account</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> <span class="o">-</span> <span class="n">level</span><span class="p">))</span>
<span class="k">for</span> <span class="n">amount</span> <span class="ow">in</span> <span class="n">account</span><span class="o">.</span><span class="n">amounts</span><span class="p">:</span> <span class="k">for</span> <span class="n">amount</span> <span class="ow">in</span> <span class="n">account</span><span class="o">.</span><span class="n">amounts</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="n">level</span> <span class="o">+</span> <span class="s">&#39; {amount.symbol} {amount.amount}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span> <span class="k">print</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="n">level</span> <span class="o">+</span> <span class="s">&#39; {amount.symbol} {amount.amount}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">amount</span><span class="o">=</span><span class="n">amount</span><span class="p">))</span> <span class="n">amount</span><span class="o">=</span><span class="n">amount</span><span class="p">))</span>
<span class="n">print_balance_accounts</span><span class="p">(</span><span class="n">account</span><span class="o">.</span><span class="n">accounts</span><span class="p">,</span> <span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="n">print_balance_accounts</span><span class="p">(</span><span class="n">account</span><span class="o">.</span><span class="n">accounts</span><span class="p">,</span> <span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
</div> </div>
@ -150,13 +171,20 @@
<span class="n">insert</span> <span class="o">=</span> <span class="n">actions</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span><span class="s">&#39;insert&#39;</span><span class="p">,</span> <span class="n">insert</span> <span class="o">=</span> <span class="n">actions</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span><span class="s">&#39;insert&#39;</span><span class="p">,</span>
<span class="n">aliases</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;in&#39;</span><span class="p">])</span> <span class="n">aliases</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;in&#39;</span><span class="p">])</span>
<span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;payee&#39;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s">&#39;The payee line of the transaction&#39;</span><span class="p">)</span>
<span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;from_account&#39;</span><span class="p">)</span> <span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;from_account&#39;</span><span class="p">)</span>
<span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;to_account&#39;</span><span class="p">)</span> <span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;to_account&#39;</span><span class="p">)</span>
<span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;amount&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">Decimal</span><span class="p">)</span> <span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;amount&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">Decimal</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s">&#39;The amount deducted from from_account and added&#39;</span>
<span class="s">&#39; to to_account&#39;</span><span class="p">)</span>
<span class="n">insert</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;-s&#39;</span><span class="p">,</span> <span class="s">&#39;--symbol&#39;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s">&#39;The symbol for the amount, e.g. $ or USD for&#39;</span>
<span class="s">&#39; USD. Defaults to your locale</span><span class="se">\&#39;</span><span class="s">s setting.&#39;</span><span class="p">)</span>
<span class="n">balance</span> <span class="o">=</span> <span class="n">actions</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span><span class="s">&#39;balance&#39;</span><span class="p">,</span> <span class="n">aliases</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;bal&#39;</span><span class="p">])</span> <span class="n">actions</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span><span class="s">&#39;balance&#39;</span><span class="p">,</span> <span class="n">aliases</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;bal&#39;</span><span class="p">])</span>
<span class="n">register</span> <span class="o">=</span> <span class="n">actions</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span><span class="s">&#39;register&#39;</span><span class="p">,</span> <span class="n">aliases</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;reg&#39;</span><span class="p">])</span> <span class="n">actions</span><span class="o">.</span><span class="n">add_parser</span><span class="p">(</span><span class="s">&#39;register&#39;</span><span class="p">,</span> <span class="n">aliases</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;reg&#39;</span><span class="p">])</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;-v&#39;</span><span class="p">,</span> <span class="s">&#39;--verbosity&#39;</span><span class="p">,</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s">&#39;-v&#39;</span><span class="p">,</span> <span class="s">&#39;--verbosity&#39;</span><span class="p">,</span>
<span class="n">default</span><span class="o">=</span><span class="s">&#39;WARNING&#39;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s">&#39;WARNING&#39;</span><span class="p">,</span>
@ -172,7 +200,8 @@
<span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">action</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;insert&#39;</span><span class="p">,</span> <span class="s">&#39;in&#39;</span><span class="p">]:</span> <span class="k">if</span> <span class="n">args</span><span class="o">.</span><span class="n">action</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;insert&#39;</span><span class="p">,</span> <span class="s">&#39;in&#39;</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">simple_transaction</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">from_account</span><span class="p">,</span> <span class="n">args</span><span class="o">.</span><span class="n">to_account</span><span class="p">,</span> <span class="k">print</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">simple_transaction</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">from_account</span><span class="p">,</span> <span class="n">args</span><span class="o">.</span><span class="n">to_account</span><span class="p">,</span>
<span class="n">args</span><span class="o">.</span><span class="n">amount</span><span class="p">))</span> <span class="n">args</span><span class="o">.</span><span class="n">amount</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="n">args</span><span class="o">.</span><span class="n">payee</span><span class="p">,</span>
<span class="n">symbol</span><span class="o">=</span><span class="n">args</span><span class="o">.</span><span class="n">symbol</span><span class="p">))</span>
<span class="k">elif</span> <span class="n">args</span><span class="o">.</span><span class="n">action</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;balance&#39;</span><span class="p">,</span> <span class="s">&#39;bal&#39;</span><span class="p">]:</span> <span class="k">elif</span> <span class="n">args</span><span class="o">.</span><span class="n">action</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;balance&#39;</span><span class="p">,</span> <span class="s">&#39;bal&#39;</span><span class="p">]:</span>
<span class="n">print_balance_accounts</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">get_balance</span><span class="p">())</span> <span class="n">print_balance_accounts</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">get_balance</span><span class="p">())</span>
<span class="k">elif</span> <span class="n">args</span><span class="o">.</span><span class="n">action</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;register&#39;</span><span class="p">,</span> <span class="s">&#39;reg&#39;</span><span class="p">]:</span> <span class="k">elif</span> <span class="n">args</span><span class="o">.</span><span class="n">action</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;register&#39;</span><span class="p">,</span> <span class="s">&#39;reg&#39;</span><span class="p">]:</span>
@ -189,6 +218,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -206,26 +244,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.decorators &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.decorators &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,9 +57,13 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.decorators</h1><div class="highlight"><pre> <h1>Source code for accounting.decorators</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span> <span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span>
<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">jsonify</span> <span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">jsonify</span><span class="p">,</span> <span class="n">request</span>
<span class="kn">from</span> <span class="nn">accounting.exceptions</span> <span class="kn">import</span> <span class="n">AccountingException</span> <span class="kn">from</span> <span class="nn">accounting.exceptions</span> <span class="kn">import</span> <span class="n">AccountingException</span>
@ -70,7 +80,69 @@
<span class="k">except</span> <span class="n">AccountingException</span> <span class="k">as</span> <span class="n">exc</span><span class="p">:</span> <span class="k">except</span> <span class="n">AccountingException</span> <span class="k">as</span> <span class="n">exc</span><span class="p">:</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">error</span><span class="o">=</span><span class="n">exc</span><span class="p">)</span> <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">error</span><span class="o">=</span><span class="n">exc</span><span class="p">)</span>
<span class="k">return</span> <span class="n">wrapper</span></div> <span class="k">return</span> <span class="n">wrapper</span>
</div>
<div class="viewcode-block" id="cors"><a class="viewcode-back" href="../../api/accounting.html#accounting.decorators.cors">[docs]</a><span class="k">def</span> <span class="nf">cors</span><span class="p">(</span><span class="n">origin_callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Flask endpoint decorator.</span>
<span class="sd"> Example:</span>
<span class="sd"> .. code-block:: python</span>
<span class="sd"> @app.route(&#39;/cors-endpoint&#39;, methods=[&#39;GET&#39;, &#39;OPTIONS&#39;])</span>
<span class="sd"> @cors()</span>
<span class="sd"> def cors_endpoint():</span>
<span class="sd"> return jsonify(message=&#39;This is accessible via a cross-origin XHR&#39;)</span>
<span class="sd"> # Or if you want to control the domains this resource can be requested</span>
<span class="sd"> # from via CORS:</span>
<span class="sd"> domains = [&#39;http://wandborg.se&#39;, &#39;http://sfconservancy.org&#39;]</span>
<span class="sd"> def restrict_domains(origin):</span>
<span class="sd"> return &#39; &#39;.join(domains)</span>
<span class="sd"> @app.route(&#39;/restricted-cors-endpoint&#39;)</span>
<span class="sd"> @cors(restrict_domains)</span>
<span class="sd"> def restricted_cors_endpoint():</span>
<span class="sd"> return jsonify(</span>
<span class="sd"> message=&#39;This is accessible from %s&#39; % &#39;, &#39;.join(domains))</span>
<span class="sd"> :param function origin_callback: A callback that takes one str() argument</span>
<span class="sd"> containing the ``Origin`` HTTP header from the :data:`request` object.</span>
<span class="sd"> This can be used to filter out which domains the resource can be</span>
<span class="sd"> requested via CORS from.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="n">origin_callback</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">origin_callback</span> <span class="o">=</span> <span class="n">allow_all_origins</span>
<span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
<span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">wrapper</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">kw</span><span class="p">):</span>
<span class="n">response</span> <span class="o">=</span> <span class="n">func</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">kw</span><span class="p">)</span>
<span class="n">cors_headers</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&#39;Access-Control-Allow-Origin&#39;</span><span class="p">:</span>
<span class="n">origin_callback</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;Origin&#39;</span><span class="p">))</span> <span class="ow">or</span> <span class="s">&#39;*&#39;</span><span class="p">,</span>
<span class="s">&#39;Access-Control-Allow-Credentials&#39;</span><span class="p">:</span> <span class="s">&#39;true&#39;</span><span class="p">,</span>
<span class="s">&#39;Access-Control-Max-Age&#39;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
<span class="s">&#39;Access-Control-Allow-Methods&#39;</span><span class="p">:</span> <span class="s">&#39;POST, GET, DELETE&#39;</span><span class="p">,</span>
<span class="s">&#39;Access-Control-Allow-Headers&#39;</span><span class="p">:</span>
<span class="s">&#39;Accept, Content-Type, Connection, Cookie&#39;</span>
<span class="p">}</span>
<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">val</span> <span class="ow">in</span> <span class="n">cors_headers</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="n">response</span><span class="o">.</span><span class="n">headers</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
<span class="k">return</span> <span class="n">response</span>
<span class="k">return</span> <span class="n">wrapper</span>
<span class="k">return</span> <span class="n">decorator</span>
</div>
<div class="viewcode-block" id="allow_all_origins"><a class="viewcode-back" href="../../api/accounting.html#accounting.decorators.allow_all_origins">[docs]</a><span class="k">def</span> <span class="nf">allow_all_origins</span><span class="p">(</span><span class="n">origin</span><span class="p">):</span>
<span class="k">return</span> <span class="n">origin</span></div>
</pre></div> </pre></div>
</div> </div>
@ -78,6 +150,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -95,26 +176,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.exceptions &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.exceptions &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,6 +57,10 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.exceptions</h1><div class="highlight"><pre> <h1>Source code for accounting.exceptions</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<div class="viewcode-block" id="AccountingException"><a class="viewcode-back" href="../../api/accounting.html#accounting.exceptions.AccountingException">[docs]</a><span class="k">class</span> <span class="nc">AccountingException</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span> <div class="viewcode-block" id="AccountingException"><a class="viewcode-back" href="../../api/accounting.html#accounting.exceptions.AccountingException">[docs]</a><span class="k">class</span> <span class="nc">AccountingException</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span> <span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Used as a base for exceptions that are returned to the caller via the</span> <span class="sd"> Used as a base for exceptions that are returned to the caller via the</span>
@ -64,6 +74,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -81,26 +100,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.gtkclient &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.gtkclient &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,6 +57,10 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.gtkclient</h1><div class="highlight"><pre> <h1>Source code for accounting.gtkclient</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">import</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">threading</span> <span class="kn">import</span> <span class="nn">threading</span>
@ -74,7 +84,7 @@
<span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">func</span><span class="p">):</span> <span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
<span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span> <span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">wrapper</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">kw</span><span class="p">):</span> <span class="k">def</span> <span class="nf">wrapper</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">kw</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">status_description</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="n">description</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">activity_description</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="n">description</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">show</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">start</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
@ -93,7 +103,7 @@
<div class="viewcode-block" id="indicate_activity_done"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.indicate_activity_done">[docs]</a><span class="k">def</span> <span class="nf">indicate_activity_done</span><span class="p">(</span><span class="n">func</span><span class="p">):</span> <div class="viewcode-block" id="indicate_activity_done"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.indicate_activity_done">[docs]</a><span class="k">def</span> <span class="nf">indicate_activity_done</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
<span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span> <span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">wrapper</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">kw</span><span class="p">):</span> <span class="k">def</span> <span class="nf">wrapper</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">kw</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">status_description</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">activity_description</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">activity_indicator</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>
@ -111,13 +121,14 @@
<span class="bp">self</span><span class="o">.</span><span class="n">load_ui</span><span class="p">(</span><span class="n">pkg_resources</span><span class="o">.</span><span class="n">resource_filename</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">load_ui</span><span class="p">(</span><span class="n">pkg_resources</span><span class="o">.</span><span class="n">resource_filename</span><span class="p">(</span>
<span class="s">&#39;accounting&#39;</span><span class="p">,</span> <span class="s">&#39;res/client-ui.glade&#39;</span><span class="p">))</span> <span class="s">&#39;accounting&#39;</span><span class="p">,</span> <span class="s">&#39;res/client-ui.glade&#39;</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">aboutdialog</span><span class="o">.</span><span class="n">set_transient_for</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">about_dialog</span><span class="o">.</span><span class="n">set_transient_for</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">&#39;delete-event&#39;</span><span class="p">,</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">main_quit</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">&#39;delete-event&#39;</span><span class="p">,</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">main_quit</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">set_border_width</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">set_border_width</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">set_default_geometry</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">set_default_geometry</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">show_all</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">accounting_window</span><span class="o">.</span><span class="n">show_all</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">transaction_detail</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>
<div class="viewcode-block" id="AccountingApplication.load_ui"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.load_ui">[docs]</a> <span class="k">def</span> <span class="nf">load_ui</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span> <div class="viewcode-block" id="AccountingApplication.load_ui"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.load_ui">[docs]</a> <span class="k">def</span> <span class="nf">load_ui</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Loading UI...&#39;</span><span class="p">)</span> <span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Loading UI...&#39;</span><span class="p">)</span>
@ -126,12 +137,18 @@
<span class="n">builder</span><span class="o">.</span><span class="n">connect_signals</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="n">builder</span><span class="o">.</span><span class="n">connect_signals</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="k">for</span> <span class="n">element</span> <span class="ow">in</span> <span class="n">builder</span><span class="o">.</span><span class="n">get_objects</span><span class="p">():</span> <span class="k">for</span> <span class="n">element</span> <span class="ow">in</span> <span class="n">builder</span><span class="o">.</span><span class="n">get_objects</span><span class="p">():</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Loaded </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">Buildable</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">element</span><span class="p">))</span> <span class="k">try</span><span class="p">:</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">Buildable</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">element</span><span class="p">),</span> <span class="n">element</span><span class="p">)</span> <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">Buildable</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">element</span><span class="p">),</span> <span class="n">element</span><span class="p">)</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Loaded </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">Buildable</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">element</span><span class="p">))</span>
<span class="k">except</span> <span class="ne">TypeError</span> <span class="k">as</span> <span class="n">exc</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> could not be loaded: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">element</span><span class="p">,</span> <span class="n">exc</span><span class="p">)</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;UI loaded&#39;</span><span class="p">)</span> <span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;UI loaded&#39;</span><span class="p">)</span>
</div> </div>
<div class="viewcode-block" id="AccountingApplication.on_transaction_selected"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_selected">[docs]</a> <span class="k">def</span> <span class="nf">on_transaction_selected</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span> <div class="viewcode-block" id="AccountingApplication.on_transaction_new_activate"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_new_activate">[docs]</a> <span class="k">def</span> <span class="nf">on_transaction_new_activate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">transaction_edit_window</span><span class="o">.</span><span class="n">show_all</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="AccountingApplication.on_transaction_view_cursor_changed"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed">[docs]</a> <span class="k">def</span> <span class="nf">on_transaction_view_cursor_changed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span>
<span class="n">selection</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">transaction_view</span><span class="o">.</span><span class="n">get_selection</span><span class="p">()</span> <span class="n">selection</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">transaction_view</span><span class="o">.</span><span class="n">get_selection</span><span class="p">()</span>
<span class="n">selection</span><span class="o">.</span><span class="n">set_mode</span><span class="p">(</span><span class="n">Gtk</span><span class="o">.</span><span class="n">SelectionMode</span><span class="o">.</span><span class="n">SINGLE</span><span class="p">)</span> <span class="n">selection</span><span class="o">.</span><span class="n">set_mode</span><span class="p">(</span><span class="n">Gtk</span><span class="o">.</span><span class="n">SelectionMode</span><span class="o">.</span><span class="n">SINGLE</span><span class="p">)</span>
<span class="n">xact_store</span><span class="p">,</span> <span class="n">xact_iter</span> <span class="o">=</span> <span class="n">selection</span><span class="o">.</span><span class="n">get_selected</span><span class="p">()</span> <span class="n">xact_store</span><span class="p">,</span> <span class="n">xact_iter</span> <span class="o">=</span> <span class="n">selection</span><span class="o">.</span><span class="n">get_selected</span><span class="p">()</span>
@ -141,7 +158,7 @@
<span class="k">for</span> <span class="n">transaction</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">transaction_data</span><span class="p">:</span> <span class="k">for</span> <span class="n">transaction</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">transaction_data</span><span class="p">:</span>
<span class="k">if</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">xact_id</span><span class="p">:</span> <span class="k">if</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">xact_id</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">lbl_payee</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">payee</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">transaction_header</span><span class="o">.</span><span class="n">set_text</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">payee</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">posting_store</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">posting_store</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
@ -152,19 +169,22 @@
<span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span> <span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span>
<span class="p">])</span> <span class="p">])</span>
<span class="bp">self</span><span class="o">.</span><span class="n">detail_view</span><span class="o">.</span><span class="n">show</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">transaction_detail</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
<span class="k">break</span> <span class="k">break</span>
</div> </div>
<div class="viewcode-block" id="AccountingApplication.on_show_about_activate"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_show_about_activate">[docs]</a> <span class="k">def</span> <span class="nf">on_show_about_activate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span> <div class="viewcode-block" id="AccountingApplication.on_show_about_activate"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_show_about_activate">[docs]</a> <span class="k">def</span> <span class="nf">on_show_about_activate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Showing About&#39;</span><span class="p">)</span> <span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Showing About&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">aboutdialog</span><span class="o">.</span><span class="n">show_all</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">about_dialog</span><span class="o">.</span><span class="n">show_all</span><span class="p">()</span>
</div> </div>
<div class="viewcode-block" id="AccountingApplication.on_aboutdialog_close"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_aboutdialog_close">[docs]</a> <span class="k">def</span> <span class="nf">on_aboutdialog_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span> <div class="viewcode-block" id="AccountingApplication.on_about_dialog_response"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_about_dialog_response">[docs]</a> <span class="k">def</span> <span class="nf">on_about_dialog_response</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">,</span> <span class="n">response_type</span><span class="p">):</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Closing About&#39;</span><span class="p">)</span> <span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Closing About&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">aboutdialog</span><span class="o">.</span><span class="n">hide_all</span><span class="p">()</span> <span class="k">if</span> <span class="n">response_type</span> <span class="o">==</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">ResponseType</span><span class="o">.</span><span class="n">CANCEL</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">about_dialog</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;Unexpected response_type: </span><span class="si">%d</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">response_type</span><span class="p">)</span>
</div> </div>
<span class="nd">@indicate_activity</span><span class="p">(</span><span class="s">&#39;Refreshing Transactions&#39;</span><span class="p">)</span> <span class="nd">@indicate_activity</span><span class="p">(</span><span class="s">&#39;Refreshing Transactions&#39;</span><span class="p">)</span>
<div class="viewcode-block" id="AccountingApplication.on_refresh_transactions_activate"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_refresh_transactions_activate">[docs]</a> <span class="k">def</span> <span class="nf">on_refresh_transactions_activate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span> <div class="viewcode-block" id="AccountingApplication.on_transaction_refresh_activate"><a class="viewcode-back" href="../../api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate">[docs]</a> <span class="k">def</span> <span class="nf">on_transaction_refresh_activate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">load_transactions</span><span class="p">():</span> <span class="k">def</span> <span class="nf">load_transactions</span><span class="p">():</span>
<span class="n">transactions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_register</span><span class="p">()</span> <span class="n">transactions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_register</span><span class="p">()</span>
<span class="n">GLib</span><span class="o">.</span><span class="n">idle_add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">on_transactions_loaded</span><span class="p">,</span> <span class="n">transactions</span><span class="p">)</span> <span class="n">GLib</span><span class="o">.</span><span class="n">idle_add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">on_transactions_loaded</span><span class="p">,</span> <span class="n">transactions</span><span class="p">)</span>
@ -192,7 +212,6 @@
<span class="n">GObject</span><span class="o">.</span><span class="n">threads_init</span><span class="p">()</span> <span class="n">GObject</span><span class="o">.</span><span class="n">threads_init</span><span class="p">()</span>
<span class="n">accounting</span> <span class="o">=</span> <span class="n">AccountingApplication</span><span class="p">()</span> <span class="n">accounting</span> <span class="o">=</span> <span class="n">AccountingApplication</span><span class="p">()</span>
<span class="c">#accounting_win.connect(&#39;delete-event&#39;, Gtk.main_quit)</span>
<span class="n">Gtk</span><span class="o">.</span><span class="n">main</span><span class="p">()</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">main</span><span class="p">()</span>
</div> </div>
@ -205,6 +224,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -222,26 +250,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.models &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.models &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,13 +57,18 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.models</h1><div class="highlight"><pre> <h1>Source code for accounting.models</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">import</span> <span class="nn">uuid</span> <span class="kn">import</span> <span class="nn">uuid</span>
<span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span> <span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span>
<div class="viewcode-block" id="Transaction"><a class="viewcode-back" href="../../api/accounting.html#accounting.models.Transaction">[docs]</a><span class="k">class</span> <span class="nc">Transaction</span><span class="p">:</span> <div class="viewcode-block" id="Transaction"><a class="viewcode-back" href="../../api/accounting.html#accounting.models.Transaction">[docs]</a><span class="k">class</span> <span class="nc">Transaction</span><span class="p">:</span>
<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">date</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">postings</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <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="nb">id</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">date</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">postings</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">_generate_id</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span> <span class="n">metadata</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">_generate_id</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">id</span>
<span class="bp">self</span><span class="o">.</span><span class="n">date</span> <span class="o">=</span> <span class="n">date</span> <span class="bp">self</span><span class="o">.</span><span class="n">date</span> <span class="o">=</span> <span class="n">date</span>
<span class="bp">self</span><span class="o">.</span><span class="n">payee</span> <span class="o">=</span> <span class="n">payee</span> <span class="bp">self</span><span class="o">.</span><span class="n">payee</span> <span class="o">=</span> <span class="n">payee</span>
<span class="bp">self</span><span class="o">.</span><span class="n">postings</span> <span class="o">=</span> <span class="n">postings</span> <span class="bp">self</span><span class="o">.</span><span class="n">postings</span> <span class="o">=</span> <span class="n">postings</span>
@ -67,10 +78,10 @@
<span class="bp">self</span><span class="o">.</span><span class="n">generate_id</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_id</span><span class="p">()</span>
<div class="viewcode-block" id="Transaction.generate_id"><a class="viewcode-back" href="../../api/accounting.html#accounting.models.Transaction.generate_id">[docs]</a> <span class="k">def</span> <span class="nf">generate_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <div class="viewcode-block" id="Transaction.generate_id"><a class="viewcode-back" href="../../api/accounting.html#accounting.models.Transaction.generate_id">[docs]</a> <span class="k">def</span> <span class="nf">generate_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="s">&#39;Id&#39;</span><span class="p">:</span> <span class="n">uuid</span><span class="o">.</span><span class="n">uuid4</span><span class="p">()})</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">uuid</span><span class="o">.</span><span class="n">uuid4</span><span class="p">())</span>
</div> </div>
<span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="p">(</span><span class="s">&#39;&lt;{self.__class__.__name__} {date}&#39;</span> <span class="o">+</span> <span class="k">return</span> <span class="p">(</span><span class="s">&#39;&lt;{self.__class__.__name__} {self.id} {date}&#39;</span> <span class="o">+</span>
<span class="s">&#39; {self.payee} {self.postings}&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">format</span><span class="p">(</span> <span class="s">&#39; {self.payee} {self.postings}&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="bp">self</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span>
<span class="n">date</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">))</span> <span class="n">date</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">))</span>
@ -113,6 +124,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -130,26 +150,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.storage &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.storage &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,31 +57,75 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.storage</h1><div class="highlight"><pre> <h1>Source code for accounting.storage</h1><div class="highlight"><pre>
<span class="k">class</span> <span class="nc">Storage</span><span class="p">:</span> <span class="c"># Part of accounting-api project:</span>
<div class="viewcode-block" id="Storage"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage">[docs]</a> <span class="sd">&#39;&#39;&#39;</span> <span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABCMeta</span><span class="p">,</span> <span class="n">abstractmethod</span>
<span class="kn">from</span> <span class="nn">accounting.exceptions</span> <span class="kn">import</span> <span class="n">AccountingException</span>
<div class="viewcode-block" id="Storage"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage">[docs]</a><span class="k">class</span> <span class="nc">Storage</span><span class="p">:</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> ABC for accounting storage</span> <span class="sd"> ABC for accounting storage</span>
<span class="sd"> &#39;&#39;&#39;</span> <span class="sd"> &#39;&#39;&#39;</span>
<span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">ABCMeta</span>
<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">kw</span><span class="p">):</span> <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">kw</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span> <span class="k">pass</span>
<span class="k">def</span> <span class="nf">get_transactions</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">kw</span><span class="p">):</span> <span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.get_transactions"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_transactions">[docs]</a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span> <div class="viewcode-block" id="Storage.get_transactions"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_transactions">[docs]</a> <span class="k">def</span> <span class="nf">get_transactions</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">kw</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.get_transaction"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_transaction">[docs]</a> <span class="k">def</span> <span class="nf">get_transaction</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">kw</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.get_account"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_account">[docs]</a> <span class="k">def</span> <span class="nf">get_account</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">kw</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.get_accounts"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_accounts">[docs]</a> <span class="k">def</span> <span class="nf">get_accounts</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">kw</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.add_transaction"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.add_transaction">[docs]</a> <span class="k">def</span> <span class="nf">add_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.update_transaction"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.update_transaction">[docs]</a> <span class="k">def</span> <span class="nf">update_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.delete_transaction"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.delete_transaction">[docs]</a> <span class="k">def</span> <span class="nf">delete_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction_id</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
</div>
<span class="nd">@abstractmethod</span>
<div class="viewcode-block" id="Storage.reverse_transaction"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.reverse_transaction">[docs]</a> <span class="k">def</span> <span class="nf">reverse_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction_id</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span>
<span class="k">def</span> <span class="nf">get_transaction</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">kw</span><span class="p">):</span></div> </div></div>
<div class="viewcode-block" id="Storage.get_transaction"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_transaction">[docs]</a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span> <div class="viewcode-block" id="TransactionNotFound"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.TransactionNotFound">[docs]</a><span class="k">class</span> <span class="nc">TransactionNotFound</span><span class="p">(</span><span class="n">AccountingException</span><span class="p">):</span>
<span class="k">pass</span></div>
<span class="k">def</span> <span class="nf">get_account</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">kw</span><span class="p">):</span></div> </pre></div>
<div class="viewcode-block" id="Storage.get_account"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_account">[docs]</a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">get_accounts</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">kw</span><span class="p">):</span></div>
<div class="viewcode-block" id="Storage.get_accounts"><a class="viewcode-back" href="../../api/accounting.storage.html#accounting.storage.Storage.get_accounts">[docs]</a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
</pre></div></div></div>
</div> </div>
</div> </div>
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -93,26 +143,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.storage.ledgercli &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.storage.ledgercli &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -25,8 +25,15 @@
<script type="text/javascript" src="../../../_static/doctools.js"></script> <script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../../index.html" />
<link rel="up" title="accounting.storage" href="../storage.html" /> <link rel="up" title="accounting.storage" href="../storage.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -41,7 +48,6 @@
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li> <li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../accounting.html" >accounting</a> &raquo;</li>
<li><a href="../storage.html" accesskey="U">accounting.storage</a> &raquo;</li> <li><a href="../storage.html" accesskey="U">accounting.storage</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -52,17 +58,23 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.storage.ledgercli</h1><div class="highlight"><pre> <h1>Source code for accounting.storage.ledgercli</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">import</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="nn">subprocess</span>
<span class="kn">import</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">time</span> <span class="kn">import</span> <span class="nn">time</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span> <span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">xml.etree</span> <span class="kn">import</span> <span class="n">ElementTree</span> <span class="kn">from</span> <span class="nn">xml.etree</span> <span class="kn">import</span> <span class="n">ElementTree</span>
<span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">contextmanager</span> <span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">contextmanager</span>
<span class="kn">from</span> <span class="nn">accounting.exceptions</span> <span class="kn">import</span> <span class="n">AccountingException</span>
<span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Account</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span> <span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Account</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span>
<span class="kn">from</span> <span class="nn">accounting.storage</span> <span class="kn">import</span> <span class="n">Storage</span> <span class="kn">from</span> <span class="nn">accounting.storage</span> <span class="kn">import</span> <span class="n">Storage</span><span class="p">,</span> <span class="n">TransactionNotFound</span>
<span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span> <span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
@ -215,11 +227,14 @@
<span class="sd"> :class:`~accounting.models.Transaction` instance in</span> <span class="sd"> :class:`~accounting.models.Transaction` instance in</span>
<span class="sd"> :data:`transaction`.</span> <span class="sd"> :data:`transaction`.</span>
<span class="sd"> &#39;&#39;&#39;</span> <span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">transaction</span><span class="o">.</span><span class="n">metadata</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="k">if</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;No ID found. Generating an ID.&#39;</span><span class="p">)</span>
<span class="n">transaction</span><span class="o">.</span><span class="n">generate_id</span><span class="p">()</span> <span class="n">transaction</span><span class="o">.</span><span class="n">generate_id</span><span class="p">()</span>
<span class="n">transaction</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="s">&#39;Id&#39;</span><span class="p">:</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span><span class="p">})</span>
<span class="n">transaction_template</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">{date} {t.payee}</span><span class="se">\n</span><span class="s">&#39;</span> <span class="n">transaction_template</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">{date} {t.payee}</span><span class="se">\n</span><span class="s">&#39;</span>
<span class="s">&#39;{tags}&#39;</span> <span class="s">&#39;{metadata}&#39;</span>
<span class="s">&#39;{postings}&#39;</span><span class="p">)</span> <span class="s">&#39;{postings}&#39;</span><span class="p">)</span>
<span class="n">metadata_template</span> <span class="o">=</span> <span class="s">&#39; ;{0}: {1}</span><span class="se">\n</span><span class="s">&#39;</span> <span class="n">metadata_template</span> <span class="o">=</span> <span class="s">&#39; ;{0}: {1}</span><span class="se">\n</span><span class="s">&#39;</span>
@ -235,7 +250,7 @@
<span class="n">output</span> <span class="o">+=</span> <span class="n">transaction_template</span><span class="o">.</span><span class="n">format</span><span class="p">(</span> <span class="n">output</span> <span class="o">+=</span> <span class="n">transaction_template</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">date</span><span class="o">=</span><span class="n">transaction</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">),</span> <span class="n">date</span><span class="o">=</span><span class="n">transaction</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">),</span>
<span class="n">t</span><span class="o">=</span><span class="n">transaction</span><span class="p">,</span> <span class="n">t</span><span class="o">=</span><span class="n">transaction</span><span class="p">,</span>
<span class="n">tags</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">metadata</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">metadata_template</span><span class="o">.</span><span class="n">format</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="n">metadata_template</span><span class="o">.</span><span class="n">format</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">transaction</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">items</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">transaction</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">items</span><span class="p">()]),</span>
<span class="n">postings</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">posting_template</span><span class="o">.</span><span class="n">format</span><span class="p">(</span> <span class="n">postings</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">posting_template</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
@ -251,6 +266,8 @@
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;written to file: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">output</span><span class="p">)</span> <span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;written to file: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">output</span><span class="p">)</span>
<span class="k">return</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span>
</div> </div>
<div class="viewcode-block" id="Ledger.bal"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.bal">[docs]</a> <span class="k">def</span> <span class="nf">bal</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <div class="viewcode-block" id="Ledger.bal"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.bal">[docs]</a> <span class="k">def</span> <span class="nf">bal</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">send_command</span><span class="p">(</span><span class="s">&#39;xml&#39;</span><span class="p">)</span> <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">send_command</span><span class="p">(</span><span class="s">&#39;xml&#39;</span><span class="p">)</span>
@ -299,6 +316,16 @@
<div class="viewcode-block" id="Ledger.get_transactions"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.get_transactions">[docs]</a> <span class="k">def</span> <span class="nf">get_transactions</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <div class="viewcode-block" id="Ledger.get_transactions"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.get_transactions">[docs]</a> <span class="k">def</span> <span class="nf">get_transactions</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">reg</span><span class="p">()</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">reg</span><span class="p">()</span>
</div> </div>
<div class="viewcode-block" id="Ledger.get_transaction"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.get_transaction">[docs]</a> <span class="k">def</span> <span class="nf">get_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction_id</span><span class="p">):</span>
<span class="n">transactions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_transactions</span><span class="p">()</span>
<span class="k">for</span> <span class="n">transaction</span> <span class="ow">in</span> <span class="n">transactions</span><span class="p">:</span>
<span class="k">if</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">transaction_id</span><span class="p">:</span>
<span class="k">return</span> <span class="n">transaction</span>
<span class="k">raise</span> <span class="n">TransactionNotFound</span><span class="p">(</span><span class="s">&#39;No transaction with id </span><span class="si">%s</span><span class="s"> found&#39;</span><span class="p">,</span>
<span class="n">transaction_id</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Ledger.reg"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.reg">[docs]</a> <span class="k">def</span> <span class="nf">reg</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <div class="viewcode-block" id="Ledger.reg"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.reg">[docs]</a> <span class="k">def</span> <span class="nf">reg</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">send_command</span><span class="p">(</span><span class="s">&#39;xml&#39;</span><span class="p">)</span> <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">send_command</span><span class="p">(</span><span class="s">&#39;xml&#39;</span><span class="p">)</span>
@ -354,15 +381,125 @@
<span class="n">metadata</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="n">key</span><span class="p">:</span> <span class="n">value</span><span class="p">})</span> <span class="n">metadata</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="n">key</span><span class="p">:</span> <span class="n">value</span><span class="p">})</span>
<span class="c"># Add a Transaction instance to the list</span> <span class="c"># Add a Transaction instance to the list</span>
<span class="k">try</span><span class="p">:</span>
<span class="nb">id</span> <span class="o">=</span> <span class="n">metadata</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;Id&#39;</span><span class="p">)</span> <span class="nb">id</span> <span class="o">=</span> <span class="n">metadata</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;Id&#39;</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s">&#39;Transaction on </span><span class="si">%s</span><span class="s"> with payee </span><span class="si">%s</span><span class="s"> does not have an&#39;</span>
<span class="s">&#39; Id attribute. A temporary ID will be used.&#39;</span><span class="p">,</span>
<span class="n">date</span><span class="p">,</span> <span class="n">payee</span><span class="p">)</span>
<span class="nb">id</span> <span class="o">=</span> <span class="s">&#39;NO-ID&#39;</span>
<span class="n">entries</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">entries</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
<span class="n">Transaction</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> <span class="n">date</span><span class="o">=</span><span class="n">date</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="n">payee</span><span class="p">,</span> <span class="n">postings</span><span class="o">=</span><span class="n">postings</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> <span class="n">date</span><span class="o">=</span><span class="n">date</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="n">payee</span><span class="p">,</span> <span class="n">postings</span><span class="o">=</span><span class="n">postings</span><span class="p">,</span>
<span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">))</span> <span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">))</span>
<span class="k">return</span> <span class="n">entries</span> <span class="k">return</span> <span class="n">entries</span>
</div> </div>
<div class="viewcode-block" id="Ledger.delete_transaction"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.delete_transaction">[docs]</a> <span class="k">def</span> <span class="nf">delete_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction_id</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Delete a transaction from the ledger file.</span>
<span class="sd"> This method opens the ledger file, loads all lines into memory and</span>
<span class="sd"> looks for the transaction_id, then looks for the bounds of that</span>
<span class="sd"> transaction in the ledger file, removes all lines within the bounds of</span>
<span class="sd"> the transaction and removes them, then writes the lines back to the</span>
<span class="sd"> ledger file.</span>
<span class="sd"> Exceptions:</span>
<span class="sd"> - RuntimeError: If all boundaries to the transaction are not found</span>
<span class="sd"> - TransactionNotFound: If no such transaction_id can be found in</span>
<span class="sd"> :data:`self.ledger_file`</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ledger_file</span><span class="p">,</span> <span class="s">&#39;r&#39;</span><span class="p">)</span>
<span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">f</span><span class="p">]</span>
<span class="c"># A mapping of line meanings and their line numbers as found by the</span>
<span class="c"># following logic</span>
<span class="n">semantic_lines</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">id_location</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">transaction_start</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">next_transaction_or_eof</span><span class="o">=</span><span class="bp">None</span>
<span class="p">)</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">line</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">lines</span><span class="p">):</span>
<span class="k">if</span> <span class="n">transaction_id</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
<span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;id_location&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">i</span>
<span class="k">break</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;id_location&#39;</span><span class="p">]:</span>
<span class="k">raise</span> <span class="n">TransactionNotFound</span><span class="p">(</span>
<span class="s">&#39;No transaction with ID &quot;{0}&quot; found&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">transaction_id</span><span class="p">))</span>
<span class="n">transaction_start_pattern</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">r&#39;^\S&#39;</span><span class="p">)</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;id_location&#39;</span><span class="p">]</span> <span class="o">-</span> <span class="mi">1</span>
<span class="c"># Find the first line of the transaction</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="k">if</span> <span class="n">transaction_start_pattern</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">lines</span><span class="p">[</span><span class="n">cursor</span><span class="p">]):</span>
<span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;transaction_start&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">cursor</span>
<span class="k">break</span>
<span class="n">cursor</span> <span class="o">-=</span> <span class="mi">1</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;id_location&#39;</span><span class="p">]</span> <span class="o">+</span> <span class="mi">1</span>
<span class="c"># Find the last line of the transaction</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">transaction_start_pattern</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">lines</span><span class="p">[</span><span class="n">cursor</span><span class="p">]):</span>
<span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;next_transaction_or_eof&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">cursor</span>
<span class="k">break</span>
<span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span>
<span class="c"># Set next_line_without_starting_space_or_end_of_file to</span>
<span class="c"># the cursor. The cursor will be an index not included in the</span>
<span class="c"># list of lines</span>
<span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;next_transaction_or_eof&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">cursor</span>
<span class="k">break</span>
<span class="n">cursor</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">all</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">v</span><span class="p">:</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">,</span> <span class="n">semantic_lines</span><span class="o">.</span><span class="n">values</span><span class="p">())):</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;Could not find all the values necessary for&#39;</span>
<span class="s">&#39; safe deletion of a transaction.&#39;</span><span class="p">)</span>
<span class="n">del_start</span> <span class="o">=</span> <span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;transaction_start&#39;</span><span class="p">]</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> <span class="o">==</span> <span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;next_transaction_or_eof&#39;</span><span class="p">]:</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;There are no transactions below the transaction being&#39;</span>
<span class="s">&#39; deleted. The line before the first line of the&#39;</span>
<span class="s">&#39; transaction will be deleted.&#39;</span><span class="p">)</span>
<span class="c"># Delete the preceding line to make the file</span>
<span class="n">del_start</span> <span class="o">-=</span> <span class="mi">1</span>
<span class="k">del</span> <span class="n">lines</span><span class="p">[</span><span class="n">del_start</span><span class="p">:</span><span class="n">semantic_lines</span><span class="p">[</span><span class="s">&#39;next_transaction_or_eof&#39;</span><span class="p">]]</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ledger_file</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Ledger.update_transaction"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.update_transaction">[docs]</a> <span class="k">def</span> <span class="nf">update_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction</span><span class="p">):</span> <div class="viewcode-block" id="Ledger.update_transaction"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.Ledger.update_transaction">[docs]</a> <span class="k">def</span> <span class="nf">update_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">transaction</span><span class="p">):</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;DUMMY: Updated transaction: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">transaction</span><span class="p">)</span> <span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Update a transaction in the ledger file.</span>
<span class="sd"> Takes a :class:`~accounting.models.Transaction` object and removes</span>
<span class="sd"> the old transaction using :data:`transaction.id` from the passed</span>
<span class="sd"> :class:`~accounting.models.Transaction` instance and adds</span>
<span class="sd"> :data:`transaction` to the database.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span><span class="p">:</span>
<span class="k">return</span> <span class="n">AccountingException</span><span class="p">((</span><span class="s">&#39;The transaction {0} has no&#39;</span>
<span class="s">&#39; id attribute&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">transaction</span><span class="p">))</span>
<span class="n">old_transaction</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_transaction</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">delete_transaction</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_transaction</span><span class="p">(</span><span class="n">transaction</span><span class="p">)</span>
<span class="n">_log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Updated transaction from: </span><span class="si">%s</span><span class="s"> to: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">old_transaction</span><span class="p">,</span>
<span class="n">transaction</span><span class="p">)</span>
</div></div> </div></div>
<div class="viewcode-block" id="main"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> <div class="viewcode-block" id="main"><a class="viewcode-back" href="../../../api/accounting.storage.html#accounting.storage.ledgercli.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
@ -392,6 +529,17 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../../index.html">Documentation overview</a><ul>
<li><a href="../../index.html">Module code</a><ul>
<li><a href="../storage.html">accounting.storage</a><ul>
</ul></li>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get"> <form class="search" action="../../../search.html" method="get">
@ -409,27 +557,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../accounting.html" >accounting</a> &raquo;</li>
<li><a href="../storage.html" >accounting.storage</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.storage.sql &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.storage.sql &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -25,8 +25,15 @@
<script type="text/javascript" src="../../../_static/doctools.js"></script> <script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../../index.html" />
<link rel="up" title="accounting.storage" href="../storage.html" /> <link rel="up" title="accounting.storage" href="../storage.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -41,7 +48,6 @@
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li> <li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../accounting.html" >accounting</a> &raquo;</li>
<li><a href="../storage.html" accesskey="U">accounting.storage</a> &raquo;</li> <li><a href="../storage.html" accesskey="U">accounting.storage</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -52,6 +58,10 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.storage.sql</h1><div class="highlight"><pre> <h1>Source code for accounting.storage.sql</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">import</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">json</span> <span class="kn">import</span> <span class="nn">json</span>
@ -62,18 +72,17 @@
<span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span> <span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Amount</span>
<span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span> <span class="n">_log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
<span class="n">db</span> <span class="o">=</span> <span class="bp">None</span> <span class="n">db</span> <span class="o">=</span> <span class="n">SQLAlchemy</span><span class="p">()</span>
<div class="viewcode-block" id="SQLStorage"><a class="viewcode-back" href="../../../api/accounting.storage.sql.html#accounting.storage.sql.SQLStorage">[docs]</a><span class="k">class</span> <span class="nc">SQLStorage</span><span class="p">(</span><span class="n">Storage</span><span class="p">):</span> <div class="viewcode-block" id="SQLStorage"><a class="viewcode-back" href="../../../api/accounting.storage.sql.html#accounting.storage.sql.SQLStorage">[docs]</a><span class="k">class</span> <span class="nc">SQLStorage</span><span class="p">(</span><span class="n">Storage</span><span class="p">):</span>
<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">app</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> <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">app</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">global</span> <span class="n">db</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">app</span><span class="p">:</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">app</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;Missing app keyword argument&#39;</span><span class="p">)</span> <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;Missing app keyword argument&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span>
<span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span> <span class="o">=</span> <span class="n">SQLAlchemy</span><span class="p">(</span><span class="n">app</span><span class="p">)</span> <span class="n">db</span><span class="o">.</span><span class="n">init_app</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
<span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">Transaction</span> <span class="k">as</span> <span class="n">SQLTransaction</span><span class="p">,</span> \ <span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">Transaction</span> <span class="k">as</span> <span class="n">SQLTransaction</span><span class="p">,</span> \
<span class="n">Posting</span> <span class="k">as</span> <span class="n">SQLPosting</span><span class="p">,</span> <span class="n">Amount</span> <span class="k">as</span> <span class="n">SQLAmount</span> <span class="n">Posting</span> <span class="k">as</span> <span class="n">SQLPosting</span><span class="p">,</span> <span class="n">Amount</span> <span class="k">as</span> <span class="n">SQLAmount</span>
@ -123,7 +132,7 @@
<span class="n">_t</span><span class="o">.</span><span class="n">payee</span> <span class="o">=</span> <span class="n">transaction</span><span class="o">.</span><span class="n">payee</span> <span class="n">_t</span><span class="o">.</span><span class="n">payee</span> <span class="o">=</span> <span class="n">transaction</span><span class="o">.</span><span class="n">payee</span>
<span class="n">_t</span><span class="o">.</span><span class="n">meta</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">metadata</span><span class="p">)</span> <span class="n">_t</span><span class="o">.</span><span class="n">meta</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">transaction</span><span class="o">.</span><span class="n">metadata</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">_t</span><span class="p">)</span> <span class="n">db</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">_t</span><span class="p">)</span>
<span class="k">for</span> <span class="n">posting</span> <span class="ow">in</span> <span class="n">transaction</span><span class="o">.</span><span class="n">postings</span><span class="p">:</span> <span class="k">for</span> <span class="n">posting</span> <span class="ow">in</span> <span class="n">transaction</span><span class="o">.</span><span class="n">postings</span><span class="p">:</span>
<span class="n">_p</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Posting</span><span class="p">()</span> <span class="n">_p</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Posting</span><span class="p">()</span>
@ -133,9 +142,9 @@
<span class="n">_p</span><span class="o">.</span><span class="n">amount</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Amount</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span><span class="p">,</span> <span class="n">_p</span><span class="o">.</span><span class="n">amount</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Amount</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">symbol</span><span class="p">,</span>
<span class="n">amount</span><span class="o">=</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">)</span> <span class="n">amount</span><span class="o">=</span><span class="n">posting</span><span class="o">.</span><span class="n">amount</span><span class="o">.</span><span class="n">amount</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">_p</span><span class="p">)</span> <span class="n">db</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">_p</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span></div></div> <span class="n">db</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span></div></div>
</pre></div> </pre></div>
</div> </div>
@ -143,6 +152,17 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../../index.html">Documentation overview</a><ul>
<li><a href="../../index.html">Module code</a><ul>
<li><a href="../storage.html">accounting.storage</a><ul>
</ul></li>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get"> <form class="search" action="../../../search.html" method="get">
@ -160,27 +180,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../accounting.html" >accounting</a> &raquo;</li>
<li><a href="../storage.html" >accounting.storage</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.storage.sql.models &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.storage.sql.models &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -25,8 +25,15 @@
<script type="text/javascript" src="../../../../_static/doctools.js"></script> <script type="text/javascript" src="../../../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../../../index.html" />
<link rel="up" title="accounting.storage.sql" href="../sql.html" /> <link rel="up" title="accounting.storage.sql" href="../sql.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -41,7 +48,6 @@
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../../../index.html" >Module code</a> &raquo;</li> <li><a href="../../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../../accounting.html" >accounting</a> &raquo;</li>
<li><a href="../../storage.html" >accounting.storage</a> &raquo;</li> <li><a href="../../storage.html" >accounting.storage</a> &raquo;</li>
<li><a href="../sql.html" accesskey="U">accounting.storage.sql</a> &raquo;</li> <li><a href="../sql.html" accesskey="U">accounting.storage.sql</a> &raquo;</li>
</ul> </ul>
@ -53,6 +59,10 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.storage.sql.models</h1><div class="highlight"><pre> <h1>Source code for accounting.storage.sql.models</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">import</span> <span class="nn">json</span> <span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">db</span> <span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">db</span>
@ -113,6 +123,19 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../../index.html">
<img class="logo" src="../../../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../../../index.html">Documentation overview</a><ul>
<li><a href="../../../index.html">Module code</a><ul>
<li><a href="../../storage.html">accounting.storage</a><ul>
<li><a href="../sql.html">accounting.storage.sql</a><ul>
</ul></li>
</ul></li>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../../../search.html" method="get"> <form class="search" action="../../../../search.html" method="get">
@ -130,28 +153,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../../accounting.html" >accounting</a> &raquo;</li>
<li><a href="../../storage.html" >accounting.storage</a> &raquo;</li>
<li><a href="../sql.html" >accounting.storage.sql</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.transport &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.transport &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,12 +57,17 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.transport</h1><div class="highlight"><pre> <h1>Source code for accounting.transport</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span> <span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">json</span> <span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">json</span>
<span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Amount</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Account</span> <span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Amount</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">,</span> <span class="n">Posting</span><span class="p">,</span> <span class="n">Account</span>
<div class="viewcode-block" id="AccountingEncoder"><a class="viewcode-back" href="../../api/accounting.html#accounting.transport.AccountingEncoder">[docs]</a><span class="k">class</span> <span class="nc">AccountingEncoder</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">JSONEncoder</span><span class="p">):</span> <div class="viewcode-block" id="AccountingEncoder"><a class="viewcode-back" href="../../api/accounting.html#accounting.transport.AccountingEncoder">[docs]</a><span class="k">class</span> <span class="nc">AccountingEncoder</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">JSONEncoder</span><span class="p">):</span>
<div class="viewcode-block" id="AccountingEncoder.default"><a class="viewcode-back" href="../../api/accounting.html#accounting.transport.AccountingEncoder.default">[docs]</a> <span class="k">def</span> <span class="nf">default</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">o</span><span class="p">):</span> <div class="viewcode-block" id="AccountingEncoder.default"><a class="viewcode-back" href="../../api/accounting.html#accounting.transport.AccountingEncoder.default">[docs]</a> <span class="k">def</span> <span class="nf">default</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">o</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="n">Account</span><span class="p">):</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="n">Account</span><span class="p">):</span>
@ -69,6 +80,7 @@
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">):</span> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">dict</span><span class="p">(</span> <span class="k">return</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">__type__</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">__type__</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span>
<span class="nb">id</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
<span class="n">date</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">),</span> <span class="n">date</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">),</span>
<span class="n">payee</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">payee</span><span class="p">,</span> <span class="n">payee</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">payee</span><span class="p">,</span>
<span class="n">postings</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">postings</span><span class="p">,</span> <span class="n">postings</span><span class="o">=</span><span class="n">o</span><span class="o">.</span><span class="n">postings</span><span class="p">,</span>
@ -94,6 +106,7 @@
<span class="p">)</span> <span class="p">)</span>
<span class="k">return</span> <span class="n">json</span><span class="o">.</span><span class="n">JSONEncoder</span><span class="o">.</span><span class="n">default</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">o</span><span class="p">)</span> <span class="k">return</span> <span class="n">json</span><span class="o">.</span><span class="n">JSONEncoder</span><span class="o">.</span><span class="n">default</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">o</span><span class="p">)</span>
</div></div> </div></div>
<div class="viewcode-block" id="AccountingDecoder"><a class="viewcode-back" href="../../api/accounting.html#accounting.transport.AccountingDecoder">[docs]</a><span class="k">class</span> <span class="nc">AccountingDecoder</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">JSONDecoder</span><span class="p">):</span> <div class="viewcode-block" id="AccountingDecoder"><a class="viewcode-back" href="../../api/accounting.html#accounting.transport.AccountingDecoder">[docs]</a><span class="k">class</span> <span class="nc">AccountingDecoder</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">JSONDecoder</span><span class="p">):</span>
<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="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
@ -119,6 +132,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -136,26 +158,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.web &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.web &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,9 +24,16 @@
<script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../../index.html" />
<link rel="up" title="accounting" href="../accounting.html" /> <link rel="up" title="Module code" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,8 +47,7 @@
<a href="../../py-modindex.html" title="Python Module Index" <a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
<li><a href="../accounting.html" accesskey="U">accounting</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -51,6 +57,10 @@
<div class="body"> <div class="body">
<h1>Source code for accounting.web</h1><div class="highlight"><pre> <h1>Source code for accounting.web</h1><div class="highlight"><pre>
<span class="c"># Part of accounting-api project:</span>
<span class="c"># https://gitorious.org/conservancy/accounting-api</span>
<span class="c"># License: AGPLv3-or-later</span>
<span class="sd">&#39;&#39;&#39;</span> <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">This module contains the high-level webservice logic such as the Flask setup</span> <span class="sd">This module contains the high-level webservice logic such as the Flask setup</span>
<span class="sd">and the Flask endpoints.</span> <span class="sd">and the Flask endpoints.</span>
@ -59,18 +69,32 @@
<span class="kn">import</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">argparse</span> <span class="kn">import</span> <span class="nn">argparse</span>
<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">jsonify</span><span class="p">,</span> <span class="n">request</span> <span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">jsonify</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">render_template</span>
<span class="kn">from</span> <span class="nn">flask.ext.script</span> <span class="kn">import</span> <span class="n">Manager</span>
<span class="kn">from</span> <span class="nn">flask.ext.migrate</span> <span class="kn">import</span> <span class="n">Migrate</span><span class="p">,</span> <span class="n">MigrateCommand</span>
<span class="kn">from</span> <span class="nn">accounting</span> <span class="kn">import</span> <span class="n">Ledger</span> <span class="kn">from</span> <span class="nn">accounting.models</span> <span class="kn">import</span> <span class="n">Transaction</span>
<span class="kn">from</span> <span class="nn">accounting.storage</span> <span class="kn">import</span> <span class="n">Storage</span>
<span class="kn">from</span> <span class="nn">accounting.storage.ledgercli</span> <span class="kn">import</span> <span class="n">Ledger</span>
<span class="kn">from</span> <span class="nn">accounting.storage.sql</span> <span class="kn">import</span> <span class="n">SQLStorage</span>
<span class="kn">from</span> <span class="nn">accounting.transport</span> <span class="kn">import</span> <span class="n">AccountingEncoder</span><span class="p">,</span> <span class="n">AccountingDecoder</span> <span class="kn">from</span> <span class="nn">accounting.transport</span> <span class="kn">import</span> <span class="n">AccountingEncoder</span><span class="p">,</span> <span class="n">AccountingDecoder</span>
<span class="kn">from</span> <span class="nn">accounting.exceptions</span> <span class="kn">import</span> <span class="n">AccountingException</span> <span class="kn">from</span> <span class="nn">accounting.exceptions</span> <span class="kn">import</span> <span class="n">AccountingException</span>
<span class="kn">from</span> <span class="nn">accounting.decorators</span> <span class="kn">import</span> <span class="n">jsonify_exceptions</span> <span class="kn">from</span> <span class="nn">accounting.decorators</span> <span class="kn">import</span> <span class="n">jsonify_exceptions</span><span class="p">,</span> <span class="n">cors</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="s">&#39;accounting&#39;</span><span class="p">)</span> <span class="n">app</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="s">&#39;accounting&#39;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="s">&#39;config.py&#39;</span><span class="p">)</span> <span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="s">&#39;config.py&#39;</span><span class="p">)</span>
<span class="n">ledger</span> <span class="o">=</span> <span class="bp">None</span> <span class="n">storage</span> <span class="o">=</span> <span class="n">Storage</span><span class="p">()</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">storage</span><span class="p">,</span> <span class="n">SQLStorage</span><span class="p">):</span>
<span class="c"># TODO: Move migration stuff into SQLStorage</span>
<span class="n">db</span> <span class="o">=</span> <span class="n">storage</span><span class="o">.</span><span class="n">db</span>
<span class="n">migrate</span> <span class="o">=</span> <span class="n">Migrate</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">db</span><span class="p">)</span>
<span class="n">manager</span> <span class="o">=</span> <span class="n">Manager</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
<span class="n">manager</span><span class="o">.</span><span class="n">add_command</span><span class="p">(</span><span class="s">&#39;db&#39;</span><span class="p">,</span> <span class="n">MigrateCommand</span><span class="p">)</span>
<span class="nd">@app.before_request</span> <span class="nd">@app.before_request</span>
<div class="viewcode-block" id="init_ledger"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.init_ledger">[docs]</a><span class="k">def</span> <span class="nf">init_ledger</span><span class="p">():</span> <div class="viewcode-block" id="init_ledger"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.init_ledger">[docs]</a><span class="k">def</span> <span class="nf">init_ledger</span><span class="p">():</span>
@ -79,7 +103,7 @@
<span class="sd"> :py:class:`accounting.Ledger` object.</span> <span class="sd"> :py:class:`accounting.Ledger` object.</span>
<span class="sd"> &#39;&#39;&#39;</span> <span class="sd"> &#39;&#39;&#39;</span>
<span class="k">global</span> <span class="n">ledger</span> <span class="k">global</span> <span class="n">ledger</span>
<span class="n">ledger</span> <span class="o">=</span> <span class="n">Ledger</span><span class="p">(</span><span class="n">ledger_file</span><span class="o">=</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;LEDGER_FILE&#39;</span><span class="p">])</span> <span class="c">#ledger = Ledger(ledger_file=app.config[&#39;LEDGER_FILE&#39;])</span>
<span class="c"># These will convert output from our internal classes to JSON and back</span></div> <span class="c"># These will convert output from our internal classes to JSON and back</span></div>
@ -91,25 +115,74 @@
<div class="viewcode-block" id="index"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.index">[docs]</a><span class="k">def</span> <span class="nf">index</span><span class="p">():</span> <div class="viewcode-block" id="index"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.index">[docs]</a><span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
<span class="sd">&#39;&#39;&#39; Hello World! &#39;&#39;&#39;</span> <span class="sd">&#39;&#39;&#39; Hello World! &#39;&#39;&#39;</span>
<span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span> <span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span>
</div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/client&#39;</span><span class="p">)</span>
<div class="viewcode-block" id="client"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.client">[docs]</a><span class="k">def</span> <span class="nf">client</span><span class="p">():</span>
<span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;client.html&#39;</span><span class="p">)</span>
</div> </div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/balance&#39;</span><span class="p">)</span> <span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;OPTIONS&#39;</span><span class="p">])</span>
<div class="viewcode-block" id="balance_report"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.balance_report">[docs]</a><span class="k">def</span> <span class="nf">balance_report</span><span class="p">():</span> <span class="nd">@cors</span><span class="p">()</span>
<span class="sd">&#39;&#39;&#39;</span> <span class="nd">@jsonify_exceptions</span>
<span class="sd"> Returns the JSON-serialized result of :meth:`accounting.Ledger.bal`</span> <div class="viewcode-block" id="transaction_options"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_options">[docs]</a><span class="k">def</span> <span class="nf">transaction_options</span><span class="p">():</span>
<span class="sd"> &#39;&#39;&#39;</span> <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;OPTIONS&#39;</span><span class="p">)</span>
<span class="n">report_data</span> <span class="o">=</span> <span class="n">ledger</span><span class="o">.</span><span class="n">bal</span><span class="p">()</span>
</div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction/&lt;string:transaction_id&gt;&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;OPTIONS&#39;</span><span class="p">])</span>
<span class="nd">@cors</span><span class="p">()</span>
<span class="nd">@jsonify_exceptions</span>
<div class="viewcode-block" id="transaction_by_id_options"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_by_id_options">[docs]</a><span class="k">def</span> <span class="nf">transaction_by_id_options</span><span class="p">(</span><span class="n">transaction_id</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;OPTIONS&#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">balance_report</span><span class="o">=</span><span class="n">report_data</span><span class="p">)</span>
</div> </div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">])</span> <span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">])</span>
<div class="viewcode-block" id="transaction_get"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_get">[docs]</a><span class="k">def</span> <span class="nf">transaction_get</span><span class="p">():</span> <span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction/&lt;string:transaction_id&gt;&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">])</span>
<span class="nd">@cors</span><span class="p">()</span>
<span class="nd">@jsonify_exceptions</span>
<div class="viewcode-block" id="transaction_get"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_get">[docs]</a><span class="k">def</span> <span class="nf">transaction_get</span><span class="p">(</span><span class="n">transaction_id</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span> <span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Returns the JSON-serialized output of :meth:`accounting.Ledger.reg`</span> <span class="sd"> Returns the JSON-serialized output of :meth:`accounting.Ledger.reg`</span>
<span class="sd"> &#39;&#39;&#39;</span> <span class="sd"> &#39;&#39;&#39;</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">transactions</span><span class="o">=</span><span class="n">ledger</span><span class="o">.</span><span class="n">reg</span><span class="p">())</span> <span class="k">if</span> <span class="n">transaction_id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">transactions</span><span class="o">=</span><span class="n">storage</span><span class="o">.</span><span class="n">get_transactions</span><span class="p">())</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">transaction</span><span class="o">=</span><span class="n">storage</span><span class="o">.</span><span class="n">get_transaction</span><span class="p">(</span><span class="n">transaction_id</span><span class="p">))</span>
</div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction/&lt;string:transaction_id&gt;&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;POST&#39;</span><span class="p">])</span>
<span class="nd">@cors</span><span class="p">()</span>
<span class="nd">@jsonify_exceptions</span>
<div class="viewcode-block" id="transaction_update"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_update">[docs]</a><span class="k">def</span> <span class="nf">transaction_update</span><span class="p">(</span><span class="n">transaction_id</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">if</span> <span class="n">transaction_id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">AccountingException</span><span class="p">(</span><span class="s">&#39;The transaction ID cannot be None.&#39;</span><span class="p">)</span>
<span class="n">transaction</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">json</span><span class="p">[</span><span class="s">&#39;transaction&#39;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">transaction_id</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">AccountingException</span><span class="p">(</span><span class="s">&#39;The transaction data has an ID attribute&#39;</span>
<span class="s">&#39; and it is not the same ID as in the path&#39;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">transaction</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">transaction_id</span>
<span class="n">storage</span><span class="o">.</span><span class="n">update_transaction</span><span class="p">(</span><span class="n">transaction</span><span class="p">)</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;OK&#39;</span><span class="p">)</span>
</div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction/&lt;string:transaction_id&gt;&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;DELETE&#39;</span><span class="p">])</span>
<span class="nd">@cors</span><span class="p">()</span>
<span class="nd">@jsonify_exceptions</span>
<div class="viewcode-block" id="transaction_delete"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_delete">[docs]</a><span class="k">def</span> <span class="nf">transaction_delete</span><span class="p">(</span><span class="n">transaction_id</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">if</span> <span class="n">transaction_id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">AccountingException</span><span class="p">(</span><span class="s">&#39;Transaction ID cannot be None&#39;</span><span class="p">)</span>
<span class="n">storage</span><span class="o">.</span><span class="n">delete_transaction</span><span class="p">(</span><span class="n">transaction_id</span><span class="p">)</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;OK&#39;</span><span class="p">)</span>
</div> </div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;POST&#39;</span><span class="p">])</span> <span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/transaction&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;POST&#39;</span><span class="p">])</span>
<span class="nd">@cors</span><span class="p">()</span>
<span class="nd">@jsonify_exceptions</span> <span class="nd">@jsonify_exceptions</span>
<div class="viewcode-block" id="transaction_post"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_post">[docs]</a><span class="k">def</span> <span class="nf">transaction_post</span><span class="p">():</span> <div class="viewcode-block" id="transaction_post"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.transaction_post">[docs]</a><span class="k">def</span> <span class="nf">transaction_post</span><span class="p">():</span>
<span class="sd">&#39;&#39;&#39;</span> <span class="sd">&#39;&#39;&#39;</span>
@ -159,74 +232,20 @@
<span class="sd"> Income:Foo:Donation $ -100</span> <span class="sd"> Income:Foo:Donation $ -100</span>
<span class="sd"> Assets:Checking $ 100</span> <span class="sd"> Assets:Checking $ 100</span>
<span class="sd"> &#39;&#39;&#39;</span> <span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">json</span><span class="p">,</span> <span class="n">Transaction</span><span class="p">):</span>
<span class="n">transactions</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">json</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;transactions&#39;</span><span class="p">)</span> <span class="n">transactions</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">json</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;transactions&#39;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">transactions</span> <span class="o">=</span> <span class="p">[</span><span class="n">request</span><span class="o">.</span><span class="n">json</span><span class="p">]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">transactions</span><span class="p">:</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">transactions</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">AccountingException</span><span class="p">(</span><span class="s">&#39;No transaction data provided&#39;</span><span class="p">)</span> <span class="k">raise</span> <span class="n">AccountingException</span><span class="p">(</span><span class="s">&#39;No transaction data provided&#39;</span><span class="p">)</span>
<span class="n">transaction_ids</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">transaction</span> <span class="ow">in</span> <span class="n">transactions</span><span class="p">:</span> <span class="k">for</span> <span class="n">transaction</span> <span class="ow">in</span> <span class="n">transactions</span><span class="p">:</span>
<span class="n">ledger</span><span class="o">.</span><span class="n">add_transaction</span><span class="p">(</span><span class="n">transaction</span><span class="p">)</span> <span class="n">transaction_ids</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">storage</span><span class="o">.</span><span class="n">add_transaction</span><span class="p">(</span><span class="n">transaction</span><span class="p">))</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">foo</span><span class="o">=</span><span class="s">&#39;bar&#39;</span><span class="p">)</span> <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;OK&#39;</span><span class="p">,</span> <span class="n">transaction_ids</span><span class="o">=</span><span class="n">transaction_ids</span><span class="p">)</span>
</div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/parse-json&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;POST&#39;</span><span class="p">])</span>
<div class="viewcode-block" id="parse_json"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.parse_json">[docs]</a><span class="k">def</span> <span class="nf">parse_json</span><span class="p">():</span>
<span class="sd">r&#39;&#39;&#39;</span>
<span class="sd"> Parses a __type__-annotated JSON payload and debug-logs the decoded version</span>
<span class="sd"> of it.</span>
<span class="sd"> Example:</span>
<span class="sd"> .. code-block:: bash</span>
<span class="sd"> wget http://127.0.0.1:5000/balance -O balance.json</span>
<span class="sd"> curl -X POST -H &#39;Content-Type: application/json&#39; -d @balance.json \</span>
<span class="sd"> http://127.0.0.1/parse-json</span>
<span class="sd"> # Logging output (linebreaks added for clarity)</span>
<span class="sd"> # DEBUG:accounting:json data: {&#39;balance_report&#39;:</span>
<span class="sd"> # [&lt;Account &quot;None&quot; [</span>
<span class="sd"> # &lt;Amount $ 0&gt;, &lt;Amount KARMA 0&gt;]</span>
<span class="sd"> # [&lt;Account &quot;Assets&quot; [</span>
<span class="sd"> # &lt;Amount $ 50&gt;, &lt;Amount KARMA 10&gt;]</span>
<span class="sd"> # [&lt;Account &quot;Assets:Checking&quot; [</span>
<span class="sd"> # &lt;Amount $ 50&gt;] []&gt;,</span>
<span class="sd"> # &lt;Account &quot;Assets:Karma Account&quot; [</span>
<span class="sd"> # &lt;Amount KARMA 10&gt;] []&gt;]&gt;,</span>
<span class="sd"> # &lt;Account &quot;Expenses&quot; [</span>
<span class="sd"> # &lt;Amount $ 500&gt;]</span>
<span class="sd"> # [&lt;Account &quot;Expenses:Blah&quot; [</span>
<span class="sd"> # &lt;Amount $ 250&gt;]</span>
<span class="sd"> # [&lt;Account &quot;Expenses:Blah:Hosting&quot; [</span>
<span class="sd"> # &lt;Amount $ 250&gt;] []&gt;]&gt;,</span>
<span class="sd"> # &lt;Account &quot;Expenses:Foo&quot; [</span>
<span class="sd"> # &lt;Amount $ 250&gt;] [</span>
<span class="sd"> # &lt;Account &quot;Expenses:Foo:Hosting&quot; [</span>
<span class="sd"> # &lt;Amount $ 250&gt;] []&gt;]&gt;]&gt;,</span>
<span class="sd"> # &lt;Account &quot;Income&quot; [</span>
<span class="sd"> # &lt;Amount $ -550&gt;,</span>
<span class="sd"> # &lt;Amount KARMA -10&gt;]</span>
<span class="sd"> # [&lt;Account &quot;Income:Donation&quot; [</span>
<span class="sd"> # &lt;Amount $ -50&gt;] []&gt;,</span>
<span class="sd"> # &lt;Account &quot;Income:Foo&quot; [</span>
<span class="sd"> # &lt;Amount $ -500&gt;]</span>
<span class="sd"> # [&lt;Account &quot;Income:Foo:Donation&quot; [</span>
<span class="sd"> # &lt;Amount $ -500&gt;] []&gt;]&gt;,</span>
<span class="sd"> # &lt;Account &quot;Income:Karma&quot; [</span>
<span class="sd"> # &lt;Amount KARMA -10&gt;] []&gt;]&gt;]&gt;]}</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;json data: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">request</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">foo</span><span class="o">=</span><span class="s">&#39;bar&#39;</span><span class="p">)</span>
</div>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/register&#39;</span><span class="p">)</span>
<div class="viewcode-block" id="register_report"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.register_report">[docs]</a><span class="k">def</span> <span class="nf">register_report</span><span class="p">():</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Returns the JSON-serialized output of :py:meth:`accounting.Ledger.reg`</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">report_data</span> <span class="o">=</span> <span class="n">ledger</span><span class="o">.</span><span class="n">reg</span><span class="p">()</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">register_report</span><span class="o">=</span><span class="n">report_data</span><span class="p">)</span>
</div> </div>
<div class="viewcode-block" id="main"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> <div class="viewcode-block" id="main"><a class="viewcode-back" href="../../api/accounting.html#accounting.web.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
@ -241,6 +260,9 @@
<span class="n">help</span><span class="o">=</span><span class="p">(</span><span class="s">&#39;Filter logging output. Possible values:&#39;</span> <span class="o">+</span> <span class="n">help</span><span class="o">=</span><span class="p">(</span><span class="s">&#39;Filter logging output. Possible values:&#39;</span> <span class="o">+</span>
<span class="s">&#39; CRITICAL, ERROR, WARNING, INFO, DEBUG&#39;</span><span class="p">))</span> <span class="s">&#39; CRITICAL, ERROR, WARNING, INFO, DEBUG&#39;</span><span class="p">))</span>
<span class="k">global</span> <span class="n">storage</span>
<span class="n">storage</span> <span class="o">=</span> <span class="n">Ledger</span><span class="p">(</span><span class="n">app</span><span class="o">=</span><span class="n">app</span><span class="p">)</span>
<span class="n">args</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span> <span class="n">args</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span>
<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="nb">getattr</span><span class="p">(</span><span class="n">logging</span><span class="p">,</span> <span class="n">args</span><span class="o">.</span><span class="n">verbosity</span><span class="p">,</span> <span class="s">&#39;INFO&#39;</span><span class="p">))</span> <span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="nb">getattr</span><span class="p">(</span><span class="n">logging</span><span class="p">,</span> <span class="n">args</span><span class="o">.</span><span class="n">verbosity</span><span class="p">,</span> <span class="s">&#39;INFO&#39;</span><span class="p">))</span>
@ -256,6 +278,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../../search.html" method="get"> <form class="search" action="../../search.html" method="get">
@ -273,26 +304,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../accounting.html" >accounting</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>Overview: module code &mdash; Accounting API 0.1-beta documentation</title> <title>Overview: module code &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,8 +24,15 @@
<script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -48,7 +55,6 @@
<div class="body"> <div class="body">
<h1>All modules for which code is available</h1> <h1>All modules for which code is available</h1>
<ul><li><a href="accounting.html">accounting</a></li>
<ul><li><a href="accounting/client.html">accounting.client</a></li> <ul><li><a href="accounting/client.html">accounting.client</a></li>
<li><a href="accounting/decorators.html">accounting.decorators</a></li> <li><a href="accounting/decorators.html">accounting.decorators</a></li>
<li><a href="accounting/exceptions.html">accounting.exceptions</a></li> <li><a href="accounting/exceptions.html">accounting.exceptions</a></li>
@ -60,13 +66,20 @@
<ul><li><a href="accounting/storage/sql/models.html">accounting.storage.sql.models</a></li> <ul><li><a href="accounting/storage/sql/models.html">accounting.storage.sql.models</a></li>
</ul></ul><li><a href="accounting/transport.html">accounting.transport</a></li> </ul></ul><li><a href="accounting/transport.html">accounting.transport</a></li>
<li><a href="accounting/web.html">accounting.web</a></li> <li><a href="accounting/web.html">accounting.web</a></li>
</ul></ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="../search.html" method="get"> <form class="search" action="../search.html" method="get">
@ -84,24 +97,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,7 +0,0 @@
asyncio-test Module
===================
.. automodule:: asyncio-test
:members:
:undoc-members:
:show-inheritance:

View file

@ -6,6 +6,10 @@
Welcome to Accounting API's documentation! Welcome to Accounting API's documentation!
========================================== ==========================================
-----------------------
Accounting API
-----------------------
Contents: Contents:
.. toctree:: .. toctree::
@ -13,8 +17,6 @@ Contents:
README README
restapi restapi
api/accounting.rst
Indices and tables Indices and tables

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg height="167.00000pt" id="svg951" inkscape:version="0.39cvs" sodipodi:docbase="/root/img" sodipodi:docname="openbook.svg" sodipodi:version="0.32" width="300.00000pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
<metadata>
<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work rdf:about="">
<dc:title>Open Book</dc:title>
<dc:description/>
<dc:subject>
<rdf:Bag>
<rdf:li>hash</rdf:li>
<rdf:li/>
<rdf:li>education</rdf:li>
<rdf:li>book</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:rights>
<dc:date/>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<defs id="defs953"/>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:cx="151.77472" inkscape:cy="78.534102" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="712" inkscape:window-width="942" inkscape:window-x="259" inkscape:window-y="151" inkscape:zoom="2.4559706" pagecolor="#ffffff"/>
<g id="g2198" transform="translate(-256.9943,-227.9440)">
<path d="M 264.66115,311.01114 C 289.60037,352.91582 311.99478,387.69500 336.93400,429.59969 C 388.16969,404.99978 409.88547,396.68669 454.50463,381.24813 C 474.01491,386.84673 494.54311,376.66746 502.85619,369.03299 C 539.67123,363.94335 582.59383,357.83579 623.98955,353.76408 C 622.97162,347.14755 625.00748,344.60274 623.98955,337.98621 C 581.06694,306.60011 537.63538,273.68712 494.71277,242.30102 C 416.33235,264.52577 343.04157,288.78638 264.66115,311.01114 z " id="path14684" sodipodi:nodetypes="cccccccc" style="fill:#001873;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#fefefe;stroke-width:5.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 274.33146,312.53802 C 296.72587,348.16548 319.12027,383.79295 341.51468,419.42041 C 381.21385,398.55290 428.33666,367.46993 465.20346,375.77302 C 463.41399,363.50114 469.18224,356.62763 476.39007,348.67445 C 416.50200,338.32552 386.64280,372.76540 344.05950,389.39155 C 343.21123,398.04393 342.36295,406.69632 341.51468,415.34870 C 342.70226,407.03563 342.87191,398.72255 344.05949,390.40948 C 324.71887,360.38062 301.81551,322.71729 282.47489,292.68843 C 276.19766,295.74221 275.51905,305.41253 274.33146,312.53802 z " id="path14685" sodipodi:nodetypes="ccccccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:3.7500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 470.79147,360.38062 C 487.24796,328.99452 500.59410,326.77716 532.88505,322.20833 C 558.18346,318.62887 575.92056,319.47328 601.70806,318.28569 C 599.50255,325.75050 603.29171,335.61104 606.68480,345.62066 C 582.42419,346.63859 563.25322,345.11170 536.44780,348.67444 C 518.63406,347.14755 502.85618,358.34476 491.15002,370.05092 C 492.16795,348.33514 479.95281,361.73786 470.79147,360.38062 z " id="path14686" sodipodi:nodetypes="csccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:3.7500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 396.48276,273.85678 C 421.93095,298.45669 447.37914,323.05661 472.82733,347.65652 C 411.15789,340.02206 378.24489,377.43089 343.55053,389.64603 C 323.53129,357.92062 302.23964,324.15936 282.22040,292.43395 C 307.32928,280.38848 323.90617,260.54300 360.34634,257.56994 C 374.47078,256.41756 385.45522,265.88301 396.48276,273.85678 z " id="path14687" sodipodi:nodetypes="ccccsc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 476.49663,348.91674 C 495.45093,316.88638 534.55916,321.56497 601.37906,316.52649 C 566.10967,292.53371 530.84028,268.54092 495.57089,244.54814 C 449.38479,253.54544 418.31414,234.47117 393.36165,270.10046 L 476.49663,348.91674 z " id="path950" sodipodi:nodetypes="ccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View file

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="300pt"
height="167pt"
id="svg951">
<metadata
id="metadata3035">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title></dc:title>
<dc:description />
<dc:subject>
<rdf:Bag>
<rdf:li>hash</rdf:li>
<rdf:li />
<rdf:li>education</rdf:li>
<rdf:li>book</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent
rdf:about="http://www.openclipart.org">
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:rights>
<dc:date />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://web.resource.org/cc/PublicDomain" />
<dc:language>en</dc:language>
</cc:Work>
<cc:License
rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs953" />
<g
transform="translate(-256.9943,-227.944)"
id="g2198">
<path
d="m 264.66115,311.01114 c 24.93922,41.90468 47.33363,76.68386 72.27285,118.58855 51.23569,-24.59991 72.95147,-32.913 117.57063,-48.35156 19.51028,5.5986 40.03848,-4.58067 48.35156,-12.21514 36.81504,-5.08964 79.73764,-11.1972 121.13336,-15.26891 -1.01793,-6.61653 1.01793,-9.16134 0,-15.77787 -42.92261,-31.3861 -86.35417,-64.29909 -129.27678,-95.68519 -78.38042,22.22475 -151.6712,46.48536 -230.05162,68.71012 z"
id="path14684"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#fefefe;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 274.33146,312.53802 c 22.39441,35.62746 44.78881,71.25493 67.18322,106.88239 39.69917,-20.86751 86.82198,-51.95048 123.68878,-43.64739 -1.78947,-12.27188 3.97878,-19.14539 11.18661,-27.09857 -59.88807,-10.34893 -89.74727,24.09095 -132.33057,40.7171 -0.84827,8.65238 -1.69655,17.30477 -2.54482,25.95715 1.18758,-8.31307 1.35723,-16.62615 2.54481,-24.93922 -19.34062,-30.02886 -42.24398,-67.69219 -61.5846,-97.72105 -6.27723,3.05378 -6.95584,12.7241 -8.14343,19.84959 z"
id="path14685"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.75;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 470.79147,360.38062 c 16.45649,-31.3861 29.80263,-33.60346 62.09358,-38.17229 25.29841,-3.57946 43.03551,-2.73505 68.82301,-3.92264 -2.20551,7.46481 1.58365,17.32535 4.97674,27.33497 -24.26061,1.01793 -43.43158,-0.50896 -70.237,3.05378 -17.81374,-1.52689 -33.59162,9.67032 -45.29778,21.37648 1.01793,-21.71578 -11.19721,-8.31306 -20.35855,-9.6703 z"
id="path14686"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.75;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 396.48276,273.85678 c 25.44819,24.59991 50.89638,49.19983 76.34457,73.79974 -61.66944,-7.63446 -94.58244,29.77437 -129.2768,41.98951 -20.01924,-31.72541 -41.31089,-65.48667 -61.33013,-97.21208 25.10888,-12.04547 41.68577,-31.89095 78.12594,-34.86401 14.12444,-1.15238 25.10888,8.31307 36.13642,16.28684 z"
id="path14687"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 476.49663,348.91674 c 18.9543,-32.03036 58.06253,-27.35177 124.88243,-32.39025 -35.26939,-23.99278 -70.53878,-47.98557 -105.80817,-71.97835 -46.1861,8.9973 -77.25675,-10.07697 -102.20924,25.55232 l 83.13498,78.81628 z"
id="path950"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -1,256 +0,0 @@
/*
* default.css_t
* ~~~~~~~~~~~~~
*
* Sphinx stylesheet -- default theme.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Lucida Grande', Arial, sans-serif;
font-size: 100%;
background-color: white;
color: #000;
margin: 0;
padding: 0;
}
div.document {
background-color: white;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 230px;
}
div.body {
background-color: white;
color: #222222;
padding: 0 20px 30px 20px;
}
div.footer {
color: #555555;
width: 100%;
padding: 9px 0 9px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: #555555;
text-decoration: underline;
}
div.related {
background-color: white;
line-height: 30px;
color: #666666;
}
div.related a {
color: #444444;
}
div.sphinxsidebar {
}
div.sphinxsidebar h3 {
font-family: 'Lucida Grande', Arial, sans-serif;
color: #444444;
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 0;
}
div.sphinxsidebar h3 a {
color: #444444;
}
div.sphinxsidebar h4 {
font-family: 'Lucida Grande', Arial, sans-serif;
color: #444444;
font-size: 1.3em;
font-weight: normal;
margin: 5px 0 0 0;
padding: 0;
}
div.sphinxsidebar p {
color: #444444;
}
div.sphinxsidebar p.topless {
margin: 5px 10px 10px 10px;
}
div.sphinxsidebar ul {
margin: 10px;
padding: 0;
color: #444444;
}
div.sphinxsidebar a {
color: #444444;
}
div.sphinxsidebar input {
border: 1px solid #444444;
font-family: sans-serif;
font-size: 1em;
}
/* -- hyperlink styles ------------------------------------------------------ */
a {
color: #0090c0;
text-decoration: none;
}
a:visited {
color: #00608f;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* -- body styles ----------------------------------------------------------- */
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Lucida Grande', Arial, sans-serif;
background-color: white;
font-weight: normal;
color: #1a1a1a;
border-bottom: 1px solid #ccc;
margin: 20px -20px 10px -20px;
padding: 3px 0 3px 10px;
}
div.body h1 { margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 160%; }
div.body h3 { font-size: 140%; }
div.body h4 { font-size: 120%; }
div.body h5 { font-size: 110%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #aaaaaa;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: #aaaaaa;
color: white;
}
div.body p, div.body dd, div.body li {
text-align: justify;
line-height: 130%;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.admonition p {
margin-bottom: 5px;
}
div.admonition pre {
margin-bottom: 5px;
}
div.admonition ul, div.admonition ol {
margin-bottom: 5px;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 5px;
background-color: #eeffcc;
color: #333333;
line-height: 120%;
border: 1px solid #ac9;
border-left: none;
border-right: none;
}
tt {
background-color: #ecf0f3;
padding: 0 1px 0 1px;
font-size: 0.95em;
}
th {
background-color: #ede;
}
.warning tt {
background: #efc2c2;
}
.note tt {
background: #d6d6d6;
}
.viewcode-back {
font-family: 'Lucida Grande', Arial, sans-serif;
}
div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}

571
doc/build/html/_static/flasky.css vendored Normal file
View file

@ -0,0 +1,571 @@
/*
* flasky.css_t
* ~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: Flask Design License, see LICENSE for details.
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Georgia', serif;
font-size: 17px;
background-color: white;
color: #000;
margin: 0;
padding: 0;
}
div.document {
width: 940px;
margin: 30px auto 0 auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 220px;
}
div.sphinxsidebar {
width: 220px;
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 0 30px;
}
img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
width: 940px;
margin: 20px auto 30px auto;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
div.related {
display: none;
}
div.sphinxsidebar a {
color: #444;
text-decoration: none;
border-bottom: 1px dotted #999;
}
div.sphinxsidebar a:hover {
border-bottom: 1px solid #999;
}
div.sphinxsidebar {
font-size: 14px;
line-height: 1.5;
}
div.sphinxsidebarwrapper {
padding: 18px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0 0 20px 0;
margin: 0;
text-align: center;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: 'Garamond', 'Georgia', serif;
color: #444;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 20px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: 'Georgia', serif;
font-size: 1em;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #004B6B;
text-decoration: underline;
}
a:hover {
color: #6D4100;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #ddd;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
background: #fafafa;
margin: 20px -30px;
padding: 10px 30px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition tt.xref, div.admonition a tt {
border-bottom: 1px solid #fafafa;
}
dd div.admonition {
margin-left: -60px;
padding-left: 60px;
}
div.admonition p.admonition-title {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight {
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
background: #fdfdfd;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td.label {
width: 0px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul, ol {
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #eee;
padding: 7px 30px;
margin: 15px -30px;
line-height: 1.3em;
}
dl pre, blockquote pre, li pre {
margin-left: -60px;
padding-left: 60px;
}
dl dl pre {
margin-left: -90px;
padding-left: 90px;
}
tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background-color: #FBFBFB;
border-bottom: 1px solid white;
}
a.reference {
text-decoration: none;
border-bottom: 1px dotted #004B6B;
}
a.reference:hover {
border-bottom: 1px solid #6D4100;
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dotted #004B6B;
}
a.footnote-reference:hover {
border-bottom: 1px solid #6D4100;
}
a:hover tt {
background: #EEE;
}
@media screen and (max-width: 870px) {
div.sphinxsidebar {
display: none;
}
div.document {
width: 100%;
}
div.documentwrapper {
margin-left: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
}
div.bodywrapper {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
ul {
margin-left: 0;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.bodywrapper {
margin: 0;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
@media screen and (max-width: 875px) {
body {
margin: 0;
padding: 20px 30px;
}
div.documentwrapper {
float: none;
background: white;
}
div.sphinxsidebar {
display: block;
float: none;
width: 102.5%;
margin: 50px -30px -20px -30px;
padding: 10px 20px;
background: #333;
color: white;
}
div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
div.sphinxsidebar h3 a {
color: white;
}
div.sphinxsidebar a {
color: #aaa;
}
div.sphinxsidebar p.logo {
display: none;
}
div.document {
width: 100%;
margin: 0;
}
div.related {
display: block;
margin: 0;
padding: 10px 0 20px 0;
}
div.related ul,
div.related ul li {
margin: 0;
padding: 0;
}
div.footer {
display: none;
}
div.bodywrapper {
margin: 0;
}
div.body {
min-height: 0;
padding: 0;
}
.rtd_doc_footer {
display: none;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
/* scrollbars */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
display: block;
height: 10px;
}
::-webkit-scrollbar-button:vertical:increment {
background-color: #fff;
}
::-webkit-scrollbar-track-piece {
background-color: #eee;
-webkit-border-radius: 3px;
}
::-webkit-scrollbar-thumb:vertical {
height: 50px;
background-color: #ccc;
-webkit-border-radius: 3px;
}
::-webkit-scrollbar-thumb:horizontal {
width: 50px;
background-color: #ccc;
-webkit-border-radius: 3px;
}
/* misc. */
.revsys-inline {
display: none!important;
}

View file

@ -1,170 +0,0 @@
@import url("default.css");
body {
background-color: white;
margin-left: 1em;
margin-right: 1em;
}
div.related {
margin-bottom: 1.2em;
padding: 0.5em 0;
border-top: 1px solid #ccc;
margin-top: 0.5em;
}
div.related a:hover {
color: #0095C4;
}
div.related:first-child {
border-top: 0;
border-bottom: 1px solid #ccc;
}
div.sphinxsidebar {
background-color: #eeeeee;
border-radius: 5px;
line-height: 130%;
font-size: smaller;
}
div.sphinxsidebar h3, div.sphinxsidebar h4 {
margin-top: 1.5em;
}
div.sphinxsidebarwrapper > h3:first-child {
margin-top: 0.2em;
}
div.sphinxsidebarwrapper > ul > li > ul > li {
margin-bottom: 0.4em;
}
div.sphinxsidebar a:hover {
color: #0095C4;
}
div.sphinxsidebar input {
font-family: 'Lucida Grande',Arial,sans-serif;
border: 1px solid #999999;
font-size: smaller;
border-radius: 3px;
}
div.sphinxsidebar input[type=text] {
max-width: 150px;
}
div.body {
padding: 0 0 0 1.2em;
}
div.body p {
line-height: 140%;
}
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
margin: 0;
border: 0;
padding: 0.3em 0;
}
div.body hr {
border: 0;
background-color: #ccc;
height: 1px;
}
div.body pre {
border-radius: 3px;
border: 1px solid #ac9;
}
div.body div.admonition, div.body div.impl-detail {
border-radius: 3px;
}
div.body div.impl-detail > p {
margin: 0;
}
div.body div.seealso {
border: 1px solid #dddd66;
}
div.body a {
color: #00608f;
}
div.body a:visited {
color: #30306f;
}
div.body a:hover {
color: #00B0E4;
}
tt, pre {
font-family: monospace, sans-serif;
font-size: 96.5%;
}
div.body tt {
border-radius: 3px;
}
div.body tt.descname {
font-size: 120%;
}
div.body tt.xref, div.body a tt {
font-weight: normal;
}
p.deprecated {
border-radius: 3px;
}
table.docutils {
border: 1px solid #ddd;
min-width: 20%;
border-radius: 3px;
margin-top: 10px;
margin-bottom: 10px;
}
table.docutils td, table.docutils th {
border: 1px solid #ddd !important;
border-radius: 3px;
}
table p, table li {
text-align: left !important;
}
table.docutils th {
background-color: #eee;
padding: 0.3em 0.5em;
}
table.docutils td {
background-color: white;
padding: 0.3em 0.5em;
}
table.footnote, table.footnote td {
border: 0 !important;
}
div.footer {
line-height: 150%;
margin-top: -2em;
text-align: right;
width: auto;
margin-right: 10px;
}
div.footer a:hover {
color: #0095C4;
}

View file

@ -1,159 +0,0 @@
/*
* sidebar.js
* ~~~~~~~~~~
*
* This script makes the Sphinx sidebar collapsible.
*
* .sphinxsidebar contains .sphinxsidebarwrapper. This script adds
* in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
* used to collapse and expand the sidebar.
*
* When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
* and the width of the sidebar and the margin-left of the document
* are decreased. When the sidebar is expanded the opposite happens.
* This script saves a per-browser/per-session cookie used to
* remember the position of the sidebar among the pages.
* Once the browser is closed the cookie is deleted and the position
* reset to the default (expanded).
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
$(function() {
// global elements used by the functions.
// the 'sidebarbutton' element is defined as global after its
// creation, in the add_sidebar_button function
var bodywrapper = $('.bodywrapper');
var sidebar = $('.sphinxsidebar');
var sidebarwrapper = $('.sphinxsidebarwrapper');
// for some reason, the document has no sidebar; do not run into errors
if (!sidebar.length) return;
// original margin-left of the bodywrapper and width of the sidebar
// with the sidebar expanded
var bw_margin_expanded = bodywrapper.css('margin-left');
var ssb_width_expanded = sidebar.width();
// margin-left of the bodywrapper and width of the sidebar
// with the sidebar collapsed
var bw_margin_collapsed = '.8em';
var ssb_width_collapsed = '.8em';
// colors used by the current theme
var dark_color = $('.related').css('background-color');
var light_color = $('.document').css('background-color');
function sidebar_is_collapsed() {
return sidebarwrapper.is(':not(:visible)');
}
function toggle_sidebar() {
if (sidebar_is_collapsed())
expand_sidebar();
else
collapse_sidebar();
}
function collapse_sidebar() {
sidebarwrapper.hide();
sidebar.css('width', ssb_width_collapsed);
bodywrapper.css('margin-left', bw_margin_collapsed);
sidebarbutton.css({
'margin-left': '0',
'height': bodywrapper.height()
});
sidebarbutton.find('span').text('»');
sidebarbutton.attr('title', _('Expand sidebar'));
document.cookie = 'sidebar=collapsed';
}
function expand_sidebar() {
bodywrapper.css('margin-left', bw_margin_expanded);
sidebar.css('width', ssb_width_expanded);
sidebarwrapper.show();
sidebarbutton.css({
'margin-left': ssb_width_expanded-12,
'height': bodywrapper.height()
});
sidebarbutton.find('span').text('«');
sidebarbutton.attr('title', _('Collapse sidebar'));
document.cookie = 'sidebar=expanded';
}
function add_sidebar_button() {
sidebarwrapper.css({
'float': 'left',
'margin-right': '0',
'width': ssb_width_expanded - 28
});
// create the button
sidebar.append(
'<div id="sidebarbutton"><span>&laquo;</span></div>'
);
var sidebarbutton = $('#sidebarbutton');
light_color = sidebarbutton.css('background-color');
// find the height of the viewport to center the '<<' in the page
var viewport_height;
if (window.innerHeight)
viewport_height = window.innerHeight;
else
viewport_height = $(window).height();
sidebarbutton.find('span').css({
'display': 'block',
'margin-top': (viewport_height - sidebar.position().top - 20) / 2
});
sidebarbutton.click(toggle_sidebar);
sidebarbutton.attr('title', _('Collapse sidebar'));
sidebarbutton.css({
'color': '#FFFFFF',
'border-left': '1px solid ' + dark_color,
'font-size': '1.2em',
'cursor': 'pointer',
'height': bodywrapper.height(),
'padding-top': '1px',
'margin-left': ssb_width_expanded - 12
});
sidebarbutton.hover(
function () {
$(this).css('background-color', dark_color);
},
function () {
$(this).css('background-color', light_color);
}
);
}
function set_position_from_cookie() {
if (!document.cookie)
return;
var items = document.cookie.split(';');
for(var k=0; k<items.length; k++) {
var key_val = items[k].split('=');
var key = key_val[0].replace(/ /, ""); // strip leading spaces
if (key == 'sidebar') {
var value = key_val[1];
if ((value == 'collapsed') && (!sidebar_is_collapsed()))
collapse_sidebar();
else if ((value == 'expanded') && (sidebar_is_collapsed()))
expand_sidebar();
}
}
}
add_sidebar_button();
var sidebarbutton = $('#sidebarbutton');
set_position_from_cookie();
});

View file

@ -8,7 +8,7 @@
<title>accounting package &mdash; Accounting API 0.1-beta documentation</title> <title>accounting package &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,28 +24,27 @@
<script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
<link rel="next" title="accounting.storage package" href="accounting.storage.html" />
<link rel="prev" title="REST API" href="../restapi.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
<li class="right" style="margin-right: 10px"> <li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index" <a href="../genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" > <li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table" <a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li> >routing table</a> |</li>
<li class="right" > <li class="right" >
<a href="accounting.storage.html" title="accounting.storage package" <a href="../py-modindex.html" title="Python Module Index"
accesskey="N">next</a> |</li> >modules</a> |</li>
<li class="right" >
<a href="../restapi.html" title="REST API"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -136,6 +135,48 @@
</div> </div>
<div class="section" id="module-accounting.decorators"> <div class="section" id="module-accounting.decorators">
<span id="accounting-decorators-module"></span><h2>accounting.decorators module<a class="headerlink" href="#module-accounting.decorators" title="Permalink to this headline"></a></h2> <span id="accounting-decorators-module"></span><h2>accounting.decorators module<a class="headerlink" href="#module-accounting.decorators" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="accounting.decorators.allow_all_origins">
<tt class="descclassname">accounting.decorators.</tt><tt class="descname">allow_all_origins</tt><big>(</big><em>origin</em><big>)</big><a class="reference internal" href="../_modules/accounting/decorators.html#allow_all_origins"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.decorators.allow_all_origins" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="accounting.decorators.cors">
<tt class="descclassname">accounting.decorators.</tt><tt class="descname">cors</tt><big>(</big><em>origin_callback=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/decorators.html#cors"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.decorators.cors" title="Permalink to this definition"></a></dt>
<dd><p>Flask endpoint decorator.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/cors-endpoint&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;OPTIONS&#39;</span><span class="p">])</span>
<span class="nd">@cors</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">cors_endpoint</span><span class="p">():</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s">&#39;This is accessible via a cross-origin XHR&#39;</span><span class="p">)</span>
<span class="c"># Or if you want to control the domains this resource can be requested</span>
<span class="c"># from via CORS:</span>
<span class="n">domains</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;http://wandborg.se&#39;</span><span class="p">,</span> <span class="s">&#39;http://sfconservancy.org&#39;</span><span class="p">]</span>
<span class="k">def</span> <span class="nf">restrict_domains</span><span class="p">(</span><span class="n">origin</span><span class="p">):</span>
<span class="k">return</span> <span class="s">&#39; &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">domains</span><span class="p">)</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/restricted-cors-endpoint&#39;</span><span class="p">)</span>
<span class="nd">@cors</span><span class="p">(</span><span class="n">restrict_domains</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">restricted_cors_endpoint</span><span class="p">():</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span>
<span class="n">message</span><span class="o">=</span><span class="s">&#39;This is accessible from </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">domains</span><span class="p">))</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>origin_callback</strong> (<em>function</em>) &#8211; A callback that takes one str() argument
containing the <tt class="docutils literal"><span class="pre">Origin</span></tt> HTTP header from the <tt class="xref py py-data docutils literal"><span class="pre">request</span></tt> object.
This can be used to filter out which domains the resource can be
requested via CORS from.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function"> <dl class="function">
<dt id="accounting.decorators.jsonify_exceptions"> <dt id="accounting.decorators.jsonify_exceptions">
<tt class="descclassname">accounting.decorators.</tt><tt class="descname">jsonify_exceptions</tt><big>(</big><em>func</em><big>)</big><a class="reference internal" href="../_modules/accounting/decorators.html#jsonify_exceptions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.decorators.jsonify_exceptions" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.decorators.</tt><tt class="descname">jsonify_exceptions</tt><big>(</big><em>func</em><big>)</big><a class="reference internal" href="../_modules/accounting/decorators.html#jsonify_exceptions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.decorators.jsonify_exceptions" title="Permalink to this definition"></a></dt>
@ -168,7 +209,7 @@ jsonify_exceptions decorator</p>
<dl class="method"> <dl class="method">
<dt id="accounting.gtkclient.AccountingApplication.on_about_dialog_response"> <dt id="accounting.gtkclient.AccountingApplication.on_about_dialog_response">
<tt class="descname">on_about_dialog_response</tt><big>(</big><em>widget</em>, <em>response_type</em><big>)</big><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_about_dialog_response" title="Permalink to this definition"></a></dt> <tt class="descname">on_about_dialog_response</tt><big>(</big><em>widget</em>, <em>response_type</em><big>)</big><a class="reference internal" href="../_modules/accounting/gtkclient.html#AccountingApplication.on_about_dialog_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_about_dialog_response" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
@ -176,14 +217,19 @@ jsonify_exceptions decorator</p>
<tt class="descname">on_show_about_activate</tt><big>(</big><em>widget</em><big>)</big><a class="reference internal" href="../_modules/accounting/gtkclient.html#AccountingApplication.on_show_about_activate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_show_about_activate" title="Permalink to this definition"></a></dt> <tt class="descname">on_show_about_activate</tt><big>(</big><em>widget</em><big>)</big><a class="reference internal" href="../_modules/accounting/gtkclient.html#AccountingApplication.on_show_about_activate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_show_about_activate" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method">
<dt id="accounting.gtkclient.AccountingApplication.on_transaction_new_activate">
<tt class="descname">on_transaction_new_activate</tt><big>(</big><em>widget</em><big>)</big><a class="reference internal" href="../_modules/accounting/gtkclient.html#AccountingApplication.on_transaction_new_activate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_transaction_new_activate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate"> <dt id="accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate">
<tt class="descname">on_transaction_refresh_activate</tt><big>(</big><em>widget</em><big>)</big><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate" title="Permalink to this definition"></a></dt> <tt class="descname">on_transaction_refresh_activate</tt><big>(</big><em>widget</em><big>)</big><a class="reference internal" href="../_modules/accounting/gtkclient.html#AccountingApplication.on_transaction_refresh_activate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed"> <dt id="accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed">
<tt class="descname">on_transaction_view_cursor_changed</tt><big>(</big><em>widget</em><big>)</big><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed" title="Permalink to this definition"></a></dt> <tt class="descname">on_transaction_view_cursor_changed</tt><big>(</big><em>widget</em><big>)</big><a class="reference internal" href="../_modules/accounting/gtkclient.html#AccountingApplication.on_transaction_view_cursor_changed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
@ -270,6 +316,11 @@ jsonify_exceptions decorator</p>
<span id="accounting-web-module"></span><h2>accounting.web module<a class="headerlink" href="#module-accounting.web" title="Permalink to this headline"></a></h2> <span id="accounting-web-module"></span><h2>accounting.web module<a class="headerlink" href="#module-accounting.web" title="Permalink to this headline"></a></h2>
<p>This module contains the high-level webservice logic such as the Flask setup <p>This module contains the high-level webservice logic such as the Flask setup
and the Flask endpoints.</p> and the Flask endpoints.</p>
<dl class="function">
<dt id="accounting.web.client">
<tt class="descclassname">accounting.web.</tt><tt class="descname">client</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#client"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.client" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function"> <dl class="function">
<dt id="accounting.web.index"> <dt id="accounting.web.index">
<tt class="descclassname">accounting.web.</tt><tt class="descname">index</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.index" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.web.</tt><tt class="descname">index</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.index" title="Permalink to this definition"></a></dt>
@ -288,17 +339,27 @@ and the Flask endpoints.</p>
<tt class="descclassname">accounting.web.</tt><tt class="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.main" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.web.</tt><tt class="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.main" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="function">
<dt id="accounting.web.transaction_by_id_options">
<tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_by_id_options</tt><big>(</big><em>transaction_id=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_by_id_options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_by_id_options" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function"> <dl class="function">
<dt id="accounting.web.transaction_delete"> <dt id="accounting.web.transaction_delete">
<tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_delete</tt><big>(</big><em>transaction_id=None</em><big>)</big><a class="headerlink" href="#accounting.web.transaction_delete" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_delete</tt><big>(</big><em>transaction_id=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_delete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_delete" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="function"> <dl class="function">
<dt id="accounting.web.transaction_get"> <dt id="accounting.web.transaction_get">
<tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_get</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_get" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_get</tt><big>(</big><em>transaction_id=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_get" title="Permalink to this definition"></a></dt>
<dd><p>Returns the JSON-serialized output of <tt class="xref py py-meth docutils literal"><span class="pre">accounting.Ledger.reg()</span></tt></p> <dd><p>Returns the JSON-serialized output of <tt class="xref py py-meth docutils literal"><span class="pre">accounting.Ledger.reg()</span></tt></p>
</dd></dl> </dd></dl>
<dl class="function">
<dt id="accounting.web.transaction_options">
<tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_options</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_options" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function"> <dl class="function">
<dt id="accounting.web.transaction_post"> <dt id="accounting.web.transaction_post">
<tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_post</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_post"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_post" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_post</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_post"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_post" title="Permalink to this definition"></a></dt>
@ -345,7 +406,7 @@ the ledger file.</p>
<dl class="function"> <dl class="function">
<dt id="accounting.web.transaction_update"> <dt id="accounting.web.transaction_update">
<tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_update</tt><big>(</big><em>transaction_id=None</em><big>)</big><a class="headerlink" href="#accounting.web.transaction_update" title="Permalink to this definition"></a></dt> <tt class="descclassname">accounting.web.</tt><tt class="descname">transaction_update</tt><big>(</big><em>transaction_id=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/web.html#transaction_update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.web.transaction_update" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
</div> </div>
@ -360,6 +421,9 @@ the ledger file.</p>
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3><a href="../index.html">Table Of Contents</a></h3> <h3><a href="../index.html">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">accounting package</a><ul> <li><a class="reference internal" href="#">accounting package</a><ul>
@ -379,13 +443,11 @@ the ledger file.</p>
</ul> </ul>
</li> </li>
</ul> </ul>
<h3>Related Topics</h3>
<h4>Previous topic</h4> <ul>
<p class="topless"><a href="../restapi.html" <li><a href="../index.html">Documentation overview</a><ul>
title="previous chapter">REST API</a></p> </ul></li>
<h4>Next topic</h4> </ul>
<p class="topless"><a href="accounting.storage.html"
title="next chapter">accounting.storage package</a></p>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="../_sources/api/accounting.txt" <li><a href="../_sources/api/accounting.txt"
@ -408,30 +470,10 @@ the ledger file.</p>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="accounting.storage.html" title="accounting.storage package"
>next</a> |</li>
<li class="right" >
<a href="../restapi.html" title="REST API"
>previous</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.storage package &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.storage package &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,31 +24,28 @@
<script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
<link rel="up" title="accounting package" href="accounting.html" />
<link rel="next" title="accounting.storage.sql package" href="accounting.storage.sql.html" />
<link rel="prev" title="accounting package" href="accounting.html" /> <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
<li class="right" style="margin-right: 10px"> <li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index" <a href="../genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" > <li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table" <a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li> >routing table</a> |</li>
<li class="right" > <li class="right" >
<a href="accounting.storage.sql.html" title="accounting.storage.sql package" <a href="../py-modindex.html" title="Python Module Index"
accesskey="N">next</a> |</li> >modules</a> |</li>
<li class="right" >
<a href="accounting.html" title="accounting package"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="accounting.html" accesskey="U">accounting package</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -104,7 +101,7 @@ based on <tt class="xref py py-attr docutils literal"><span class="pre">self.led
<dl class="method"> <dl class="method">
<dt id="accounting.storage.ledgercli.Ledger.delete_transaction"> <dt id="accounting.storage.ledgercli.Ledger.delete_transaction">
<tt class="descname">delete_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.delete_transaction" title="Permalink to this definition"></a></dt> <tt class="descname">delete_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.delete_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.delete_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Delete a transaction from the ledger file.</p> <dd><p>Delete a transaction from the ledger file.</p>
<p>This method opens the ledger file, loads all lines into memory and <p>This method opens the ledger file, loads all lines into memory and
looks for the transaction_id, then looks for the bounds of that looks for the transaction_id, then looks for the bounds of that
@ -129,7 +126,7 @@ ledger file.</p>
<dl class="method"> <dl class="method">
<dt id="accounting.storage.ledgercli.Ledger.get_transaction"> <dt id="accounting.storage.ledgercli.Ledger.get_transaction">
<tt class="descname">get_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.get_transaction" title="Permalink to this definition"></a></dt> <tt class="descname">get_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.get_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.get_transaction" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
@ -207,12 +204,12 @@ the old transaction using <tt class="xref py py-data docutils literal"><span cla
<p>ABC for accounting storage</p> <p>ABC for accounting storage</p>
<dl class="method"> <dl class="method">
<dt id="accounting.storage.Storage.add_transaction"> <dt id="accounting.storage.Storage.add_transaction">
<tt class="descname">add_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="headerlink" href="#accounting.storage.Storage.add_transaction" title="Permalink to this definition"></a></dt> <tt class="descname">add_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.add_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.add_transaction" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="accounting.storage.Storage.delete_transaction"> <dt id="accounting.storage.Storage.delete_transaction">
<tt class="descname">delete_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="headerlink" href="#accounting.storage.Storage.delete_transaction" title="Permalink to this definition"></a></dt> <tt class="descname">delete_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.delete_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.delete_transaction" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
@ -237,19 +234,19 @@ the old transaction using <tt class="xref py py-data docutils literal"><span cla
<dl class="method"> <dl class="method">
<dt id="accounting.storage.Storage.reverse_transaction"> <dt id="accounting.storage.Storage.reverse_transaction">
<tt class="descname">reverse_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="headerlink" href="#accounting.storage.Storage.reverse_transaction" title="Permalink to this definition"></a></dt> <tt class="descname">reverse_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.reverse_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.reverse_transaction" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="accounting.storage.Storage.update_transaction"> <dt id="accounting.storage.Storage.update_transaction">
<tt class="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="headerlink" href="#accounting.storage.Storage.update_transaction" title="Permalink to this definition"></a></dt> <tt class="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.update_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.update_transaction" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
</dd></dl> </dd></dl>
<dl class="exception"> <dl class="exception">
<dt id="accounting.storage.TransactionNotFound"> <dt id="accounting.storage.TransactionNotFound">
<em class="property">exception </em><tt class="descclassname">accounting.storage.</tt><tt class="descname">TransactionNotFound</tt><a class="headerlink" href="#accounting.storage.TransactionNotFound" title="Permalink to this definition"></a></dt> <em class="property">exception </em><tt class="descclassname">accounting.storage.</tt><tt class="descname">TransactionNotFound</tt><a class="reference internal" href="../_modules/accounting/storage.html#TransactionNotFound"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.TransactionNotFound" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="accounting.html#accounting.exceptions.AccountingException" title="accounting.exceptions.AccountingException"><tt class="xref py py-class docutils literal"><span class="pre">accounting.exceptions.AccountingException</span></tt></a></p> <dd><p>Bases: <a class="reference internal" href="accounting.html#accounting.exceptions.AccountingException" title="accounting.exceptions.AccountingException"><tt class="xref py py-class docutils literal"><span class="pre">accounting.exceptions.AccountingException</span></tt></a></p>
</dd></dl> </dd></dl>
@ -262,6 +259,9 @@ the old transaction using <tt class="xref py py-data docutils literal"><span cla
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3><a href="../index.html">Table Of Contents</a></h3> <h3><a href="../index.html">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">accounting.storage package</a><ul> <li><a class="reference internal" href="#">accounting.storage package</a><ul>
@ -274,13 +274,11 @@ the old transaction using <tt class="xref py py-data docutils literal"><span cla
</ul> </ul>
</li> </li>
</ul> </ul>
<h3>Related Topics</h3>
<h4>Previous topic</h4> <ul>
<p class="topless"><a href="accounting.html" <li><a href="../index.html">Documentation overview</a><ul>
title="previous chapter">accounting package</a></p> </ul></li>
<h4>Next topic</h4> </ul>
<p class="topless"><a href="accounting.storage.sql.html"
title="next chapter">accounting.storage.sql package</a></p>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="../_sources/api/accounting.storage.txt" <li><a href="../_sources/api/accounting.storage.txt"
@ -303,31 +301,10 @@ the old transaction using <tt class="xref py py-data docutils literal"><span cla
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="accounting.storage.sql.html" title="accounting.storage.sql package"
>next</a> |</li>
<li class="right" >
<a href="accounting.html" title="accounting package"
>previous</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="accounting.html" >accounting package</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>accounting.storage.sql package &mdash; Accounting API 0.1-beta documentation</title> <title>accounting.storage.sql package &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,28 +24,28 @@
<script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
<link rel="up" title="accounting.storage package" href="accounting.storage.html" />
<link rel="prev" title="accounting.storage package" href="accounting.storage.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
<li class="right" style="margin-right: 10px"> <li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index" <a href="../genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" > <li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table" <a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li> >routing table</a> |</li>
<li class="right" > <li class="right" >
<a href="accounting.storage.html" title="accounting.storage package" <a href="../py-modindex.html" title="Python Module Index"
accesskey="P">previous</a> |</li> >modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="accounting.html" >accounting package</a> &raquo;</li>
<li><a href="accounting.storage.html" accesskey="U">accounting.storage package</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -202,6 +202,9 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3><a href="../index.html">Table Of Contents</a></h3> <h3><a href="../index.html">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">accounting.storage.sql package</a><ul> <li><a class="reference internal" href="#">accounting.storage.sql package</a><ul>
@ -211,10 +214,11 @@
</ul> </ul>
</li> </li>
</ul> </ul>
<h3>Related Topics</h3>
<h4>Previous topic</h4> <ul>
<p class="topless"><a href="accounting.storage.html" <li><a href="../index.html">Documentation overview</a><ul>
title="previous chapter">accounting.storage package</a></p> </ul></li>
</ul>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="../_sources/api/accounting.storage.sql.txt" <li><a href="../_sources/api/accounting.storage.sql.txt"
@ -237,29 +241,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="accounting.storage.html" title="accounting.storage package"
>previous</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
<li><a href="accounting.html" >accounting package</a> &raquo;</li>
<li><a href="accounting.storage.html" >accounting.storage package</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,96 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>asyncio-test Module &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1-beta',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="asyncio-test-module">
<h1>asyncio-test Module<a class="headerlink" href="#asyncio-test-module" title="Permalink to this headline"></a></h1>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/api/asyncio-test.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.
</div>
</body>
</html>

View file

@ -8,7 +8,7 @@
<title>accounting &mdash; Accounting API 0.1-beta documentation</title> <title>accounting &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,20 +24,27 @@
<script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
<li class="right" style="margin-right: 10px"> <li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index" <a href="../genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" > <li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table" <a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li> >routing table</a> |</li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li> <li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul> </ul>
</div> </div>
@ -84,6 +91,13 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
</ul></li>
</ul>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="../_sources/api/modules.txt" <li><a href="../_sources/api/modules.txt"
@ -106,24 +120,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -9,7 +9,7 @@
<title>Index &mdash; Accounting API 0.1-beta documentation</title> <title>Index &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -25,8 +25,15 @@
<script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -165,6 +172,10 @@
</dl></dd> </dl></dd>
<dt><a href="api/accounting.html#accounting.decorators.allow_all_origins">allow_all_origins() (in module accounting.decorators)</a>
</dt>
<dt><a href="api/accounting.storage.sql.html#accounting.storage.sql.models.Amount.amount">amount (accounting.storage.sql.models.Amount attribute)</a> <dt><a href="api/accounting.storage.sql.html#accounting.storage.sql.models.Amount.amount">amount (accounting.storage.sql.models.Amount attribute)</a>
</dt> </dt>
@ -226,6 +237,16 @@
<dt><a href="api/accounting.html#accounting.client.Client">Client (class in accounting.client)</a> <dt><a href="api/accounting.html#accounting.client.Client">Client (class in accounting.client)</a>
</dt> </dt>
<dt><a href="api/accounting.html#accounting.web.client">client() (in module accounting.web)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="api/accounting.html#accounting.decorators.cors">cors() (in module accounting.decorators)</a>
</dt>
</dl></td> </dl></td>
</tr></table> </tr></table>
@ -439,12 +460,16 @@
</dt> </dt>
<dt><a href="api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate">on_transaction_refresh_activate() (accounting.gtkclient.AccountingApplication method)</a> <dt><a href="api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_new_activate">on_transaction_new_activate() (accounting.gtkclient.AccountingApplication method)</a>
</dt> </dt>
</dl></td> </dl></td>
<td style="width: 33%" valign="top"><dl> <td style="width: 33%" valign="top"><dl>
<dt><a href="api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_refresh_activate">on_transaction_refresh_activate() (accounting.gtkclient.AccountingApplication method)</a>
</dt>
<dt><a href="api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed">on_transaction_view_cursor_changed() (accounting.gtkclient.AccountingApplication method)</a> <dt><a href="api/accounting.html#accounting.gtkclient.AccountingApplication.on_transaction_view_cursor_changed">on_transaction_view_cursor_changed() (accounting.gtkclient.AccountingApplication method)</a>
</dt> </dt>
@ -555,6 +580,10 @@
</dl></dd> </dl></dd>
<dt><a href="api/accounting.html#accounting.web.transaction_by_id_options">transaction_by_id_options() (in module accounting.web)</a>
</dt>
<dt><a href="api/accounting.html#accounting.web.transaction_delete">transaction_delete() (in module accounting.web)</a> <dt><a href="api/accounting.html#accounting.web.transaction_delete">transaction_delete() (in module accounting.web)</a>
</dt> </dt>
@ -565,6 +594,10 @@
</dl></td> </dl></td>
<td style="width: 33%" valign="top"><dl> <td style="width: 33%" valign="top"><dl>
<dt><a href="api/accounting.html#accounting.web.transaction_options">transaction_options() (in module accounting.web)</a>
</dt>
<dt><a href="api/accounting.html#accounting.web.transaction_post">transaction_post() (in module accounting.web)</a> <dt><a href="api/accounting.html#accounting.web.transaction_post">transaction_post() (in module accounting.web)</a>
</dt> </dt>
@ -616,8 +649,15 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
@ -636,24 +676,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="#" title="General Index"
>index</a></li>
<li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>HTTP Routing Table &mdash; Accounting API 0.1-beta documentation</title> <title>HTTP Routing Table &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -26,6 +26,10 @@
<link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
<script type="text/javascript"> <script type="text/javascript">
DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true; DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
</script> </script>
@ -33,6 +37,9 @@
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -68,12 +75,12 @@
<tr> <tr>
<td></td> <td></td>
<td> <td>
<a href="restapi.html#get--transaction"><tt class="xref">GET /transaction</tt></a></td><td> <a href="restapi.html#post--transaction"><tt class="xref">POST /transaction</tt></a></td><td>
<em></em></td></tr> <em></em></td></tr>
<tr> <tr>
<td></td> <td></td>
<td> <td>
<a href="restapi.html#post--transaction"><tt class="xref">POST /transaction</tt></a></td><td> <a href="restapi.html#get--transaction"><tt class="xref">GET /transaction</tt></a></td><td>
<em></em></td></tr> <em></em></td></tr>
<tr> <tr>
<td></td> <td></td>
@ -88,6 +95,13 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@ -105,24 +119,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="#" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>Welcome to Accounting APIs documentation! &mdash; Accounting API 0.1-beta documentation</title> <title>Welcome to Accounting APIs documentation! &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -25,8 +25,17 @@
<script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="#" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="#" />
<link rel="next" title="The Accounting API" href="README.html" /> <link rel="next" title="The Accounting API" href="README.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class=indexwrapper>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -53,6 +62,8 @@
<div class="section" id="welcome-to-accounting-api-s-documentation"> <div class="section" id="welcome-to-accounting-api-s-documentation">
<h1>Welcome to Accounting API&#8217;s documentation!<a class="headerlink" href="#welcome-to-accounting-api-s-documentation" title="Permalink to this headline"></a></h1> <h1>Welcome to Accounting API&#8217;s documentation!<a class="headerlink" href="#welcome-to-accounting-api-s-documentation" title="Permalink to this headline"></a></h1>
<div class="section" id="accounting-api">
<h2>Accounting API<a class="headerlink" href="#accounting-api" title="Permalink to this headline"></a></h2>
<p>Contents:</p> <p>Contents:</p>
<div class="toctree-wrapper compound"> <div class="toctree-wrapper compound">
<ul> <ul>
@ -68,23 +79,10 @@
<li class="toctree-l2"><a class="reference internal" href="restapi.html#delete-a-transaction">Delete a transaction</a></li> <li class="toctree-l2"><a class="reference internal" href="restapi.html#delete-a-transaction">Delete a transaction</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="api/accounting.html">accounting package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#subpackages">Subpackages</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.client">accounting.client module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.config">accounting.config module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.decorators">accounting.decorators module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.exceptions">accounting.exceptions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.gtkclient">accounting.gtkclient module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.models">accounting.models module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.transport">accounting.transport module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting.web">accounting.web module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/accounting.html#module-accounting">Module contents</a></li>
</ul>
</li>
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="section" id="indices-and-tables"> <div class="section" id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline"></a></h1> <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline"></a></h1>
<ul class="simple"> <ul class="simple">
@ -100,17 +98,25 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="#">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3><a href="#">Table Of Contents</a></h3> <h3><a href="#">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">Welcome to Accounting API&#8217;s documentation!</a><ul> <li><a class="reference internal" href="#">Welcome to Accounting API&#8217;s documentation!</a><ul>
<li><a class="reference internal" href="#accounting-api">Accounting API</a><ul>
</ul>
</li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li> <li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul> </ul>
<h3>Related Topics</h3>
<h4>Next topic</h4> <ul>
<p class="topless"><a href="README.html" <li><a href="#">Documentation overview</a><ul>
title="next chapter">The Accounting API</a></p> <li>Next: <a href="README.html" title="next chapter">The Accounting API</a></li>
</ul></li>
</ul>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="_sources/index.txt" <li><a href="_sources/index.txt"
@ -133,27 +139,12 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="README.html" title="The Accounting API"
>next</a> |</li>
<li><a href="#">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</div>
</body> </body>
</html> </html>

Binary file not shown.

View file

@ -8,7 +8,7 @@
<title>Python Module Index &mdash; Accounting API 0.1-beta documentation</title> <title>Python Module Index &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -27,8 +27,15 @@
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -135,6 +142,13 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@ -152,24 +166,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>REST API &mdash; Accounting API 0.1-beta documentation</title> <title>REST API &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -24,10 +24,16 @@
<script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" /> <link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" />
<link rel="next" title="accounting package" href="api/accounting.html" />
<link rel="prev" title="The Accounting API" href="README.html" /> <link rel="prev" title="The Accounting API" href="README.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -40,9 +46,6 @@
<li class="right" > <li class="right" >
<a href="py-modindex.html" title="Python Module Index" <a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li> >modules</a> |</li>
<li class="right" >
<a href="api/accounting.html" title="accounting package"
accesskey="N">next</a> |</li>
<li class="right" > <li class="right" >
<a href="README.html" title="The Accounting API" <a href="README.html" title="The Accounting API"
accesskey="P">previous</a> |</li> accesskey="P">previous</a> |</li>
@ -251,6 +254,9 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3> <h3><a href="index.html">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">REST API</a><ul> <li><a class="reference internal" href="#">REST API</a><ul>
@ -260,13 +266,12 @@
</ul> </ul>
</li> </li>
</ul> </ul>
<h3>Related Topics</h3>
<h4>Previous topic</h4> <ul>
<p class="topless"><a href="README.html" <li><a href="index.html">Documentation overview</a><ul>
title="previous chapter">The Accounting API</a></p> <li>Previous: <a href="README.html" title="previous chapter">The Accounting API</a></li>
<h4>Next topic</h4> </ul></li>
<p class="topless"><a href="api/accounting.html" </ul>
title="next chapter">accounting package</a></p>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="_sources/restapi.txt" <li><a href="_sources/restapi.txt"
@ -289,30 +294,10 @@
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="api/accounting.html" title="accounting package"
>next</a> |</li>
<li class="right" >
<a href="README.html" title="The Accounting API"
>previous</a> |</li>
<li><a href="index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<title>Search &mdash; Accounting API 0.1-beta documentation</title> <title>Search &mdash; Accounting API 0.1-beta documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" /> <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
@ -32,8 +32,15 @@
<script type="text/javascript" id="searchindexloader"></script> <script type="text/javascript" id="searchindexloader"></script>
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head> </head>
<body> <body>
<div class="related"> <div class="related">
<h3>Navigation</h3> <h3>Navigation</h3>
<ul> <ul>
@ -84,28 +91,21 @@
</div> </div>
<div class="sphinxsidebar"> <div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/accounting-api-logo.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="http-routingtable.html" title="HTTP Routing Table"
>routing table</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Accounting API 0.1-beta documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer"> <div class="footer">
&copy; Copyright 2013, Joar Wandborg. &copy; Copyright 2013, Joar Wandborg.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div> </div>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg height="167.00000pt" id="svg951" inkscape:version="0.39cvs" sodipodi:docbase="/root/img" sodipodi:docname="openbook.svg" sodipodi:version="0.32" width="300.00000pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
<metadata>
<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work rdf:about="">
<dc:title>Open Book</dc:title>
<dc:description/>
<dc:subject>
<rdf:Bag>
<rdf:li>hash</rdf:li>
<rdf:li/>
<rdf:li>education</rdf:li>
<rdf:li>book</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:rights>
<dc:date/>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<defs id="defs953"/>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:cx="151.77472" inkscape:cy="78.534102" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="712" inkscape:window-width="942" inkscape:window-x="259" inkscape:window-y="151" inkscape:zoom="2.4559706" pagecolor="#ffffff"/>
<g id="g2198" transform="translate(-256.9943,-227.9440)">
<path d="M 264.66115,311.01114 C 289.60037,352.91582 311.99478,387.69500 336.93400,429.59969 C 388.16969,404.99978 409.88547,396.68669 454.50463,381.24813 C 474.01491,386.84673 494.54311,376.66746 502.85619,369.03299 C 539.67123,363.94335 582.59383,357.83579 623.98955,353.76408 C 622.97162,347.14755 625.00748,344.60274 623.98955,337.98621 C 581.06694,306.60011 537.63538,273.68712 494.71277,242.30102 C 416.33235,264.52577 343.04157,288.78638 264.66115,311.01114 z " id="path14684" sodipodi:nodetypes="cccccccc" style="fill:#001873;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#fefefe;stroke-width:5.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 274.33146,312.53802 C 296.72587,348.16548 319.12027,383.79295 341.51468,419.42041 C 381.21385,398.55290 428.33666,367.46993 465.20346,375.77302 C 463.41399,363.50114 469.18224,356.62763 476.39007,348.67445 C 416.50200,338.32552 386.64280,372.76540 344.05950,389.39155 C 343.21123,398.04393 342.36295,406.69632 341.51468,415.34870 C 342.70226,407.03563 342.87191,398.72255 344.05949,390.40948 C 324.71887,360.38062 301.81551,322.71729 282.47489,292.68843 C 276.19766,295.74221 275.51905,305.41253 274.33146,312.53802 z " id="path14685" sodipodi:nodetypes="ccccccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:3.7500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 470.79147,360.38062 C 487.24796,328.99452 500.59410,326.77716 532.88505,322.20833 C 558.18346,318.62887 575.92056,319.47328 601.70806,318.28569 C 599.50255,325.75050 603.29171,335.61104 606.68480,345.62066 C 582.42419,346.63859 563.25322,345.11170 536.44780,348.67444 C 518.63406,347.14755 502.85618,358.34476 491.15002,370.05092 C 492.16795,348.33514 479.95281,361.73786 470.79147,360.38062 z " id="path14686" sodipodi:nodetypes="csccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:3.7500000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 396.48276,273.85678 C 421.93095,298.45669 447.37914,323.05661 472.82733,347.65652 C 411.15789,340.02206 378.24489,377.43089 343.55053,389.64603 C 323.53129,357.92062 302.23964,324.15936 282.22040,292.43395 C 307.32928,280.38848 323.90617,260.54300 360.34634,257.56994 C 374.47078,256.41756 385.45522,265.88301 396.48276,273.85678 z " id="path14687" sodipodi:nodetypes="ccccsc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
<path d="M 476.49663,348.91674 C 495.45093,316.88638 534.55916,321.56497 601.37906,316.52649 C 566.10967,292.53371 530.84028,268.54092 495.57089,244.54814 C 449.38479,253.54544 418.31414,234.47117 393.36165,270.10046 L 476.49663,348.91674 z " id="path950" sodipodi:nodetypes="ccccc" style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#001873;stroke-width:2.5000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View file

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="300pt"
height="167pt"
id="svg951">
<metadata
id="metadata3035">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title></dc:title>
<dc:description />
<dc:subject>
<rdf:Bag>
<rdf:li>hash</rdf:li>
<rdf:li />
<rdf:li>education</rdf:li>
<rdf:li>book</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent
rdf:about="http://www.openclipart.org">
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Nathan Eady</dc:title>
</cc:Agent>
</dc:rights>
<dc:date />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://web.resource.org/cc/PublicDomain" />
<dc:language>en</dc:language>
</cc:Work>
<cc:License
rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs953" />
<g
transform="translate(-256.9943,-227.944)"
id="g2198">
<path
d="m 264.66115,311.01114 c 24.93922,41.90468 47.33363,76.68386 72.27285,118.58855 51.23569,-24.59991 72.95147,-32.913 117.57063,-48.35156 19.51028,5.5986 40.03848,-4.58067 48.35156,-12.21514 36.81504,-5.08964 79.73764,-11.1972 121.13336,-15.26891 -1.01793,-6.61653 1.01793,-9.16134 0,-15.77787 -42.92261,-31.3861 -86.35417,-64.29909 -129.27678,-95.68519 -78.38042,22.22475 -151.6712,46.48536 -230.05162,68.71012 z"
id="path14684"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#fefefe;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 274.33146,312.53802 c 22.39441,35.62746 44.78881,71.25493 67.18322,106.88239 39.69917,-20.86751 86.82198,-51.95048 123.68878,-43.64739 -1.78947,-12.27188 3.97878,-19.14539 11.18661,-27.09857 -59.88807,-10.34893 -89.74727,24.09095 -132.33057,40.7171 -0.84827,8.65238 -1.69655,17.30477 -2.54482,25.95715 1.18758,-8.31307 1.35723,-16.62615 2.54481,-24.93922 -19.34062,-30.02886 -42.24398,-67.69219 -61.5846,-97.72105 -6.27723,3.05378 -6.95584,12.7241 -8.14343,19.84959 z"
id="path14685"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.75;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 470.79147,360.38062 c 16.45649,-31.3861 29.80263,-33.60346 62.09358,-38.17229 25.29841,-3.57946 43.03551,-2.73505 68.82301,-3.92264 -2.20551,7.46481 1.58365,17.32535 4.97674,27.33497 -24.26061,1.01793 -43.43158,-0.50896 -70.237,3.05378 -17.81374,-1.52689 -33.59162,9.67032 -45.29778,21.37648 1.01793,-21.71578 -11.19721,-8.31306 -20.35855,-9.6703 z"
id="path14686"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.75;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 396.48276,273.85678 c 25.44819,24.59991 50.89638,49.19983 76.34457,73.79974 -61.66944,-7.63446 -94.58244,29.77437 -129.2768,41.98951 -20.01924,-31.72541 -41.31089,-65.48667 -61.33013,-97.21208 25.10888,-12.04547 41.68577,-31.89095 78.12594,-34.86401 14.12444,-1.15238 25.10888,8.31307 36.13642,16.28684 z"
id="path14687"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
<path
d="m 476.49663,348.91674 c 18.9543,-32.03036 58.06253,-27.35177 124.88243,-32.39025 -35.26939,-23.99278 -70.53878,-47.98557 -105.80817,-71.97835 -46.1861,8.9973 -77.25675,-10.07697 -102.20924,25.55232 l 83.13498,78.81628 z"
id="path950"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,40 @@
flask-sphinx-themes license
---------------------------
Copyright (c) 2010 by Armin Ronacher.
Some rights reserved.
Redistribution and use in source and binary forms of the theme, with or
without modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
We kindly ask you to only use these themes in an unmodified manner just
for Flask and Flask-related products, not for unrelated projects. If you
like the visual style and want to use it for your own projects, please
consider making some larger changes to the themes (such as changing
font faces, sizes, colors or margins).
THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,24 @@
{%- extends "basic/layout.html" %}
{%- block extrahead %}
{{ super() }}
{% if theme_touch_icon %}
<link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
{% endblock %}
{%- block relbar2 %}{% endblock %}
{% block header %}
{{ super() }}
{% if pagename == 'index' %}
<div class=indexwrapper>
{% endif %}
{% endblock %}
{%- block footer %}
<div class="footer">
&copy; Copyright {{ copyright }}.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
{% if pagename == 'index' %}
</div>
{% endif %}
{%- endblock %}

View file

@ -0,0 +1,19 @@
<h3>Related Topics</h3>
<ul>
<li><a href="{{ pathto(master_doc) }}">Documentation overview</a><ul>
{%- for parent in parents %}
<li><a href="{{ parent.link|e }}">{{ parent.title }}</a><ul>
{%- endfor %}
{%- if prev %}
<li>Previous: <a href="{{ prev.link|e }}" title="{{ _('previous chapter')
}}">{{ prev.title }}</a></li>
{%- endif %}
{%- if next %}
<li>Next: <a href="{{ next.link|e }}" title="{{ _('next chapter')
}}">{{ next.title }}</a></li>
{%- endif %}
{%- for parent in parents %}
</ul></li>
{%- endfor %}
</ul></li>
</ul>

View file

@ -0,0 +1,577 @@
/*
* flasky.css_t
* ~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: Flask Design License, see LICENSE for details.
*/
{% set page_width = '940px' %}
{% set sidebar_width = '220px' %}
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Georgia', serif;
font-size: 17px;
background-color: white;
color: #000;
margin: 0;
padding: 0;
}
div.document {
width: {{ page_width }};
margin: 30px auto 0 auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ sidebar_width }};
}
div.sphinxsidebar {
width: {{ sidebar_width }};
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 0 30px;
}
img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
width: {{ page_width }};
margin: 20px auto 30px auto;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
div.related {
display: none;
}
div.sphinxsidebar a {
color: #444;
text-decoration: none;
border-bottom: 1px dotted #999;
}
div.sphinxsidebar a:hover {
border-bottom: 1px solid #999;
}
div.sphinxsidebar {
font-size: 14px;
line-height: 1.5;
}
div.sphinxsidebarwrapper {
padding: 18px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0 0 20px 0;
margin: 0;
text-align: center;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: 'Garamond', 'Georgia', serif;
color: #444;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 20px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: 'Georgia', serif;
font-size: 1em;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #004B6B;
text-decoration: underline;
}
a:hover {
color: #6D4100;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
{% if theme_index_logo %}
div.indexwrapper h1 {
text-indent: -999999px;
background: url({{ theme_index_logo }}) no-repeat center center;
height: {{ theme_index_logo_height }};
}
{% endif %}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #ddd;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
background: #fafafa;
margin: 20px -30px;
padding: 10px 30px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition tt.xref, div.admonition a tt {
border-bottom: 1px solid #fafafa;
}
dd div.admonition {
margin-left: -60px;
padding-left: 60px;
}
div.admonition p.admonition-title {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight {
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
background: #fdfdfd;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td.label {
width: 0px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul, ol {
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #eee;
padding: 7px 30px;
margin: 15px -30px;
line-height: 1.3em;
}
dl pre, blockquote pre, li pre {
margin-left: -60px;
padding-left: 60px;
}
dl dl pre {
margin-left: -90px;
padding-left: 90px;
}
tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background-color: #FBFBFB;
border-bottom: 1px solid white;
}
a.reference {
text-decoration: none;
border-bottom: 1px dotted #004B6B;
}
a.reference:hover {
border-bottom: 1px solid #6D4100;
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dotted #004B6B;
}
a.footnote-reference:hover {
border-bottom: 1px solid #6D4100;
}
a:hover tt {
background: #EEE;
}
@media screen and (max-width: 870px) {
div.sphinxsidebar {
display: none;
}
div.document {
width: 100%;
}
div.documentwrapper {
margin-left: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
}
div.bodywrapper {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
ul {
margin-left: 0;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.bodywrapper {
margin: 0;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
@media screen and (max-width: 875px) {
body {
margin: 0;
padding: 20px 30px;
}
div.documentwrapper {
float: none;
background: white;
}
div.sphinxsidebar {
display: block;
float: none;
width: 102.5%;
margin: 50px -30px -20px -30px;
padding: 10px 20px;
background: #333;
color: white;
}
div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
div.sphinxsidebar h3 a {
color: white;
}
div.sphinxsidebar a {
color: #aaa;
}
div.sphinxsidebar p.logo {
display: none;
}
div.document {
width: 100%;
margin: 0;
}
div.related {
display: block;
margin: 0;
padding: 10px 0 20px 0;
}
div.related ul,
div.related ul li {
margin: 0;
padding: 0;
}
div.footer {
display: none;
}
div.bodywrapper {
margin: 0;
}
div.body {
min-height: 0;
padding: 0;
}
.rtd_doc_footer {
display: none;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
/* scrollbars */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
display: block;
height: 10px;
}
::-webkit-scrollbar-button:vertical:increment {
background-color: #fff;
}
::-webkit-scrollbar-track-piece {
background-color: #eee;
-webkit-border-radius: 3px;
}
::-webkit-scrollbar-thumb:vertical {
height: 50px;
background-color: #ccc;
-webkit-border-radius: 3px;
}
::-webkit-scrollbar-thumb:horizontal {
width: 50px;
background-color: #ccc;
-webkit-border-radius: 3px;
}
/* misc. */
.revsys-inline {
display: none!important;
}

View file

@ -0,0 +1,9 @@
[theme]
inherit = basic
stylesheet = flasky.css
pygments_style = flask_theme_support.FlaskyStyle
[options]
index_logo =
index_logo_height = 120px
touch_icon =

View file

@ -0,0 +1,86 @@
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
styles = {
# No corresponding class for the following:
#Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment.Preproc: "noitalic", # class: 'cp'
Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Type: "bold #004461", # class: 'kt'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
String: "#4e9a06", # class: 's'
String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Double: "#4e9a06", # class: 's2'
String.Escape: "#4e9a06", # class: 'se'
String.Heredoc: "#4e9a06", # class: 'sh'
String.Interpol: "#4e9a06", # class: 'si'
String.Other: "#4e9a06", # class: 'sx'
String.Regex: "#4e9a06", # class: 'sr'
String.Single: "#4e9a06", # class: 's1'
String.Symbol: "#4e9a06", # class: 'ss'
Generic: "#000000", # class: 'g'
Generic.Deleted: "#a40000", # class: 'gd'
Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic.Heading: "bold #000080", # class: 'gh'
Generic.Inserted: "#00A000", # class: 'gi'
Generic.Output: "#888", # class: 'go'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
}

View file

@ -1,170 +0,0 @@
@import url("default.css");
body {
background-color: white;
margin-left: 1em;
margin-right: 1em;
}
div.related {
margin-bottom: 1.2em;
padding: 0.5em 0;
border-top: 1px solid #ccc;
margin-top: 0.5em;
}
div.related a:hover {
color: #0095C4;
}
div.related:first-child {
border-top: 0;
border-bottom: 1px solid #ccc;
}
div.sphinxsidebar {
background-color: #eeeeee;
border-radius: 5px;
line-height: 130%;
font-size: smaller;
}
div.sphinxsidebar h3, div.sphinxsidebar h4 {
margin-top: 1.5em;
}
div.sphinxsidebarwrapper > h3:first-child {
margin-top: 0.2em;
}
div.sphinxsidebarwrapper > ul > li > ul > li {
margin-bottom: 0.4em;
}
div.sphinxsidebar a:hover {
color: #0095C4;
}
div.sphinxsidebar input {
font-family: 'Lucida Grande',Arial,sans-serif;
border: 1px solid #999999;
font-size: smaller;
border-radius: 3px;
}
div.sphinxsidebar input[type=text] {
max-width: 150px;
}
div.body {
padding: 0 0 0 1.2em;
}
div.body p {
line-height: 140%;
}
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
margin: 0;
border: 0;
padding: 0.3em 0;
}
div.body hr {
border: 0;
background-color: #ccc;
height: 1px;
}
div.body pre {
border-radius: 3px;
border: 1px solid #ac9;
}
div.body div.admonition, div.body div.impl-detail {
border-radius: 3px;
}
div.body div.impl-detail > p {
margin: 0;
}
div.body div.seealso {
border: 1px solid #dddd66;
}
div.body a {
color: #00608f;
}
div.body a:visited {
color: #30306f;
}
div.body a:hover {
color: #00B0E4;
}
tt, pre {
font-family: monospace, sans-serif;
font-size: 96.5%;
}
div.body tt {
border-radius: 3px;
}
div.body tt.descname {
font-size: 120%;
}
div.body tt.xref, div.body a tt {
font-weight: normal;
}
p.deprecated {
border-radius: 3px;
}
table.docutils {
border: 1px solid #ddd;
min-width: 20%;
border-radius: 3px;
margin-top: 10px;
margin-bottom: 10px;
}
table.docutils td, table.docutils th {
border: 1px solid #ddd !important;
border-radius: 3px;
}
table p, table li {
text-align: left !important;
}
table.docutils th {
background-color: #eee;
padding: 0.3em 0.5em;
}
table.docutils td {
background-color: white;
padding: 0.3em 0.5em;
}
table.footnote, table.footnote td {
border: 0 !important;
}
div.footer {
line-height: 150%;
margin-top: -2em;
text-align: right;
width: auto;
margin-right: 10px;
}
div.footer a:hover {
color: #0095C4;
}

View file

@ -1,23 +0,0 @@
[theme]
inherit = default
stylesheet = pydoctheme.css
pygments_style = sphinx
[options]
bodyfont = 'Lucida Grande', Arial, sans-serif
headfont = 'Lucida Grande', Arial, sans-serif
footerbgcolor = white
footertextcolor = #555555
relbarbgcolor = white
relbartextcolor = #666666
relbarlinkcolor = #444444
sidebarbgcolor = white
sidebartextcolor = #444444
sidebarlinkcolor = #444444
bgcolor = white
textcolor = #222222
linkcolor = #0090c0
visitedlinkcolor = #00608f
headtextcolor = #1a1a1a
headbgcolor = white
headlinkcolor = #aaaaaa

View file

@ -98,7 +98,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'pydoctheme' html_theme = 'flask'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
@ -118,6 +118,7 @@ html_theme_path = ['_themes']
# The name of an image file (relative to this directory) to place at the top # The name of an image file (relative to this directory) to place at the top
# of the sidebar. # of the sidebar.
#html_logo = None #html_logo = None
html_logo = 'accounting-api-logo.png'
# The name of an image file (within the static path) to use as favicon of the # The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32

View file

@ -6,6 +6,10 @@
Welcome to Accounting API's documentation! Welcome to Accounting API's documentation!
========================================== ==========================================
-----------------------
Accounting API
-----------------------
Contents: Contents:
.. toctree:: .. toctree::
@ -13,8 +17,6 @@ Contents:
README README
restapi restapi
api/accounting.rst
Indices and tables Indices and tables