您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

198 行
10 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>code — Code Execution Module &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. <link rel="up" title="Server Side Internals" href="server_side_internals.html" />
  22. <link rel="next" title="db_schema — Database Schema Management Module" href="db_schema.html" />
  23. <link rel="prev" title="doctype — DocType" href="doctype.html" />
  24. </head>
  25. <body>
  26. <div style="background-color: #FFF; text-align: left; padding: 8px 0px"><img src="_static/banner300910.gif"></div>
  27. <div class="related">
  28. <h3>Navigation</h3>
  29. <ul>
  30. <li class="right" style="margin-right: 10px">
  31. <a href="genindex.html" title="General Index"
  32. accesskey="I">index</a></li>
  33. <li class="right" >
  34. <a href="modindex.html" title="Global Module Index"
  35. accesskey="M">modules</a> |</li>
  36. <li class="right" >
  37. <a href="db_schema.html" title="db_schema — Database Schema Management Module"
  38. accesskey="N">next</a> |</li>
  39. <li class="right" >
  40. <a href="doctype.html" title="doctype — DocType"
  41. accesskey="P">previous</a> |</li>
  42. <li><a href="index.html">Documentation</a> &raquo;</li>
  43. <li><a href="server_side_api.html" >3. Server Side API</a> &raquo;</li>
  44. <li><a href="server_side_internals.html" accesskey="U">Server Side Internals</a> &raquo;</li>
  45. </ul>
  46. </div>
  47. <div class="sphinxsidebar">
  48. <div class="sphinxsidebarwrapper">
  49. <h3><a href="index.html">Table Of Contents</a></h3>
  50. <ul>
  51. <li><a class="reference external" href=""><tt class="docutils literal"><span class="pre">code</span></tt> &#8212; Code Execution Module</a><ul>
  52. <li><a class="reference external" href="#global-properties-methods-generally-used-in-server-side-scripts">Global Properties / Methods (generally) used in server side scripts</a></li>
  53. <li><a class="reference external" href="#module-methods">Module Methods</a></li>
  54. </ul>
  55. </li>
  56. </ul>
  57. <h4>Previous topic</h4>
  58. <p class="topless"><a href="doctype.html"
  59. title="previous chapter"><tt class="docutils literal"><span class="pre">doctype</span></tt> &#8212; DocType</a></p>
  60. <h4>Next topic</h4>
  61. <p class="topless"><a href="db_schema.html"
  62. title="next chapter"><tt class="docutils literal"><span class="pre">db_schema</span></tt> &#8212; Database Schema Management Module</a></p>
  63. <h3>This Page</h3>
  64. <ul class="this-page-menu">
  65. <li><a href="_sources/code.txt"
  66. rel="nofollow">Show Source</a></li>
  67. </ul>
  68. <div id="searchbox" style="display: none">
  69. <h3>Quick search</h3>
  70. <form class="search" action="search.html" method="get">
  71. <input type="text" name="q" size="18" />
  72. <input type="submit" value="Go" />
  73. <input type="hidden" name="check_keywords" value="yes" />
  74. <input type="hidden" name="area" value="default" />
  75. </form>
  76. <p class="searchtip" style="font-size: 90%">
  77. Enter search terms or a module, class or function name.
  78. </p>
  79. </div>
  80. <script type="text/javascript">$('#searchbox').show(0);</script>
  81. </div>
  82. </div>
  83. <div class="document">
  84. <div class="documentwrapper">
  85. <div class="bodywrapper">
  86. <div class="body">
  87. <div class="section" id="module-code">
  88. <h1><tt class="xref docutils literal"><span class="pre">code</span></tt> &#8212; Code Execution Module<a class="headerlink" href="#module-code" title="Permalink to this headline">¶</a></h1>
  89. <p>This is where all the plug-in code is executed. The standard method for DocTypes is declaration of a
  90. standardized <cite>DocType</cite> class that has the methods of any DocType. When an object is instantiated using the
  91. <cite>get_obj</cite> method, it creates an instance of the <cite>DocType</cite> class of that particular DocType and sets the
  92. <cite>doc</cite> and <cite>doclist</cite> attributes that represent the fields (properties) of that record.</p>
  93. <p>methods in following modules are imported for backward compatibility</p>
  94. <blockquote>
  95. <ul class="simple">
  96. <li>webnotes.*</li>
  97. <li>webnotes.utils.*</li>
  98. <li>webnotes.model.doc.*</li>
  99. <li>webnotes.model.doclist.*</li>
  100. </ul>
  101. </blockquote>
  102. <div class="section" id="global-properties-methods-generally-used-in-server-side-scripts">
  103. <h2>Global Properties / Methods (generally) used in server side scripts<a class="headerlink" href="#global-properties-methods-generally-used-in-server-side-scripts" title="Permalink to this headline">¶</a></h2>
  104. <dl class="data">
  105. <dt id="code.version">
  106. <tt class="descclassname">code.</tt><tt class="descname">version</tt><a class="headerlink" href="#code.version" title="Permalink to this definition">¶</a></dt>
  107. <dd>&#8220;v170&#8221;</dd></dl>
  108. <dl class="data">
  109. <dt id="code.NEWLINE">
  110. <tt class="descclassname">code.</tt><tt class="descname">NEWLINE</tt><a class="headerlink" href="#code.NEWLINE" title="Permalink to this definition">¶</a></dt>
  111. <dd>&#8220;\n&#8221; - used in plug in scripts</dd></dl>
  112. <dl class="function">
  113. <dt id="code.set">
  114. <tt class="descclassname">code.</tt><tt class="descname">set</tt><big>(</big><big>)</big><a class="headerlink" href="#code.set" title="Permalink to this definition">¶</a></dt>
  115. <dd>Same as <cite>webnotes.conn.set</cite>
  116. Sets a value</dd></dl>
  117. <dl class="function">
  118. <dt id="code.sql">
  119. <tt class="descclassname">code.</tt><tt class="descname">sql</tt><big>(</big><em>query</em>, <em>values=()</em>, <em>as_dict = 0</em>, <em>as_list = 0</em>, <em>allow_testing = 1</em><big>)</big><a class="headerlink" href="#code.sql" title="Permalink to this definition">¶</a></dt>
  120. <dd>Same as <cite>webnotes.conn.sql</cite></dd></dl>
  121. <dl class="function">
  122. <dt id="code.get_value">
  123. <tt class="descclassname">code.</tt><tt class="descname">get_value</tt><big>(</big><big>)</big><a class="headerlink" href="#code.get_value" title="Permalink to this definition">¶</a></dt>
  124. <dd>Sames as <cite>webnotes.conn.get_value</cite></dd></dl>
  125. <dl class="function">
  126. <dt id="code.convert_to_lists">
  127. <tt class="descclassname">code.</tt><tt class="descname">convert_to_lists</tt><big>(</big><big>)</big><a class="headerlink" href="#code.convert_to_lists" title="Permalink to this definition">¶</a></dt>
  128. <dd>Same as <cite>webnotes.conn.convert_to_lists</cite></dd></dl>
  129. </div>
  130. <div class="section" id="module-methods">
  131. <h2>Module Methods<a class="headerlink" href="#module-methods" title="Permalink to this headline">¶</a></h2>
  132. <dl class="function">
  133. <dt id="code.execute">
  134. <tt class="descclassname">code.</tt><tt class="descname">execute</tt><big>(</big><em>code</em>, <em>doc=None</em>, <em>doclist=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#code.execute" title="Permalink to this definition">¶</a></dt>
  135. <dd>Execute the code, if doc is given, then return the instance of the <cite>DocType</cite> class created</dd></dl>
  136. <dl class="function">
  137. <dt id="code.get_server_obj">
  138. <tt class="descclassname">code.</tt><tt class="descname">get_server_obj</tt><big>(</big><em>doc</em>, <em>doclist =</em><span class="optional">[</span><span class="optional">]</span>, <em>basedoctype = ''</em><big>)</big><a class="headerlink" href="#code.get_server_obj" title="Permalink to this definition">¶</a></dt>
  139. <dd>Returns the instantiated <cite>DocType</cite> object. Will also manage caching &amp; compiling</dd></dl>
  140. <dl class="function">
  141. <dt id="code.get_obj">
  142. <tt class="descclassname">code.</tt><tt class="descname">get_obj</tt><big>(</big><em>dt = None</em>, <em>dn = None</em>, <em>doc=None</em>, <em>doclist=</em><span class="optional">[</span><span class="optional">]</span>, <em>with_children = 0</em><big>)</big><a class="headerlink" href="#code.get_obj" title="Permalink to this definition">¶</a></dt>
  143. <dd>Returns the instantiated <cite>DocType</cite> object. Here you can pass the DocType and name (ID) to get the object.
  144. If with_children is true, then all child records will be laoded and added in the doclist.</dd></dl>
  145. <dl class="function">
  146. <dt id="code.run_server_obj">
  147. <tt class="descclassname">code.</tt><tt class="descname">run_server_obj</tt><big>(</big><em>server_obj</em>, <em>method_name</em>, <em>arg=None</em><big>)</big><a class="headerlink" href="#code.run_server_obj" title="Permalink to this definition">¶</a></dt>
  148. <dd>Executes a method (<cite>method_name</cite>) from the given object (<cite>server_obj</cite>)</dd></dl>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. <div class="clearer"></div>
  155. </div>
  156. <div class="related">
  157. <h3>Navigation</h3>
  158. <ul>
  159. <li class="right" style="margin-right: 10px">
  160. <a href="genindex.html" title="General Index"
  161. >index</a></li>
  162. <li class="right" >
  163. <a href="modindex.html" title="Global Module Index"
  164. >modules</a> |</li>
  165. <li class="right" >
  166. <a href="db_schema.html" title="db_schema — Database Schema Management Module"
  167. >next</a> |</li>
  168. <li class="right" >
  169. <a href="doctype.html" title="doctype — DocType"
  170. >previous</a> |</li>
  171. <li><a href="index.html">Documentation</a> &raquo;</li>
  172. <li><a href="server_side_api.html" >3. Server Side API</a> &raquo;</li>
  173. <li><a href="server_side_internals.html" >Server Side Internals</a> &raquo;</li>
  174. </ul>
  175. </div>
  176. <div class="footer">
  177. &copy; Copyright 2010, Rushabh Mehta.
  178. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
  179. </div>
  180. </body>
  181. </html>