273 lines
		
	
	
		
			No EOL
		
	
	
		
			18 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			273 lines
		
	
	
		
			No EOL
		
	
	
		
			18 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!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.storage package — Accounting API 0.1-beta documentation</title>
 | |
|     
 | |
|     <link rel="stylesheet" href="../_static/flasky.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" />
 | |
|    
 | |
|   
 | |
|   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
 | |
| 
 | |
|   </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 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> »</li> 
 | |
|       </ul>
 | |
|     </div>  
 | |
| 
 | |
|     <div class="document">
 | |
|       <div class="documentwrapper">
 | |
|         <div class="bodywrapper">
 | |
|           <div class="body">
 | |
|             
 | |
|   <div class="section" id="accounting-storage-package">
 | |
| <h1>accounting.storage package<a class="headerlink" href="#accounting-storage-package" title="Permalink to this headline">¶</a></h1>
 | |
| <div class="section" id="subpackages">
 | |
| <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
 | |
| <div class="toctree-wrapper compound">
 | |
| <ul>
 | |
| <li class="toctree-l1"><a class="reference internal" href="accounting.storage.sql.html">accounting.storage.sql package</a><ul>
 | |
| <li class="toctree-l2"><a class="reference internal" href="accounting.storage.sql.html#submodules">Submodules</a></li>
 | |
| <li class="toctree-l2"><a class="reference internal" href="accounting.storage.sql.html#module-accounting.storage.sql.models">accounting.storage.sql.models module</a></li>
 | |
| <li class="toctree-l2"><a class="reference internal" href="accounting.storage.sql.html#module-accounting.storage.sql">Module contents</a></li>
 | |
| </ul>
 | |
| </li>
 | |
| </ul>
 | |
| </div>
 | |
| </div>
 | |
| <div class="section" id="submodules">
 | |
| <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
 | |
| </div>
 | |
| <div class="section" id="module-accounting.storage.ledgercli">
 | |
| <span id="accounting-storage-ledgercli-module"></span><h2>accounting.storage.ledgercli module<a class="headerlink" href="#module-accounting.storage.ledgercli" title="Permalink to this headline">¶</a></h2>
 | |
| <dl class="class">
 | |
| <dt id="accounting.storage.ledgercli.Ledger">
 | |
