MobileBlur

web2py.gluon.shell-module.html at [a162dcef14]
Login

web2py.gluon.shell-module.html at [a162dcef14]

File applications/examples/static/epydoc/web2py.gluon.shell-module.html artifact 4c84b22959 part of check-in a162dcef14


<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>web2py.gluon.shell</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;web2py ::
        <a href="web2py.gluon-module.html">Package&nbsp;gluon</a> ::
        Module&nbsp;shell
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="web2py.gluon.shell-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module shell</h1><span class="codelink"><a href="web2py.gluon.shell-pysrc.html">source&nbsp;code</a></span><br /><br />
This file is part of the web2py Web Framework Developed by Massimo Di 
  Pierro &lt;mdipierro@cs.depaul.edu&gt;, limodou &lt;limodou@gmail.com&gt;
  and srackham &lt;srackham@gmail.com&gt;. License: LGPLv3 
  (http://www.gnu.org/licenses/lgpl.html)<br /><br />

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.shell-module.html#exec_environment" class="summary-sig-name">exec_environment</a>(<span class="summary-sig-arg">pyfile</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">request</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">response</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">session</span>=<span class="summary-sig-default">1</span>)</span><br />
      ..</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#exec_environment">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.shell-module.html#env" class="summary-sig-name">env</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">import_models</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">c</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">f</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">dir</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">extra_request</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>)</span><br />
      Return web2py execution environment for application (a), 
      controller (c), function (f).</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#env">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="exec_pythonrc"></a><span class="summary-sig-name">exec_pythonrc</span>()</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#exec_pythonrc">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.shell-module.html#run" class="summary-sig-name">run</a>(<span class="summary-sig-arg">appname</span>,
        <span class="summary-sig-arg">plain</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">import_models</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">startfile</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">bpython</span>=<span class="summary-sig-default">True</span>)</span><br />
      Start interactive shell or run Python script (startfile) in web2py
      controller environment.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#run">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.shell-module.html#parse_path_info" class="summary-sig-name">parse_path_info</a>(<span class="summary-sig-arg">path_info</span>)</span><br />
      Parse path info formatted like a/c/f where c and f are optional 
      and a leading / accepted.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#parse_path_info">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="die"></a><span class="summary-sig-name">die</span>(<span class="summary-sig-arg">msg</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#die">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.shell-module.html#test" class="summary-sig-name">test</a>(<span class="summary-sig-arg">testpath</span>,
        <span class="summary-sig-arg">import_models</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">verbose</span>=<span class="summary-sig-default">True</span>)</span><br />
      Run doctests in web2py environment.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#test">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="get_usage"></a><span class="summary-sig-name">get_usage</span>()</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#get_usage">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="execute_from_command_line"></a><span class="summary-sig-name">execute_from_command_line</span>(<span class="summary-sig-arg">argv</span>=<span class="summary-sig-default">1</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.shell-pysrc.html#execute_from_command_line">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="logger"></a><span class="summary-name">logger</span> = <code title="logging.getLogger(&quot;web2py&quot;)">logging.getLogger(&quot;web2py&quot;)</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="exec_environment"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">exec_environment</span>(<span class="sig-arg">pyfile</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">request</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">response</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">session</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.shell-pysrc.html#exec_environment">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <pre class="literalblock">

.. function:: gluon.shell.exec_environment([pyfile=''[, request=Request()
    [, response=Response[, session=Session()]]]])

    Environment builder and module loader.


    Builds a web2py environment and optionally executes a Python
    file into the environment.
    A Storage dictionary containing the resulting environment is returned.
    The working directory must be web2py root -- this is the web2py default.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="env"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">env</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">import_models</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">c</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">f</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">dir</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">extra_request</span>=<span class="sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.shell-pysrc.html#env">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>Return web2py execution environment for application (a), controller 
  (c), function (f). If import_models is True the exec all application 
  models into the environment.</p>
  extra_request allows you to pass along any extra variables to the 
  request object before your models get executed. This was mainly done to 
  support web2py_utils.test_runner, however you can use it with any wrapper
  scripts that need access to the web2py environment.
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="run"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">run</span>(<span class="sig-arg">appname</span>,
        <span class="sig-arg">plain</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">import_models</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">startfile</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">bpython</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.shell-pysrc.html#run">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>Start interactive shell or run Python script (startfile) in web2py 
  controller environment. appname is formatted like:</p>
  a      web2py application name a/c    exec the controller c into the 
  application environment
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="parse_path_info"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">parse_path_info</span>(<span class="sig-arg">path_info</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.shell-pysrc.html#parse_path_info">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  Parse path info formatted like a/c/f where c and f are optional and a 
  leading / accepted. Return tuple (a, c, f). If invalid path_info a is set
  to None. If c or f are omitted they are set to None.
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="test"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">test</span>(<span class="sig-arg">testpath</span>,
        <span class="sig-arg">import_models</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">verbose</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.shell-pysrc.html#test">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>Run doctests in web2py environment. testpath is formatted like:</p>
  <p>a      tests all controllers in application a a/c    tests controller 
  c in application a a/c/f  test function f in controller c, application 
  a</p>
  Where a, c and f are application, controller and function names 
  respectively. If the testpath is a file name the file is tested. If a 
  controller is specified models are executed by default.
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Thu Aug  4 00:46:59 2011
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>