Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

146 rindas
7.2 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Accessing Local Data &mdash; Documentation</title>
  7. <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '',
  12. VERSION: '',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/doctools.js"></script>
  20. <link rel="top" title="Documentation" href="index.html" />
  21. </head>
  22. <body>
  23. <div style="background-color: #FFF; text-align: left; padding: 8px 0px"><img src="_static/banner300910.gif"></div>
  24. <div class="related">
  25. <h3>Navigation</h3>
  26. <ul>
  27. <li class="right" style="margin-right: 10px">
  28. <a href="genindex.html" title="General Index"
  29. accesskey="I">index</a></li>
  30. <li class="right" >
  31. <a href="modindex.html" title="Global Module Index"
  32. accesskey="M">modules</a> |</li>
  33. <li><a href="index.html">Documentation</a> &raquo;</li>
  34. </ul>
  35. </div>
  36. <div class="sphinxsidebar">
  37. <div class="sphinxsidebarwrapper">
  38. <h3>This Page</h3>
  39. <ul class="this-page-menu">
  40. <li><a href="_sources/local_data.txt"
  41. rel="nofollow">Show Source</a></li>
  42. </ul>
  43. <div id="searchbox" style="display: none">
  44. <h3>Quick search</h3>
  45. <form class="search" action="search.html" method="get">
  46. <input type="text" name="q" size="18" />
  47. <input type="submit" value="Go" />
  48. <input type="hidden" name="check_keywords" value="yes" />
  49. <input type="hidden" name="area" value="default" />
  50. </form>
  51. <p class="searchtip" style="font-size: 90%">
  52. Enter search terms or a module, class or function name.
  53. </p>
  54. </div>
  55. <script type="text/javascript">$('#searchbox').show(0);</script>
  56. </div>
  57. </div>
  58. <div class="document">
  59. <div class="documentwrapper">
  60. <div class="bodywrapper">
  61. <div class="body">
  62. <div class="section" id="accessing-local-data">
  63. <h1>Accessing Local Data<a class="headerlink" href="#accessing-local-data" title="Permalink to this headline">¶</a></h1>
  64. <p>Local records are maintained in the <a class="reference external" href="glossary.html#term-locals"><em class="xref">locals</em></a> dictionary. Some useful functions to access local data:</p>
  65. <dl class="function">
  66. <dt id="LocalDB.add">
  67. <tt class="descclassname">LocalDB.</tt><tt class="descname">add</tt><big>(</big><em>dt</em>, <em>dn</em><big>)</big><a class="headerlink" href="#LocalDB.add" title="Permalink to this definition">¶</a></dt>
  68. <dd>Add a new record to <cite>locals</cite></dd></dl>
  69. <dl class="function">
  70. <dt id="LocalDB.delete_doc">
  71. <tt class="descclassname">LocalDB.</tt><tt class="descname">delete_doc</tt><big>(</big><em>dt</em>, <em>dn</em><big>)</big><a class="headerlink" href="#LocalDB.delete_doc" title="Permalink to this definition">¶</a></dt>
  72. <dd>Delete a record and all child records from <cite>locals</cite></dd></dl>
  73. <dl class="function">
  74. <dt id="LocalDB.set_default_values">
  75. <tt class="descclassname">LocalDB.</tt><tt class="descname">set_default_values</tt><big>(</big><em>doc</em><big>)</big><a class="headerlink" href="#LocalDB.set_default_values" title="Permalink to this definition">¶</a></dt>
  76. <dd>Set default values for the given <cite>doc</cite>. Will only work if the metadata (<cite>DocType</cite>) is also loaded</dd></dl>
  77. <dl class="function">
  78. <dt id="LocalDB.create">
  79. <tt class="descclassname">LocalDB.</tt><tt class="descname">create</tt><big>(</big><em>dt</em>, <em>n</em><big>)</big><a class="headerlink" href="#LocalDB.create" title="Permalink to this definition">¶</a></dt>
  80. <dd>Create a new record and set default values. If n is null, n is set as &#8220;Unsaved ..&#8221;</dd></dl>
  81. <dl class="function">
  82. <dt id="LocalDB.delete_record">
  83. <tt class="descclassname">LocalDB.</tt><tt class="descname">delete_record</tt><big>(</big><em>dt</em>, <em>dn</em><big>)</big><a class="headerlink" href="#LocalDB.delete_record" title="Permalink to this definition">¶</a></dt>
  84. <dd>Mark for deletion (called when a row is deleted from the table)</dd></dl>
  85. <dl class="function">
  86. <dt id="LocalDB.get_default_value">
  87. <tt class="descclassname">LocalDB.</tt><tt class="descname">get_default_value</tt><big>(</big><em>fieldname</em>, <em>fieldtype</em>, <em>default</em><big>)</big><a class="headerlink" href="#LocalDB.get_default_value" title="Permalink to this definition">¶</a></dt>
  88. <dd><p>Get default value for the given field details for <cite>default</cite> keyword</p>
  89. <ul class="simple">
  90. <li>If <cite>default</cite> is &#8216;__user&#8217; or &#8216;_Login&#8217; - return username</li>
  91. <li>If <cite>default</cite> is &#8216;Today&#8217; or &#8216;__today&#8217; - return today&#8217;s date</li>
  92. <li>Return <cite>default</cite> if <cite>default</cite> is not null.</li>
  93. <li>If field name matches user or system default, then return the default</li>
  94. </ul>
  95. </dd></dl>
  96. <dl class="function">
  97. <dt id="LocalDB.add_child">
  98. <tt class="descclassname">LocalDB.</tt><tt class="descname">add_child</tt><big>(</big><em>doc</em>, <em>childtype</em>, <em>parentfield</em><big>)</big><a class="headerlink" href="#LocalDB.add_child" title="Permalink to this definition">¶</a></dt>
  99. <dd>Return a child record, with parentfield set (optionally). Called when a row is added to the table</dd></dl>
  100. <dl class="function">
  101. <dt id="LocalDB.copy">
  102. <tt class="descclassname">LocalDB.</tt><tt class="descname">copy</tt><big>(</big><em>dt</em>, <em>dn</em>, <em>from_amend</em><big>)</big><a class="headerlink" href="#LocalDB.copy" title="Permalink to this definition">¶</a></dt>
  103. <dd>Create and return a copy of record specified by <cite>dt</cite> and <cite>dn</cite>. Called by <cite>Copy</cite> and <cite>Amend</cite></dd></dl>
  104. <dl class="function">
  105. <dt id="make_doclist">
  106. <tt class="descname">make_doclist</tt><big>(</big><em>dt</em>, <em>dn</em><big>)</big><a class="headerlink" href="#make_doclist" title="Permalink to this definition">¶</a></dt>
  107. <dd>Return the required record and all child records from <cite>locals</cite>.</dd></dl>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <div class="clearer"></div>
  113. </div>
  114. <div class="related">
  115. <h3>Navigation</h3>
  116. <ul>
  117. <li class="right" style="margin-right: 10px">
  118. <a href="genindex.html" title="General Index"
  119. >index</a></li>
  120. <li class="right" >
  121. <a href="modindex.html" title="Global Module Index"
  122. >modules</a> |</li>
  123. <li><a href="index.html">Documentation</a> &raquo;</li>
  124. </ul>
  125. </div>
  126. <div class="footer">
  127. &copy; Copyright 2010, Rushabh Mehta.
  128. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
  129. </div>
  130. </body>
  131. </html>