| <em class="property">class </em><tt class="descclassname">accounting.storage.ledgercli.</tt><tt class="descname">Ledger</tt><big>(</big><em>app=None</em>, <em>ledger_file=None</em>, <em>ledger_bin=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Bases: <a class="reference internal" href="#accounting.storage.Storage" title="accounting.storage.Storage"><tt class="xref py py-class docutils literal"><span class="pre">accounting.storage.Storage</span></tt></a></p>
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.add_transaction">
 | |
| <tt class="descname">add_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.add_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.add_transaction" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Writes a transaction to the ledger file by opening it in ‘ab’ mode and
 | |
| writing a ledger transaction based on the
 | |
| <a class="reference internal" href="accounting.html#accounting.models.Transaction" title="accounting.models.Transaction"><tt class="xref py py-class docutils literal"><span class="pre">Transaction</span></tt></a> instance in
 | |
| <tt class="xref py py-data docutils literal"><span class="pre">transaction</span></tt>.</p>
 | |
| </dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.assemble_arguments">
 | |
| <tt class="descname">assemble_arguments</tt><big>(</big><em>command=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.assemble_arguments"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.assemble_arguments" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Returns a list of arguments suitable for <a class="reference external" href="http://docs.python.org/3.3/library/subprocess.html#subprocess.Popen" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">subprocess.Popen</span></tt></a>
 | |
| based on <tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_bin</span></tt> and <tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_file</span></tt>.</p>
 | |
| </dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.bal">
 | |
| <tt class="descname">bal</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.bal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.bal" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.commit_changes">
 | |
| <tt class="descname">commit_changes</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.commit_changes" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Commits any changes to <tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_file</span></tt> to the git repository</p>
 | |
| </dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.delete_transaction">
 | |
| <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>
 | |
| <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
 | |
| transaction in the ledger file, removes all lines within the bounds of
 | |
| the transaction and removes them, then writes the lines back to the
 | |
| ledger file.</p>
 | |
| <p>Exceptions:</p>
 | |
| <ul class="simple">
 | |
| <li>RuntimeError: If all boundaries to the transaction are not found</li>
 | |
| <li>TransactionNotFound: If no such transaction_id can be found in
 | |
| <tt class="xref py py-data docutils literal"><span class="pre">self.ledger_file</span></tt></li>
 | |
| </ul>
 | |
| </dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.get_transaction">
 | |
| <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>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.get_transactions">
 | |
| <tt class="descname">get_transactions</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.get_transactions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.get_transactions" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.reg">
 | |
| <tt class="descname">reg</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.reg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.reg" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.send_command">
 | |
| <tt class="descname">send_command</tt><big>(</big><em>command</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.send_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.send_command" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Creates a new ledger process with the specified <tt class="xref py py-data docutils literal"><span class="pre">command</span></tt> and
 | |
| returns the output.</p>
 | |
| <p>Raises an <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">AccountingException</span></tt></a>-based
 | |
| Exception based on the ledger-cli stderr.</p>
 | |
| </dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.ledgercli.Ledger.update_transaction">
 | |
| <tt class="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.update_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.update_transaction" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Update a transaction in the ledger file.</p>
 | |
| <p>Takes a <a class="reference internal" href="accounting.html#accounting.models.Transaction" title="accounting.models.Transaction"><tt class="xref py py-class docutils literal"><span class="pre">Transaction</span></tt></a> object and removes
 | |
| the old transaction using <tt class="xref py py-data docutils literal"><span class="pre">transaction.id</span></tt> from the passed
 | |
| <a class="reference internal" href="accounting.html#accounting.models.Transaction" title="accounting.models.Transaction"><tt class="xref py py-class docutils literal"><span class="pre">Transaction</span></tt></a> instance and adds
 | |
| <tt class="xref py py-data docutils literal"><span class="pre">transaction</span></tt> to the database.</p>
 | |
| </dd></dl>
 | |
| 
 | |
| </dd></dl>
 | |
| 
 | |
| <dl class="function">
 | |
| <dt id="accounting.storage.ledgercli.main">
 | |
| <tt class="descclassname">accounting.storage.ledgercli.</tt><tt class="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.main" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| </div>
 | |
| <div class="section" id="module-accounting.storage">
 | |
| <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-accounting.storage" title="Permalink to this headline">¶</a></h2>
 | |
| <dl class="class">
 | |
| <dt id="accounting.storage.Storage">
 | |
| <em class="property">class </em><tt class="descclassname">accounting.storage.</tt><tt class="descname">Storage</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage" title="Permalink to this definition">¶</a></dt>
 | |
| <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">builtins.object</span></tt></p>
 | |
| <p>ABC for accounting storage</p>
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.add_transaction">
 | |
| <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>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.delete_transaction">
 | |
| <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>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.get_account">
 | |
| <tt class="descname">get_account</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_account" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.get_accounts">
 | |
| <tt class="descname">get_accounts</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_accounts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_accounts" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.get_transaction">
 | |
| <tt class="descname">get_transaction</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_transaction" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.get_transactions">
 | |
| <tt class="descname">get_transactions</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_transactions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_transactions" title="Permalink to this definition">¶</a></dt>
 | |
| <dd></dd></dl>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.reverse_transaction">
 | |
| <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>
 | |
| 
 | |
| <dl class="method">
 | |
| <dt id="accounting.storage.Storage.update_transaction">
 | |
| <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></dl>
 | |
| 
 | |
| </div>
 | |
| </div>
 | |
| 
 | |
| 
 | |
|           </div>
 | |
|         </div>
 | |
|       </div>
 | |
|       <div class="sphinxsidebar">
 | |
|         <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>
 | |
|   <ul>
 | |
| <li><a class="reference internal" href="#">accounting.storage package</a><ul>
 | |
| <li><a class="reference internal" href="#subpackages">Subpackages</a><ul>
 | |
| </ul>
 | |
| </li>
 | |
| <li><a class="reference internal" href="#submodules">Submodules</a></li>
 | |
| <li><a class="reference internal" href="#module-accounting.storage.ledgercli">accounting.storage.ledgercli module</a></li>
 | |
| <li><a class="reference internal" href="#module-accounting.storage">Module contents</a></li>
 | |
| </ul>
 | |
| </li>
 | |
| </ul>
 | |
| <h3>Related Topics</h3>
 | |
| <ul>
 | |
|   <li><a href="../index.html">Documentation overview</a><ul>
 | |
|   </ul></li>
 | |
| </ul>
 | |
|   <h3>This Page</h3>
 | |
|   <ul class="this-page-menu">
 | |
|     <li><a href="../_sources/api/accounting.storage.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="footer">
 | |
|     © Copyright 2013, Joar Wandborg.
 | |
|     Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
 | |
|   </div>
 | |
|   
 | |
|   </body>
 | |
| </html> | 
