MobileBlur

web2py.gluon.compileapp-pysrc.html at [eba4a35a21]
Login

web2py.gluon.compileapp-pysrc.html at [eba4a35a21]

File applications/examples/static/epydoc/web2py.gluon.compileapp-pysrc.html artifact fa5f65d8df part of check-in eba4a35a21


<?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.compileapp</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;compileapp
      </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.compileapp-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="web2py.gluon.compileapp-module.html">Module web2py.gluon.compileapp</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#!/usr/bin/env python</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># -*- coding: utf-8 -*-</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring">This file is part of the web2py Web Framework</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring">Copyrighted by Massimo Di Pierro &lt;mdipierro@cs.depaul.edu&gt;</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring">License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring">Functions required to execute app components</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">============================================</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-docstring">FOR INTERNAL USE ONLY</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">fnmatch</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">copy</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">random</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">__builtin__</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Module web2py.gluon.storage=web2py.gluon.storage-module.html"><a title="web2py.gluon.storage" class="py-name" href="#" onclick="return doclink('link-0', 'storage', 'link-0');">storage</a></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Class web2py.gluon.storage.Storage=web2py.gluon.storage.Storage-class.html"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-1', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">,</tt> <tt id="link-2" class="py-name" targets="Class web2py.gluon.storage.List=web2py.gluon.storage.List-class.html"><a title="web2py.gluon.storage.List" class="py-name" href="#" onclick="return doclink('link-2', 'List', 'link-2');">List</a></tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-3" class="py-name" targets="Module web2py.gluon.template=web2py.gluon.template-module.html"><a title="web2py.gluon.template" class="py-name" href="#" onclick="return doclink('link-3', 'template', 'link-3');">template</a></tt> <tt class="py-keyword">import</tt> <tt id="link-4" class="py-name" targets="Function web2py.gluon.template.parse_template()=web2py.gluon.template-module.html#parse_template"><a title="web2py.gluon.template.parse_template" class="py-name" href="#" onclick="return doclink('link-4', 'parse_template', 'link-4');">parse_template</a></tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-5" class="py-name" targets="Module web2py.gluon.restricted=web2py.gluon.restricted-module.html,Function web2py.gluon.restricted.restricted()=web2py.gluon.restricted-module.html#restricted"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-5', 'restricted', 'link-5');">restricted</a></tt> <tt class="py-keyword">import</tt> <tt id="link-6" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-6', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">,</tt> <tt id="link-7" class="py-name" targets="Function web2py.gluon.restricted.compile2()=web2py.gluon.restricted-module.html#compile2"><a title="web2py.gluon.restricted.compile2" class="py-name" href="#" onclick="return doclink('link-7', 'compile2', 'link-7');">compile2</a></tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-8" class="py-name" targets="Module web2py.gluon.fileutils=web2py.gluon.fileutils-module.html"><a title="web2py.gluon.fileutils" class="py-name" href="#" onclick="return doclink('link-8', 'fileutils', 'link-8');">fileutils</a></tt> <tt class="py-keyword">import</tt> <tt id="link-9" class="py-name" targets="Function web2py.gluon.fileutils.mktree()=web2py.gluon.fileutils-module.html#mktree"><a title="web2py.gluon.fileutils.mktree" class="py-name" href="#" onclick="return doclink('link-9', 'mktree', 'link-9');">mktree</a></tt><tt class="py-op">,</tt> <tt id="link-10" class="py-name" targets="Function web2py.gluon.fileutils.listdir()=web2py.gluon.fileutils-module.html#listdir"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-10', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">,</tt> <tt id="link-11" class="py-name" targets="Function web2py.gluon.fileutils.read_file()=web2py.gluon.fileutils-module.html#read_file"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-11', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">,</tt> <tt id="link-12" class="py-name" targets="Function web2py.gluon.fileutils.write_file()=web2py.gluon.fileutils-module.html#write_file"><a title="web2py.gluon.fileutils.write_file" class="py-name" href="#" onclick="return doclink('link-12', 'write_file', 'link-12');">write_file</a></tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-13" class="py-name" targets="Module web2py.gluon.myregex=web2py.gluon.myregex-module.html"><a title="web2py.gluon.myregex" class="py-name" href="#" onclick="return doclink('link-13', 'myregex', 'link-13');">myregex</a></tt> <tt class="py-keyword">import</tt> <tt id="link-14" class="py-name" targets="Variable web2py.gluon.myregex.regex_expose=web2py.gluon.myregex-module.html#regex_expose"><a title="web2py.gluon.myregex.regex_expose" class="py-name" href="#" onclick="return doclink('link-14', 'regex_expose', 'link-14');">regex_expose</a></tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-15" class="py-name" targets="Module web2py.gluon.languages=web2py.gluon.languages-module.html"><a title="web2py.gluon.languages" class="py-name" href="#" onclick="return doclink('link-15', 'languages', 'link-15');">languages</a></tt> <tt class="py-keyword">import</tt> <tt id="link-16" class="py-name" targets="Class web2py.gluon.languages.translator=web2py.gluon.languages.translator-class.html"><a title="web2py.gluon.languages.translator" class="py-name" href="#" onclick="return doclink('link-16', 'translator', 'link-16');">translator</a></tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-17" class="py-name" targets="Module web2py.gluon.dal=web2py.gluon.dal-module.html"><a title="web2py.gluon.dal" class="py-name" href="#" onclick="return doclink('link-17', 'dal', 'link-17');">dal</a></tt> <tt class="py-keyword">import</tt> <tt id="link-18" class="py-name" targets="Class web2py.gluon.dal.BaseAdapter=web2py.gluon.dal.BaseAdapter-class.html"><a title="web2py.gluon.dal.BaseAdapter" class="py-name" href="#" onclick="return doclink('link-18', 'BaseAdapter', 'link-18');">BaseAdapter</a></tt><tt class="py-op">,</tt> <tt class="py-name">SQLDB</tt><tt class="py-op">,</tt> <tt class="py-name">SQLField</tt><tt class="py-op">,</tt> <tt id="link-19" class="py-name" targets="Class web2py.gluon.dal.DAL=web2py.gluon.dal.DAL-class.html"><a title="web2py.gluon.dal.DAL" class="py-name" href="#" onclick="return doclink('link-19', 'DAL', 'link-19');">DAL</a></tt><tt class="py-op">,</tt> <tt id="link-20" class="py-name" targets="Class web2py.gluon.dal.Field=web2py.gluon.dal.Field-class.html"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-20', 'Field', 'link-20');">Field</a></tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-21" class="py-name" targets="Module web2py.gluon.sqlhtml=web2py.gluon.sqlhtml-module.html"><a title="web2py.gluon.sqlhtml" class="py-name" href="#" onclick="return doclink('link-21', 'sqlhtml', 'link-21');">sqlhtml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-22" class="py-name" targets="Class web2py.gluon.sqlhtml.SQLFORM=web2py.gluon.sqlhtml.SQLFORM-class.html"><a title="web2py.gluon.sqlhtml.SQLFORM" class="py-name" href="#" onclick="return doclink('link-22', 'SQLFORM', 'link-22');">SQLFORM</a></tt><tt class="py-op">,</tt> <tt id="link-23" class="py-name" targets="Class web2py.gluon.sqlhtml.SQLTABLE=web2py.gluon.sqlhtml.SQLTABLE-class.html"><a title="web2py.gluon.sqlhtml.SQLTABLE" class="py-name" href="#" onclick="return doclink('link-23', 'SQLTABLE', 'link-23');">SQLTABLE</a></tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-24" class="py-name" targets="Module web2py.gluon.cache=web2py.gluon.cache-module.html"><a title="web2py.gluon.cache" class="py-name" href="#" onclick="return doclink('link-24', 'cache', 'link-24');">cache</a></tt> <tt class="py-keyword">import</tt> <tt id="link-25" class="py-name" targets="Class web2py.gluon.cache.Cache=web2py.gluon.cache.Cache-class.html"><a title="web2py.gluon.cache.Cache" class="py-name" href="#" onclick="return doclink('link-25', 'Cache', 'link-25');">Cache</a></tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-26" class="py-name" targets="Module web2py.gluon.globals=web2py.gluon.globals-module.html"><a title="web2py.gluon.globals" class="py-name" href="#" onclick="return doclink('link-26', 'globals', 'link-26');">globals</a></tt> <tt class="py-keyword">import</tt> <tt id="link-27" class="py-name" targets="Variable web2py.gluon.current=web2py.gluon-module.html#current,Variable web2py.gluon.globals.current=web2py.gluon.globals-module.html#current,Variable web2py.gluon.tools.current=web2py.gluon.tools-module.html#current"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-27', 'current', 'link-27');">current</a></tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-28" class="py-name" targets="Module web2py.gluon.settings=web2py.gluon.settings-module.html,Variable web2py.gluon.settings.settings=web2py.gluon.settings-module.html#settings"><a title="web2py.gluon.settings
web2py.gluon.settings.settings" class="py-name" href="#" onclick="return doclink('link-28', 'settings', 'link-28');">settings</a></tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-29" class="py-name" targets="Module web2py.gluon.cfs=web2py.gluon.cfs-module.html,Variable web2py.gluon.cfs.cfs=web2py.gluon.cfs-module.html#cfs"><a title="web2py.gluon.cfs
web2py.gluon.cfs.cfs" class="py-name" href="#" onclick="return doclink('link-29', 'cfs', 'link-29');">cfs</a></tt> <tt class="py-keyword">import</tt> <tt id="link-30" class="py-name" targets="Function web2py.gluon.cfs.getcfs()=web2py.gluon.cfs-module.html#getcfs"><a title="web2py.gluon.cfs.getcfs" class="py-name" href="#" onclick="return doclink('link-30', 'getcfs', 'link-30');">getcfs</a></tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-31" class="py-name" targets="Module web2py.gluon.html=web2py.gluon.html-module.html"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-31', 'html', 'link-31');">html</a></tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-32" class="py-name" targets="Function web2py.gluon.tools.validators()=web2py.gluon.tools-module.html#validators,Module web2py.gluon.validators=web2py.gluon.validators-module.html"><a title="web2py.gluon.tools.validators
web2py.gluon.validators" class="py-name" href="#" onclick="return doclink('link-32', 'validators', 'link-32');">validators</a></tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-33" class="py-name" targets="Module web2py.gluon.http=web2py.gluon.http-module.html"><a title="web2py.gluon.http" class="py-name" href="#" onclick="return doclink('link-33', 'http', 'link-33');">http</a></tt> <tt class="py-keyword">import</tt> <tt id="link-34" class="py-name" targets="Class web2py.gluon.http.HTTP=web2py.gluon.http.HTTP-class.html"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-34', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">,</tt> <tt id="link-35" class="py-name" targets="Function web2py.gluon.http.redirect()=web2py.gluon.http-module.html#redirect"><a title="web2py.gluon.http.redirect" class="py-name" href="#" onclick="return doclink('link-35', 'redirect', 'link-35');">redirect</a></tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">marshal</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">shutil</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">imp</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">logging</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt id="link-36" class="py-name" targets="Variable web2py.gluon.cache.logger=web2py.gluon.cache-module.html#logger,Variable web2py.gluon.compileapp.logger=web2py.gluon.compileapp-module.html#logger,Variable web2py.gluon.dal.logger=web2py.gluon.dal-module.html#logger,Variable web2py.gluon.debug.logger=web2py.gluon.debug-module.html#logger,Variable web2py.gluon.main.logger=web2py.gluon.main-module.html#logger,Variable web2py.gluon.newcron.logger=web2py.gluon.newcron-module.html#logger,Variable web2py.gluon.portalocker.logger=web2py.gluon.portalocker-module.html#logger,Variable web2py.gluon.restricted.logger=web2py.gluon.restricted-module.html#logger,Variable web2py.gluon.rewrite.logger=web2py.gluon.rewrite-module.html#logger,Variable web2py.gluon.shell.logger=web2py.gluon.shell-module.html#logger,Variable web2py.gluon.tools.logger=web2py.gluon.tools-module.html#logger,Variable web2py.gluon.utils.logger=web2py.gluon.utils-module.html#logger,Variable web2py.gluon.widget.logger=web2py.gluon.widget-module.html#logger"><a title="web2py.gluon.cache.logger
web2py.gluon.compileapp.logger
web2py.gluon.dal.logger
web2py.gluon.debug.logger
web2py.gluon.main.logger
web2py.gluon.newcron.logger
web2py.gluon.portalocker.logger
web2py.gluon.restricted.logger
web2py.gluon.rewrite.logger
web2py.gluon.shell.logger
web2py.gluon.tools.logger
web2py.gluon.utils.logger
web2py.gluon.widget.logger" class="py-name" href="#" onclick="return doclink('link-36', 'logger', 'link-36');">logger</a></tt> <tt class="py-op">=</tt> <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">getLogger</tt><tt class="py-op">(</tt><tt class="py-string">"web2py"</tt><tt class="py-op">)</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-37" class="py-name" targets="Module web2py.gluon.rewrite=web2py.gluon.rewrite-module.html"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-37', 'rewrite', 'link-37');">rewrite</a></tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">py_compile</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">    <tt id="link-38" class="py-name"><a title="web2py.gluon.cache.logger
web2py.gluon.compileapp.logger
web2py.gluon.dal.logger
web2py.gluon.debug.logger
web2py.gluon.main.logger
web2py.gluon.newcron.logger
web2py.gluon.portalocker.logger
web2py.gluon.restricted.logger
web2py.gluon.rewrite.logger
web2py.gluon.shell.logger
web2py.gluon.tools.logger
web2py.gluon.utils.logger
web2py.gluon.widget.logger" class="py-name" href="#" onclick="return doclink('link-38', 'logger', 'link-36');">logger</a></tt><tt class="py-op">.</tt><tt class="py-name">warning</tt><tt class="py-op">(</tt><tt class="py-string">'unable to import py_compile'</tt><tt class="py-op">)</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt id="link-39" class="py-name" targets="Variable web2py.gluon.compileapp.is_gae=web2py.gluon.compileapp-module.html#is_gae,Variable web2py.gluon.languages.is_gae=web2py.gluon.languages-module.html#is_gae"><a title="web2py.gluon.compileapp.is_gae
web2py.gluon.languages.is_gae" class="py-name" href="#" onclick="return doclink('link-39', 'is_gae', 'link-39');">is_gae</a></tt> <tt class="py-op">=</tt> <tt id="link-40" class="py-name"><a title="web2py.gluon.settings
web2py.gluon.settings.settings" class="py-name" href="#" onclick="return doclink('link-40', 'settings', 'link-28');">settings</a></tt><tt class="py-op">.</tt><tt id="link-41" class="py-name" targets="Variable web2py.gluon.settings.global_settings=web2py.gluon.settings-module.html#global_settings"><a title="web2py.gluon.settings.global_settings" class="py-name" href="#" onclick="return doclink('link-41', 'global_settings', 'link-41');">global_settings</a></tt><tt class="py-op">.</tt><tt class="py-name">web2py_runtime_gae</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt id="link-42" class="py-name" targets="Variable web2py.gluon.compileapp.is_jython=web2py.gluon.compileapp-module.html#is_jython"><a title="web2py.gluon.compileapp.is_jython" class="py-name" href="#" onclick="return doclink('link-42', 'is_jython', 'link-42');">is_jython</a></tt> <tt class="py-op">=</tt> <tt id="link-43" class="py-name"><a title="web2py.gluon.settings
web2py.gluon.settings.settings" class="py-name" href="#" onclick="return doclink('link-43', 'settings', 'link-28');">settings</a></tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="web2py.gluon.settings.global_settings" class="py-name" href="#" onclick="return doclink('link-44', 'global_settings', 'link-41');">global_settings</a></tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="web2py.gluon.compileapp.is_jython" class="py-name" href="#" onclick="return doclink('link-45', 'is_jython', 'link-42');">is_jython</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'java'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">platform</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name" targets="Method web2py.gluon.dal.Expression.lower()=web2py.gluon.dal.Expression-class.html#lower"><a title="web2py.gluon.dal.Expression.lower" class="py-name" href="#" onclick="return doclink('link-46', 'lower', 'link-46');">lower</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">,</tt> <tt class="py-string">'JYTHON_JAR'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">copyright</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name" targets="Method web2py.gluon.dal.Rows.find()=web2py.gluon.dal.Rows-class.html#find"><a title="web2py.gluon.dal.Rows.find" class="py-name" href="#" onclick="return doclink('link-47', 'find', 'link-47');">find</a></tt><tt class="py-op">(</tt><tt class="py-string">'Jython'</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt id="link-48" class="py-name" targets="Variable web2py.gluon.compileapp.TEST_CODE=web2py.gluon.compileapp-module.html#TEST_CODE"><a title="web2py.gluon.compileapp.TEST_CODE" class="py-name" href="#" onclick="return doclink('link-48', 'TEST_CODE', 'link-48');">TEST_CODE</a></tt> <tt class="py-op">=</tt> \ </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt class="py-string">r"""</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-string">def _TEST():</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-string">    import doctest, sys, cStringIO, types, cgi, gluon.fileutils</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt class="py-string">    if not gluon.fileutils.check_credentials(request):</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt class="py-string">        raise HTTP(401, web2py_error='invalid credentials')</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-string">    stdout = sys.stdout</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-string">    html = '&lt;h2&gt;Testing controller "%s.py" ... done.&lt;/h2&gt;&lt;br/&gt;\n' \</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-string">        % request.controller</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-string">    for key in sorted([key for key in globals() if not key in __symbols__+['_TEST']]):</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-string">        eval_key = eval(key)</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-string">        if type(eval_key) == types.FunctionType:</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-string">            number_doctests = sum([len(ds.examples) for ds in doctest.DocTestFinder().find(eval_key)])</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-string">            if number_doctests&gt;0:</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-string">                sys.stdout = cStringIO.StringIO()</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-string">                name = '%s/controllers/%s.py in %s.__doc__' \</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-string">                    % (request.folder, request.controller, key)</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-string">                doctest.run_docstring_examples(eval_key,</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-string">                    globals(), False, name=name)</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-string">                report = sys.stdout.getvalue().strip()</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-string">                if report:</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-string">                    pf = 'failed'</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-string">                else:</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-string">                    pf = 'passed'</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-string">                html += '&lt;h3 class="%s"&gt;Function %s [%s]&lt;/h3&gt;\n' \</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-string">                    % (pf, key, pf)</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-string">                if report:</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt class="py-string">                    html += CODE(report, language='web2py', \</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-string">                        link='/examples/global/vars/').xml()</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"><tt class="py-string">                html += '&lt;br/&gt;\n'</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-string">            else:</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-string">                html += \</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"><tt class="py-string">                    '&lt;h3 class="nodoctests"&gt;Function %s [no doctests]&lt;/h3&gt;&lt;br/&gt;\n' \</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"><tt class="py-string">                    % (key)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-string">    response._vars = html</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-string">    sys.stdout = stdout</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"><tt class="py-string">_TEST()</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"> </tt>
<a name="mybuiltin"></a><div id="mybuiltin-def"><a name="L91"></a><tt class="py-lineno"> 91</tt> <a class="py-toggle" href="#" id="mybuiltin-toggle" onclick="return toggle('mybuiltin');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.compileapp.mybuiltin-class.html">mybuiltin</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="mybuiltin-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="mybuiltin-expanded"><a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring">    NOTE could simple use a dict and populate it, </tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">    NOTE not sure if this changes things though if monkey patching import.....</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">    <tt class="py-comment">#__builtins__</tt> </tt>
<a name="mybuiltin.__getitem__"></a><div id="mybuiltin.__getitem__-def"><a name="L97"></a><tt class="py-lineno"> 97</tt> <a class="py-toggle" href="#" id="mybuiltin.__getitem__-toggle" onclick="return toggle('mybuiltin.__getitem__');">-</a><tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp.mybuiltin-class.html#__getitem__">__getitem__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="mybuiltin.__getitem__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mybuiltin.__getitem__-expanded"><a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">__builtin__</tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">)</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">KeyError</tt><tt class="py-op">,</tt> <tt class="py-name">key</tt>             </tt>
</div><a name="mybuiltin.__setitem__"></a><div id="mybuiltin.__setitem__-def"><a name="L102"></a><tt class="py-lineno">102</tt> <a class="py-toggle" href="#" id="mybuiltin.__setitem__-toggle" onclick="return toggle('mybuiltin.__setitem__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp.mybuiltin-class.html#__setitem__">__setitem__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="mybuiltin.__setitem__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="mybuiltin.__setitem__-expanded"><a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"> </tt>
<a name="LoadFactory"></a><div id="LoadFactory-def"><a name="L105"></a><tt class="py-lineno">105</tt> <a class="py-toggle" href="#" id="LoadFactory-toggle" onclick="return toggle('LoadFactory');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="web2py.gluon.compileapp.LoadFactory-class.html">LoadFactory</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LoadFactory-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="LoadFactory-expanded"><a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line"><tt class="py-docstring">    Attention: this helper is new and experimental</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="LoadFactory.__init__"></a><div id="LoadFactory.__init__-def"><a name="L109"></a><tt class="py-lineno">109</tt> <a class="py-toggle" href="#" id="LoadFactory.__init__-toggle" onclick="return toggle('LoadFactory.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp.LoadFactory-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">environment</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LoadFactory.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LoadFactory.__init__-expanded"><a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">environment</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt> </tt>
</div><a name="LoadFactory.__call__"></a><div id="LoadFactory.__call__-def"><a name="L111"></a><tt class="py-lineno">111</tt> <a class="py-toggle" href="#" id="LoadFactory.__call__-toggle" onclick="return toggle('LoadFactory.__call__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp.LoadFactory-class.html#__call__">__call__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">c</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">f</tt><tt class="py-op">=</tt><tt class="py-string">'index'</tt><tt class="py-op">,</tt> <tt class="py-param">args</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-param">vars</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">                 <tt class="py-param">extension</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">target</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">ajax</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt><tt class="py-param">ajax_trap</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">                 <tt class="py-param">url</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">user_signature</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-param">content</tt><tt class="py-op">=</tt><tt class="py-string">'loading...'</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-param">attr</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LoadFactory.__call__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LoadFactory.__call__-expanded"><a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">        <tt class="py-keyword">import</tt> <tt id="link-49" class="py-name"><a title="web2py.gluon.globals" class="py-name" href="#" onclick="return doclink('link-49', 'globals', 'link-26');">globals</a></tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">        <tt class="py-name">target</tt> <tt class="py-op">=</tt> <tt class="py-name">target</tt> <tt class="py-keyword">or</tt> <tt class="py-string">'c'</tt><tt class="py-op">+</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">random</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">        <tt class="py-name">attr</tt><tt class="py-op">[</tt><tt class="py-string">'_id'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">target</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">        <tt class="py-name">request</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt><tt id="link-50" class="py-name"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-50', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">            <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt id="link-51" class="py-name"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-51', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">(</tt><tt class="py-name">vars</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-string">'.'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">            <tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">extension</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'.'</tt><tt class="py-op">,</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-52" class="py-name" targets="Method web2py.gluon.tools.Auth.url()=web2py.gluon.tools.Auth-class.html#url,Method web2py.gluon.tools.Crud.url()=web2py.gluon.tools.Crud-class.html#url"><a title="web2py.gluon.tools.Auth.url
web2py.gluon.tools.Crud.url" class="py-name" href="#" onclick="return doclink('link-52', 'url', 'link-52');">url</a></tt> <tt class="py-keyword">or</tt> <tt class="py-name">ajax</tt><tt class="py-op">:</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">            <tt id="link-53" class="py-name"><a title="web2py.gluon.tools.Auth.url
web2py.gluon.tools.Crud.url" class="py-name" href="#" onclick="return doclink('link-53', 'url', 'link-52');">url</a></tt> <tt class="py-op">=</tt> <tt id="link-54" class="py-name"><a title="web2py.gluon.tools.Auth.url
web2py.gluon.tools.Crud.url" class="py-name" href="#" onclick="return doclink('link-54', 'url', 'link-52');">url</a></tt> <tt class="py-keyword">or</tt> <tt id="link-55" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-55', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-56" class="py-name" targets="Function web2py.gluon.html.URL()=web2py.gluon.html-module.html#URL"><a title="web2py.gluon.html.URL" class="py-name" href="#" onclick="return doclink('link-56', 'URL', 'link-56');">URL</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">application</tt><tt class="py-op">,</tt> <tt class="py-name">c</tt><tt class="py-op">,</tt> <tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">r</tt><tt class="py-op">=</tt><tt class="py-name">request</tt><tt class="py-op">,</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">                                  <tt class="py-name">args</tt><tt class="py-op">=</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-name">vars</tt><tt class="py-op">=</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt> <tt class="py-name">extension</tt><tt class="py-op">=</tt><tt class="py-name">extension</tt><tt class="py-op">,</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">                                  <tt class="py-name">user_signature</tt><tt class="py-op">=</tt><tt class="py-name">user_signature</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">            <tt class="py-name">script</tt> <tt class="py-op">=</tt> <tt id="link-57" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-57', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-58" class="py-name" targets="Class web2py.gluon.html.SCRIPT=web2py.gluon.html.SCRIPT-class.html"><a title="web2py.gluon.html.SCRIPT" class="py-name" href="#" onclick="return doclink('link-58', 'SCRIPT', 'link-58');">SCRIPT</a></tt><tt class="py-op">(</tt><tt class="py-string">'web2py_component("%s","%s")'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt id="link-59" class="py-name"><a title="web2py.gluon.tools.Auth.url
web2py.gluon.tools.Crud.url" class="py-name" href="#" onclick="return doclink('link-59', 'url', 'link-52');">url</a></tt><tt class="py-op">,</tt> <tt class="py-name">target</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">                                 <tt class="py-name">_type</tt><tt class="py-op">=</tt><tt class="py-string">"text/javascript"</tt><tt class="py-op">)</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-60" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-60', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-61" class="py-name" targets="Variable web2py.gluon.TAG=web2py.gluon-module.html#TAG,Variable web2py.gluon.html.TAG=web2py.gluon.html-module.html#TAG,Variable web2py.gluon.tools.TAG=web2py.gluon.tools-module.html#TAG"><a title="web2py.gluon.TAG
web2py.gluon.html.TAG
web2py.gluon.tools.TAG" class="py-name" href="#" onclick="return doclink('link-61', 'TAG', 'link-61');">TAG</a></tt><tt class="py-op">[</tt><tt class="py-string">''</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">script</tt><tt class="py-op">,</tt> <tt id="link-62" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-62', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-63" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.DIV()=web2py.gluon.dal.BaseAdapter-class.html#DIV,Method web2py.gluon.dal.NoSQLAdapter.DIV()=web2py.gluon.dal.NoSQLAdapter-class.html#DIV,Class web2py.gluon.html.DIV=web2py.gluon.html.DIV-class.html"><a title="web2py.gluon.dal.BaseAdapter.DIV
web2py.gluon.dal.NoSQLAdapter.DIV
web2py.gluon.html.DIV" class="py-name" href="#" onclick="return doclink('link-63', 'DIV', 'link-63');">DIV</a></tt><tt class="py-op">(</tt><tt class="py-name">content</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-name">attr</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">args</tt><tt class="py-op">,</tt><tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">,</tt><tt class="py-name">tuple</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">                <tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">args</tt><tt class="py-op">]</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">            <tt class="py-name">c</tt> <tt class="py-op">=</tt> <tt class="py-name">c</tt> <tt class="py-keyword">or</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">controller</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt> <tt class="py-op">=</tt> <tt id="link-64" class="py-name"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-64', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-65" class="py-name" targets="Method web2py.gluon.rocket.Headers.items()=web2py.gluon.rocket.Headers-class.html#items"><a title="web2py.gluon.rocket.Headers.items" class="py-name" href="#" onclick="return doclink('link-65', 'items', 'link-65');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">                <tt class="py-name">other_request</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">[</tt><tt class="py-string">'env'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-66" class="py-name"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-66', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-67" class="py-name" targets="Function web2py.gluon.shell.env()=web2py.gluon.shell-module.html#env"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-67', 'env', 'link-67');">env</a></tt><tt class="py-op">.</tt><tt id="link-68" class="py-name"><a title="web2py.gluon.rocket.Headers.items" class="py-name" href="#" onclick="return doclink('link-68', 'items', 'link-65');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">                <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt id="link-69" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-69', 'env', 'link-67');">env</a></tt><tt class="py-op">[</tt><tt class="py-string">'key'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt>  </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">controller</tt> <tt class="py-op">=</tt> <tt class="py-name">c</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">function</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">extension</tt> <tt class="py-op">=</tt> <tt class="py-name">extension</tt> <tt class="py-keyword">or</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">extension</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt id="link-70" class="py-name"><a title="web2py.gluon.storage.List" class="py-name" href="#" onclick="return doclink('link-70', 'List', 'link-2');">List</a></tt><tt class="py-op">(</tt><tt class="py-name">args</tt><tt class="py-op">)</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">vars</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">get_vars</tt> <tt class="py-op">=</tt> <tt class="py-name">vars</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">post_vars</tt> <tt class="py-op">=</tt> <tt id="link-71" class="py-name"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-71', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">            <tt class="py-name">other_response</tt> <tt class="py-op">=</tt> <tt id="link-72" class="py-name"><a title="web2py.gluon.globals" class="py-name" href="#" onclick="return doclink('link-72', 'globals', 'link-26');">globals</a></tt><tt class="py-op">.</tt><tt id="link-73" class="py-name" targets="Class web2py.gluon.globals.Response=web2py.gluon.globals.Response-class.html"><a title="web2py.gluon.globals.Response" class="py-name" href="#" onclick="return doclink('link-73', 'Response', 'link-73');">Response</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt id="link-74" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-74', 'env', 'link-67');">env</a></tt><tt class="py-op">.</tt><tt class="py-name">path_info</tt> <tt class="py-op">=</tt> <tt class="py-string">'/'</tt> <tt class="py-op">+</tt> \ </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">                <tt class="py-string">'/'</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name" targets="Function web2py.gluon.html.join()=web2py.gluon.html-module.html#join"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-75', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">application</tt><tt class="py-op">,</tt><tt class="py-name">c</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">]</tt> <tt class="py-op">+</tt> \ </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">                             <tt class="py-name">map</tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">,</tt> <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">args</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-76', 'env', 'link-67');">env</a></tt><tt class="py-op">.</tt><tt class="py-name">query_string</tt> <tt class="py-op">=</tt> \ </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">                <tt class="py-name">vars</tt> <tt class="py-keyword">and</tt> <tt id="link-77" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-77', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="web2py.gluon.html.URL" class="py-name" href="#" onclick="return doclink('link-78', 'URL', 'link-56');">URL</a></tt><tt class="py-op">(</tt><tt class="py-name">vars</tt><tt class="py-op">=</tt><tt class="py-name">vars</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">'?'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt id="link-79" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-79', 'env', 'link-67');">env</a></tt><tt class="py-op">.</tt><tt class="py-name">http_web2py_component_location</tt> <tt class="py-op">=</tt> \ </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">                <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-80', 'env', 'link-67');">env</a></tt><tt class="py-op">.</tt><tt class="py-name">path_info</tt>             </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">cid</tt> <tt class="py-op">=</tt> <tt class="py-name">target</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">            <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-81', 'env', 'link-67');">env</a></tt><tt class="py-op">.</tt><tt class="py-name">http_web2py_component_element</tt> <tt class="py-op">=</tt> <tt class="py-name">target</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">            <tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt> <tt class="py-op">=</tt> <tt class="py-string">'%s/%s.%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">other_request</tt><tt class="py-op">.</tt><tt class="py-name">extension</tt><tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">            <tt class="py-name">other_environment</tt> <tt class="py-op">=</tt> <tt class="py-name">copy</tt><tt class="py-op">.</tt><tt class="py-name">copy</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">environment</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">            <tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">_view_environment</tt> <tt class="py-op">=</tt> <tt class="py-name">other_environment</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">            <tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">generic_patterns</tt> <tt class="py-op">=</tt> \ </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">                <tt class="py-name">copy</tt><tt class="py-op">.</tt><tt class="py-name">copy</tt><tt class="py-op">(</tt><tt id="link-82" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-82', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">generic_patterns</tt><tt class="py-op">)</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">            <tt class="py-name">other_environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">other_request</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">            <tt class="py-name">other_environment</tt><tt class="py-op">[</tt><tt class="py-string">'response'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">other_response</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">            <tt class="py-comment">## some magic here because current are thread-locals</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">            <tt class="py-name">original_request</tt><tt class="py-op">,</tt> <tt id="link-83" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-83', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">request</tt> <tt class="py-op">=</tt> <tt id="link-84" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-84', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">request</tt><tt class="py-op">,</tt> <tt class="py-name">other_request</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">            <tt class="py-name">original_response</tt><tt class="py-op">,</tt> <tt id="link-85" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-85', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">response</tt> <tt class="py-op">=</tt> <tt id="link-86" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-86', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">response</tt><tt class="py-op">,</tt> <tt class="py-name">other_response</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">            <tt class="py-name">page</tt> <tt class="py-op">=</tt> <tt id="link-87" class="py-name" targets="Function web2py.gluon.compileapp.run_controller_in()=web2py.gluon.compileapp-module.html#run_controller_in"><a title="web2py.gluon.compileapp.run_controller_in" class="py-name" href="#" onclick="return doclink('link-87', 'run_controller_in', 'link-87');">run_controller_in</a></tt><tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">,</tt> <tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">other_environment</tt><tt class="py-op">)</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">page</tt><tt class="py-op">,</tt> <tt class="py-name">dict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">                <tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">_vars</tt> <tt class="py-op">=</tt> <tt class="py-name">page</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt class="py-name">page</tt><tt class="py-op">:</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">                    <tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">_view_environment</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">page</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">                <tt id="link-88" class="py-name" targets="Function web2py.gluon.compileapp.run_view_in()=web2py.gluon.compileapp-module.html#run_view_in"><a title="web2py.gluon.compileapp.run_view_in" class="py-name" href="#" onclick="return doclink('link-88', 'run_view_in', 'link-88');">run_view_in</a></tt><tt class="py-op">(</tt><tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">_view_environment</tt><tt class="py-op">)</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">                <tt class="py-name">page</tt> <tt class="py-op">=</tt> <tt class="py-name">other_response</tt><tt class="py-op">.</tt><tt class="py-name">body</tt><tt class="py-op">.</tt><tt class="py-name">getvalue</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">            <tt id="link-89" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-89', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">request</tt><tt class="py-op">,</tt> <tt id="link-90" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-90', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">response</tt> <tt class="py-op">=</tt> <tt class="py-name">original_request</tt><tt class="py-op">,</tt> <tt class="py-name">original_response</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">            <tt class="py-name">js</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">ajax_trap</tt><tt class="py-op">:</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">                <tt class="py-name">link</tt> <tt class="py-op">=</tt> <tt id="link-91" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-91', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-92" class="py-name"><a title="web2py.gluon.html.URL" class="py-name" href="#" onclick="return doclink('link-92', 'URL', 'link-56');">URL</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">application</tt><tt class="py-op">,</tt> <tt class="py-name">c</tt><tt class="py-op">,</tt> <tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">r</tt><tt class="py-op">=</tt><tt class="py-name">request</tt><tt class="py-op">,</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">                                <tt class="py-name">args</tt><tt class="py-op">=</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-name">vars</tt><tt class="py-op">=</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt> <tt class="py-name">extension</tt><tt class="py-op">=</tt><tt class="py-name">extension</tt><tt class="py-op">,</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">                                <tt class="py-name">user_signature</tt><tt class="py-op">=</tt><tt class="py-name">user_signature</tt><tt class="py-op">)</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">                <tt class="py-name">js</tt> <tt class="py-op">=</tt> <tt class="py-string">"web2py_trap_form('%s','%s');"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">link</tt><tt class="py-op">,</tt> <tt class="py-name">target</tt><tt class="py-op">)</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">            <tt class="py-name">script</tt> <tt class="py-op">=</tt> <tt class="py-name">js</tt> <tt class="py-keyword">and</tt> <tt id="link-93" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-93', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-94" class="py-name"><a title="web2py.gluon.html.SCRIPT" class="py-name" href="#" onclick="return doclink('link-94', 'SCRIPT', 'link-58');">SCRIPT</a></tt><tt class="py-op">(</tt><tt class="py-name">js</tt><tt class="py-op">,</tt><tt class="py-name">_type</tt><tt class="py-op">=</tt><tt class="py-string">"text/javascript"</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-95" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-95', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-96" class="py-name"><a title="web2py.gluon.TAG
web2py.gluon.html.TAG
web2py.gluon.tools.TAG" class="py-name" href="#" onclick="return doclink('link-96', 'TAG', 'link-61');">TAG</a></tt><tt class="py-op">[</tt><tt class="py-string">''</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt id="link-97" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-97', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-98" class="py-name"><a title="web2py.gluon.dal.BaseAdapter.DIV
web2py.gluon.dal.NoSQLAdapter.DIV
web2py.gluon.html.DIV" class="py-name" href="#" onclick="return doclink('link-98', 'DIV', 'link-63');">DIV</a></tt><tt class="py-op">(</tt><tt id="link-99" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-99', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt id="link-100" class="py-name" targets="Class web2py.gluon.html.XML=web2py.gluon.html.XML-class.html"><a title="web2py.gluon.html.XML" class="py-name" href="#" onclick="return doclink('link-100', 'XML', 'link-100');">XML</a></tt><tt class="py-op">(</tt><tt class="py-name">page</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-name">attr</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">script</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"> </tt>
<a name="local_import_aux"></a><div id="local_import_aux-def"><a name="L187"></a><tt class="py-lineno">187</tt> <a class="py-toggle" href="#" id="local_import_aux-toggle" onclick="return toggle('local_import_aux');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#local_import_aux">local_import_aux</a><tt class="py-op">(</tt><tt class="py-param">name</tt><tt class="py-op">,</tt> <tt class="py-param">force</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-param">app</tt><tt class="py-op">=</tt><tt class="py-string">'welcome'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="local_import_aux-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="local_import_aux-expanded"><a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line"><tt class="py-docstring">    In apps, instead of importing a local module</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line"><tt class="py-docstring">    (in applications/app/modules) with::</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line"><tt class="py-docstring">       import a.b.c as d</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line"><tt class="py-docstring">    you should do::</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line"><tt class="py-docstring">       d = local_import('a.b.c')</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line"><tt class="py-docstring">    or (to force a reload):</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"><tt class="py-docstring">       d = local_import('a.b.c', reload=True)</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"><tt class="py-docstring">    This prevents conflict between applications and un-necessary execs.</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-docstring">    It can be used to import any module, including regular Python modules.</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">    <tt id="link-101" class="py-name"><a title="web2py.gluon.rocket.Headers.items" class="py-name" href="#" onclick="return doclink('link-101', 'items', 'link-65');">items</a></tt> <tt class="py-op">=</tt> <tt id="link-102" class="py-name" targets="Variable web2py.gluon.import_all.name=web2py.gluon.import_all-module.html#name"><a title="web2py.gluon.import_all.name" class="py-name" href="#" onclick="return doclink('link-102', 'name', 'link-102');">name</a></tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'/'</tt><tt class="py-op">,</tt><tt class="py-string">'.'</tt><tt class="py-op">)</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line">    <tt id="link-103" class="py-name"><a title="web2py.gluon.import_all.name" class="py-name" href="#" onclick="return doclink('link-103', 'name', 'link-102');">name</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"applications.%s.modules.%s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">app</tt><tt class="py-op">,</tt> <tt id="link-104" class="py-name"><a title="web2py.gluon.rocket.Headers.items" class="py-name" href="#" onclick="return doclink('link-104', 'items', 'link-65');">items</a></tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">    <tt id="link-105" class="py-name" targets="Variable web2py.gluon.import_all.module=web2py.gluon.import_all-module.html#module"><a title="web2py.gluon.import_all.module" class="py-name" href="#" onclick="return doclink('link-105', 'module', 'link-105');">module</a></tt> <tt class="py-op">=</tt> <tt class="py-name">__import__</tt><tt class="py-op">(</tt><tt id="link-106" class="py-name"><a title="web2py.gluon.import_all.name" class="py-name" href="#" onclick="return doclink('link-106', 'name', 'link-102');">name</a></tt><tt class="py-op">)</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">item</tt> <tt class="py-keyword">in</tt> <tt id="link-107" class="py-name"><a title="web2py.gluon.import_all.name" class="py-name" href="#" onclick="return doclink('link-107', 'name', 'link-102');">name</a></tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"."</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">        <tt id="link-108" class="py-name"><a title="web2py.gluon.import_all.module" class="py-name" href="#" onclick="return doclink('link-108', 'module', 'link-105');">module</a></tt> <tt class="py-op">=</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt id="link-109" class="py-name"><a title="web2py.gluon.import_all.module" class="py-name" href="#" onclick="return doclink('link-109', 'module', 'link-105');">module</a></tt><tt class="py-op">,</tt> <tt class="py-name">item</tt><tt class="py-op">)</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-110" class="py-name" targets="Method web2py.gluon.languages.translator.force()=web2py.gluon.languages.translator-class.html#force"><a title="web2py.gluon.languages.translator.force" class="py-name" href="#" onclick="return doclink('link-110', 'force', 'link-110');">force</a></tt><tt class="py-op">:</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">        <tt class="py-name">reload</tt><tt class="py-op">(</tt><tt id="link-111" class="py-name"><a title="web2py.gluon.import_all.module" class="py-name" href="#" onclick="return doclink('link-111', 'module', 'link-105');">module</a></tt><tt class="py-op">)</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-112" class="py-name"><a title="web2py.gluon.import_all.module" class="py-name" href="#" onclick="return doclink('link-112', 'module', 'link-105');">module</a></tt> </tt>
</div><a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line"> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line"><tt class="py-string">OLD IMPLEMENTATION:</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line"><tt class="py-string">    items = name.replace('/','.').split('.')</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line"><tt class="py-string">    filename, modulepath = items[-1], os.path.join(apath,'modules',*items[:-1])</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line"><tt class="py-string">    imp.acquire_lock()</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line"><tt class="py-string">    try:</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line"><tt class="py-string">        file=None</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line"><tt class="py-string">        (file,path,desc) = imp.find_module(filename,[modulepath]+sys.path)</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line"><tt class="py-string">        if not path in sys.modules or reload:</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line"><tt class="py-string">            if is_gae:</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line"><tt class="py-string">                module={}</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line"><tt class="py-string">                execfile(path,{},module)</tt> </tt>
<a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line"><tt class="py-string">                module=Storage(module)</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line"><tt class="py-string">            else:</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line"><tt class="py-string">                module = imp.load_module(path,file,path,desc)</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line"><tt class="py-string">            sys.modules[path] = module</tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line"><tt class="py-string">        else:</tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line"><tt class="py-string">            module = sys.modules[path]</tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line"><tt class="py-string">    except Exception, e:</tt> </tt>
<a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line"><tt class="py-string">        module = None</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line"><tt class="py-string">    if file:</tt> </tt>
<a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line"><tt class="py-string">        file.close()</tt> </tt>
<a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line"><tt class="py-string">    imp.release_lock()</tt> </tt>
<a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line"><tt class="py-string">    if not module:</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line"><tt class="py-string">        raise ImportError, "cannot find module %s in %s" % (filename, modulepath)</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line"><tt class="py-string">    return module</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line"> </tt>
<a name="build_environment"></a><div id="build_environment-def"><a name="L243"></a><tt class="py-lineno">243</tt> <a class="py-toggle" href="#" id="build_environment-toggle" onclick="return toggle('build_environment');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#build_environment">build_environment</a><tt class="py-op">(</tt><tt class="py-param">request</tt><tt class="py-op">,</tt> <tt class="py-param">response</tt><tt class="py-op">,</tt> <tt class="py-param">session</tt><tt class="py-op">,</tt> <tt class="py-param">store_current</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="build_environment-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="build_environment-expanded"><a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line"><tt class="py-docstring">    Build the environment dictionary into which web2py files are executed.</tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line"> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line">    <tt class="py-name">environment</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt id="link-113" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-113', 'html', 'link-31');">html</a></tt><tt class="py-op">.</tt><tt class="py-name">__all__</tt><tt class="py-op">:</tt> </tt>
<a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">        <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt id="link-114" class="py-name"><a title="web2py.gluon.html" class="py-name" href="#" onclick="return doclink('link-114', 'html', 'link-31');">html</a></tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">)</tt> </tt>
<a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt id="link-115" class="py-name"><a title="web2py.gluon.tools.validators
web2py.gluon.validators" class="py-name" href="#" onclick="return doclink('link-115', 'validators', 'link-32');">validators</a></tt><tt class="py-op">.</tt><tt class="py-name">__all__</tt><tt class="py-op">:</tt> </tt>
<a name="L252"></a><tt class="py-lineno">252</tt>  <tt class="py-line">        <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt id="link-116" class="py-name"><a title="web2py.gluon.tools.validators
web2py.gluon.validators" class="py-name" href="#" onclick="return doclink('link-116', 'validators', 'link-32');">validators</a></tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">)</tt> </tt>
<a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-117" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-117', 'env', 'link-67');">env</a></tt><tt class="py-op">:</tt> </tt>
<a name="L254"></a><tt class="py-lineno">254</tt>  <tt class="py-line">        <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-118" class="py-name"><a title="web2py.gluon.shell.env" class="py-name" href="#" onclick="return doclink('link-118', 'env', 'link-67');">env</a></tt> <tt class="py-op">=</tt> <tt id="link-119" class="py-name"><a title="web2py.gluon.storage.Storage" class="py-name" href="#" onclick="return doclink('link-119', 'Storage', 'link-1');">Storage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line"> </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">    <tt class="py-name">t</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'T'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-120" class="py-name"><a title="web2py.gluon.languages.translator" class="py-name" href="#" onclick="return doclink('link-120', 'translator', 'link-16');">translator</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">    <tt class="py-name">c</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'cache'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-121" class="py-name"><a title="web2py.gluon.cache.Cache" class="py-name" href="#" onclick="return doclink('link-121', 'Cache', 'link-25');">Cache</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">store_current</tt><tt class="py-op">:</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">        <tt id="link-122" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-122', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">request</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt> </tt>
<a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line">        <tt id="link-123" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-123', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">response</tt> <tt class="py-op">=</tt> <tt class="py-name">response</tt> </tt>
<a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line">        <tt id="link-124" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-124', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt class="py-name">session</tt> <tt class="py-op">=</tt> <tt class="py-name">session</tt> </tt>
<a name="L262"></a><tt class="py-lineno">262</tt>  <tt class="py-line">        <tt id="link-125" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-125', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt id="link-126" class="py-name" targets="Variable web2py.gluon.languages.lazyT.T=web2py.gluon.languages.lazyT-class.html#T"><a title="web2py.gluon.languages.lazyT.T" class="py-name" href="#" onclick="return doclink('link-126', 'T', 'link-126');">T</a></tt> <tt class="py-op">=</tt> <tt class="py-name">t</tt> </tt>
<a name="L263"></a><tt class="py-lineno">263</tt>  <tt class="py-line">        <tt id="link-127" class="py-name"><a title="web2py.gluon.current
web2py.gluon.globals.current
web2py.gluon.tools.current" class="py-name" href="#" onclick="return doclink('link-127', 'current', 'link-27');">current</a></tt><tt class="py-op">.</tt><tt id="link-128" class="py-name"><a title="web2py.gluon.cache" class="py-name" href="#" onclick="return doclink('link-128', 'cache', 'link-24');">cache</a></tt> <tt class="py-op">=</tt> <tt class="py-name">c</tt> </tt>
<a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line"> </tt>
<a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line">    <tt class="py-keyword">global</tt> <tt class="py-name">__builtins__</tt> </tt>
<a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-129" class="py-name"><a title="web2py.gluon.compileapp.is_jython" class="py-name" href="#" onclick="return doclink('link-129', 'is_jython', 'link-42');">is_jython</a></tt><tt class="py-op">:</tt> <tt class="py-comment"># jython hack</tt> </tt>
<a name="L267"></a><tt class="py-lineno">267</tt>  <tt class="py-line">        <tt class="py-name">__builtins__</tt> <tt class="py-op">=</tt> <tt id="link-130" class="py-name" targets="Class web2py.gluon.compileapp.mybuiltin=web2py.gluon.compileapp.mybuiltin-class.html"><a title="web2py.gluon.compileapp.mybuiltin" class="py-name" href="#" onclick="return doclink('link-130', 'mybuiltin', 'link-130');">mybuiltin</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L269"></a><tt class="py-lineno">269</tt>  <tt class="py-line">        <tt class="py-name">__builtins__</tt><tt class="py-op">[</tt><tt class="py-string">'__import__'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">__builtin__</tt><tt class="py-op">.</tt><tt class="py-name">__import__</tt> </tt>
<a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'__builtins__'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">__builtins__</tt> </tt>
<a name="L271"></a><tt class="py-lineno">271</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'HTTP'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-131" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-131', 'HTTP', 'link-34');">HTTP</a></tt> </tt>
<a name="L272"></a><tt class="py-lineno">272</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'redirect'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-132" class="py-name"><a title="web2py.gluon.http.redirect" class="py-name" href="#" onclick="return doclink('link-132', 'redirect', 'link-35');">redirect</a></tt> </tt>
<a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt> </tt>
<a name="L274"></a><tt class="py-lineno">274</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'response'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">response</tt> </tt>
<a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'session'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">session</tt> </tt>
<a name="L276"></a><tt class="py-lineno">276</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'DAL'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-133" class="py-name"><a title="web2py.gluon.dal.DAL" class="py-name" href="#" onclick="return doclink('link-133', 'DAL', 'link-19');">DAL</a></tt> </tt>
<a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'Field'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-134" class="py-name"><a title="web2py.gluon.dal.Field" class="py-name" href="#" onclick="return doclink('link-134', 'Field', 'link-20');">Field</a></tt> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'SQLDB'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">SQLDB</tt>        <tt class="py-comment"># for backward compatibility</tt> </tt>
<a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'SQLField'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">SQLField</tt>  <tt class="py-comment"># for backward compatibility</tt> </tt>
<a name="L280"></a><tt class="py-lineno">280</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'SQLFORM'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-135" class="py-name"><a title="web2py.gluon.sqlhtml.SQLFORM" class="py-name" href="#" onclick="return doclink('link-135', 'SQLFORM', 'link-22');">SQLFORM</a></tt> </tt>
<a name="L281"></a><tt class="py-lineno">281</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'SQLTABLE'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-136" class="py-name"><a title="web2py.gluon.sqlhtml.SQLTABLE" class="py-name" href="#" onclick="return doclink('link-136', 'SQLTABLE', 'link-23');">SQLTABLE</a></tt> </tt>
<a name="L282"></a><tt class="py-lineno">282</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'LOAD'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-137" class="py-name" targets="Class web2py.gluon.compileapp.LoadFactory=web2py.gluon.compileapp.LoadFactory-class.html"><a title="web2py.gluon.compileapp.LoadFactory" class="py-name" href="#" onclick="return doclink('link-137', 'LoadFactory', 'link-137');">LoadFactory</a></tt><tt class="py-op">(</tt><tt class="py-name">environment</tt><tt class="py-op">)</tt> </tt>
<a name="L283"></a><tt class="py-lineno">283</tt>  <tt class="py-line">    <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'local_import'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> \ </tt>
<a name="L284"></a><tt class="py-lineno">284</tt>  <tt class="py-line">        <tt class="py-keyword">lambda</tt> <tt id="link-138" class="py-name"><a title="web2py.gluon.import_all.name" class="py-name" href="#" onclick="return doclink('link-138', 'name', 'link-102');">name</a></tt><tt class="py-op">,</tt> <tt class="py-name">reload</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">app</tt><tt class="py-op">=</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">application</tt><tt class="py-op">:</tt>\ </tt>
<a name="L285"></a><tt class="py-lineno">285</tt>  <tt class="py-line">        <tt id="link-139" class="py-name" targets="Function web2py.gluon.compileapp.local_import_aux()=web2py.gluon.compileapp-module.html#local_import_aux"><a title="web2py.gluon.compileapp.local_import_aux" class="py-name" href="#" onclick="return doclink('link-139', 'local_import_aux', 'link-139');">local_import_aux</a></tt><tt class="py-op">(</tt><tt id="link-140" class="py-name"><a title="web2py.gluon.import_all.name" class="py-name" href="#" onclick="return doclink('link-140', 'name', 'link-102');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">reload</tt><tt class="py-op">,</tt><tt class="py-name">app</tt><tt class="py-op">)</tt> </tt>
<a name="L286"></a><tt class="py-lineno">286</tt>  <tt class="py-line">    <tt id="link-141" class="py-name"><a title="web2py.gluon.dal.BaseAdapter" class="py-name" href="#" onclick="return doclink('link-141', 'BaseAdapter', 'link-18');">BaseAdapter</a></tt><tt class="py-op">.</tt><tt id="link-142" class="py-name" targets="Static Method web2py.gluon.dal.ConnectionPool.set_folder()=web2py.gluon.dal.ConnectionPool-class.html#set_folder,Static Method web2py.gluon.dal.DAL.set_folder()=web2py.gluon.dal.DAL-class.html#set_folder"><a title="web2py.gluon.dal.ConnectionPool.set_folder
web2py.gluon.dal.DAL.set_folder" class="py-name" href="#" onclick="return doclink('link-142', 'set_folder', 'link-142');">set_folder</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-143" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-143', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'databases'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L287"></a><tt class="py-lineno">287</tt>  <tt class="py-line">    <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">_view_environment</tt> <tt class="py-op">=</tt> <tt class="py-name">copy</tt><tt class="py-op">.</tt><tt class="py-name">copy</tt><tt class="py-op">(</tt><tt class="py-name">environment</tt><tt class="py-op">)</tt> </tt>
<a name="L288"></a><tt class="py-lineno">288</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">environment</tt> </tt>
</div><a name="L289"></a><tt class="py-lineno">289</tt>  <tt class="py-line"> </tt>
<a name="L290"></a><tt class="py-lineno">290</tt>  <tt class="py-line"> </tt>
<a name="save_pyc"></a><div id="save_pyc-def"><a name="L291"></a><tt class="py-lineno">291</tt> <a class="py-toggle" href="#" id="save_pyc-toggle" onclick="return toggle('save_pyc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#save_pyc">save_pyc</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="save_pyc-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="save_pyc-expanded"><a name="L292"></a><tt class="py-lineno">292</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L293"></a><tt class="py-lineno">293</tt>  <tt class="py-line"><tt class="py-docstring">    Bytecode compiles the file `filename`</tt> </tt>
<a name="L294"></a><tt class="py-lineno">294</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L295"></a><tt class="py-lineno">295</tt>  <tt class="py-line">    <tt class="py-name">py_compile</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
</div><a name="L296"></a><tt class="py-lineno">296</tt>  <tt class="py-line"> </tt>
<a name="L297"></a><tt class="py-lineno">297</tt>  <tt class="py-line"> </tt>
<a name="read_pyc"></a><div id="read_pyc-def"><a name="L298"></a><tt class="py-lineno">298</tt> <a class="py-toggle" href="#" id="read_pyc-toggle" onclick="return toggle('read_pyc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#read_pyc">read_pyc</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="read_pyc-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="read_pyc-expanded"><a name="L299"></a><tt class="py-lineno">299</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L300"></a><tt class="py-lineno">300</tt>  <tt class="py-line"><tt class="py-docstring">    Read the code inside a bytecode compiled file if the MAGIC number is</tt> </tt>
<a name="L301"></a><tt class="py-lineno">301</tt>  <tt class="py-line"><tt class="py-docstring">    compatible</tt> </tt>
<a name="L302"></a><tt class="py-lineno">302</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L303"></a><tt class="py-lineno">303</tt>  <tt class="py-line"><tt class="py-docstring">    :returns: a code object</tt> </tt>
<a name="L304"></a><tt class="py-lineno">304</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L305"></a><tt class="py-lineno">305</tt>  <tt class="py-line">    <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt id="link-144" class="py-name"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-144', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> </tt>
<a name="L306"></a><tt class="py-lineno">306</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-145" class="py-name"><a title="web2py.gluon.compileapp.is_gae
web2py.gluon.languages.is_gae" class="py-name" href="#" onclick="return doclink('link-145', 'is_gae', 'link-39');">is_gae</a></tt> <tt class="py-keyword">and</tt> <tt class="py-name">data</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-name">imp</tt><tt class="py-op">.</tt><tt class="py-name">get_magic</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L307"></a><tt class="py-lineno">307</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">SystemError</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled code is incompatible'</tt> </tt>
<a name="L308"></a><tt class="py-lineno">308</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">marshal</tt><tt class="py-op">.</tt><tt class="py-name">loads</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="L309"></a><tt class="py-lineno">309</tt>  <tt class="py-line"> </tt>
<a name="L310"></a><tt class="py-lineno">310</tt>  <tt class="py-line"> </tt>
<a name="compile_views"></a><div id="compile_views-def"><a name="L311"></a><tt class="py-lineno">311</tt> <a class="py-toggle" href="#" id="compile_views-toggle" onclick="return toggle('compile_views');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#compile_views">compile_views</a><tt class="py-op">(</tt><tt class="py-param">folder</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="compile_views-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="compile_views-expanded"><a name="L312"></a><tt class="py-lineno">312</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L313"></a><tt class="py-lineno">313</tt>  <tt class="py-line"><tt class="py-docstring">    Compiles all the views in the application specified by `folder`</tt> </tt>
<a name="L314"></a><tt class="py-lineno">314</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L315"></a><tt class="py-lineno">315</tt>  <tt class="py-line"> </tt>
<a name="L316"></a><tt class="py-lineno">316</tt>  <tt class="py-line">    <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-146" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-146', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'views'</tt><tt class="py-op">)</tt> </tt>
<a name="L317"></a><tt class="py-lineno">317</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">file</tt> <tt class="py-keyword">in</tt> <tt id="link-147" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-147', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-string">'^[\w/]+\.\w+$'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L318"></a><tt class="py-lineno">318</tt>  <tt class="py-line">        <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt id="link-148" class="py-name"><a title="web2py.gluon.template.parse_template" class="py-name" href="#" onclick="return doclink('link-148', 'parse_template', 'link-4');">parse_template</a></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">)</tt> </tt>
<a name="L319"></a><tt class="py-lineno">319</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">'views/%s.py'</tt> <tt class="py-op">%</tt> <tt class="py-name">file</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'/'</tt><tt class="py-op">,</tt> <tt class="py-string">'_'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'\\'</tt><tt class="py-op">,</tt> <tt class="py-string">'_'</tt><tt class="py-op">)</tt> </tt>
<a name="L320"></a><tt class="py-lineno">320</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-149" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-149', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">,</tt> <tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L321"></a><tt class="py-lineno">321</tt>  <tt class="py-line">        <tt id="link-150" class="py-name"><a title="web2py.gluon.fileutils.write_file" class="py-name" href="#" onclick="return doclink('link-150', 'write_file', 'link-12');">write_file</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
<a name="L322"></a><tt class="py-lineno">322</tt>  <tt class="py-line">        <tt id="link-151" class="py-name" targets="Function web2py.gluon.compileapp.save_pyc()=web2py.gluon.compileapp-module.html#save_pyc"><a title="web2py.gluon.compileapp.save_pyc" class="py-name" href="#" onclick="return doclink('link-151', 'save_pyc', 'link-151');">save_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L323"></a><tt class="py-lineno">323</tt>  <tt class="py-line">        <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
</div><a name="L324"></a><tt class="py-lineno">324</tt>  <tt class="py-line"> </tt>
<a name="L325"></a><tt class="py-lineno">325</tt>  <tt class="py-line"> </tt>
<a name="compile_models"></a><div id="compile_models-def"><a name="L326"></a><tt class="py-lineno">326</tt> <a class="py-toggle" href="#" id="compile_models-toggle" onclick="return toggle('compile_models');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#compile_models">compile_models</a><tt class="py-op">(</tt><tt class="py-param">folder</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="compile_models-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="compile_models-expanded"><a name="L327"></a><tt class="py-lineno">327</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L328"></a><tt class="py-lineno">328</tt>  <tt class="py-line"><tt class="py-docstring">    Compiles all the models in the application specified by `folder`</tt> </tt>
<a name="L329"></a><tt class="py-lineno">329</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L330"></a><tt class="py-lineno">330</tt>  <tt class="py-line"> </tt>
<a name="L331"></a><tt class="py-lineno">331</tt>  <tt class="py-line">    <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-152" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-152', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'models'</tt><tt class="py-op">)</tt> </tt>
<a name="L332"></a><tt class="py-lineno">332</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">file</tt> <tt class="py-keyword">in</tt> <tt id="link-153" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-153', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-string">'.+\.py$'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L333"></a><tt class="py-lineno">333</tt>  <tt class="py-line">        <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt id="link-154" class="py-name"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-154', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-155" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-155', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">file</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L334"></a><tt class="py-lineno">334</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-156" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-156', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">,</tt><tt class="py-string">'models'</tt><tt class="py-op">,</tt><tt class="py-name">file</tt><tt class="py-op">)</tt> </tt>
<a name="L335"></a><tt class="py-lineno">335</tt>  <tt class="py-line">        <tt id="link-157" class="py-name"><a title="web2py.gluon.fileutils.mktree" class="py-name" href="#" onclick="return doclink('link-157', 'mktree', 'link-9');">mktree</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L336"></a><tt class="py-lineno">336</tt>  <tt class="py-line">        <tt id="link-158" class="py-name"><a title="web2py.gluon.fileutils.write_file" class="py-name" href="#" onclick="return doclink('link-158', 'write_file', 'link-12');">write_file</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
<a name="L337"></a><tt class="py-lineno">337</tt>  <tt class="py-line">        <tt id="link-159" class="py-name"><a title="web2py.gluon.compileapp.save_pyc" class="py-name" href="#" onclick="return doclink('link-159', 'save_pyc', 'link-151');">save_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L338"></a><tt class="py-lineno">338</tt>  <tt class="py-line">        <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
</div><a name="L339"></a><tt class="py-lineno">339</tt>  <tt class="py-line"> </tt>
<a name="L340"></a><tt class="py-lineno">340</tt>  <tt class="py-line"> </tt>
<a name="compile_controllers"></a><div id="compile_controllers-def"><a name="L341"></a><tt class="py-lineno">341</tt> <a class="py-toggle" href="#" id="compile_controllers-toggle" onclick="return toggle('compile_controllers');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#compile_controllers">compile_controllers</a><tt class="py-op">(</tt><tt class="py-param">folder</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="compile_controllers-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="compile_controllers-expanded"><a name="L342"></a><tt class="py-lineno">342</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L343"></a><tt class="py-lineno">343</tt>  <tt class="py-line"><tt class="py-docstring">    Compiles all the controllers in the application specified by `folder`</tt> </tt>
<a name="L344"></a><tt class="py-lineno">344</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L345"></a><tt class="py-lineno">345</tt>  <tt class="py-line"> </tt>
<a name="L346"></a><tt class="py-lineno">346</tt>  <tt class="py-line">    <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-160" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-160', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'controllers'</tt><tt class="py-op">)</tt> </tt>
<a name="L347"></a><tt class="py-lineno">347</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">file</tt> <tt class="py-keyword">in</tt> <tt id="link-161" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-161', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-string">'.+\.py$'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L348"></a><tt class="py-lineno">348</tt>  <tt class="py-line">        <tt class="py-comment">### why is this here? save_pyc(os.path.join(path, file))</tt> </tt>
<a name="L349"></a><tt class="py-lineno">349</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt id="link-162" class="py-name"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-162', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-163" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-163', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt><tt class="py-name">file</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L350"></a><tt class="py-lineno">350</tt>  <tt class="py-line">        <tt class="py-name">exposed</tt> <tt class="py-op">=</tt> <tt id="link-164" class="py-name"><a title="web2py.gluon.myregex.regex_expose" class="py-name" href="#" onclick="return doclink('link-164', 'regex_expose', 'link-14');">regex_expose</a></tt><tt class="py-op">.</tt><tt class="py-name">findall</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
<a name="L351"></a><tt class="py-lineno">351</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">function</tt> <tt class="py-keyword">in</tt> <tt class="py-name">exposed</tt><tt class="py-op">:</tt> </tt>
<a name="L352"></a><tt class="py-lineno">352</tt>  <tt class="py-line">            <tt class="py-name">command</tt> <tt class="py-op">=</tt> <tt class="py-name">data</tt> <tt class="py-op">+</tt> <tt class="py-string">"\nresponse._vars=response._caller(%s)\n"</tt> <tt class="py-op">%</tt> \ </tt>
<a name="L353"></a><tt class="py-lineno">353</tt>  <tt class="py-line">                <tt class="py-name">function</tt> </tt>
<a name="L354"></a><tt class="py-lineno">354</tt>  <tt class="py-line">            <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-165" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-165', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-string">'controllers/'</tt> </tt>
<a name="L355"></a><tt class="py-lineno">355</tt>  <tt class="py-line">                                     <tt class="py-op">+</tt> <tt class="py-name">file</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">3</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'/'</tt><tt class="py-op">,</tt> <tt class="py-string">'_'</tt><tt class="py-op">)</tt> </tt>
<a name="L356"></a><tt class="py-lineno">356</tt>  <tt class="py-line">                                     <tt class="py-op">+</tt> <tt class="py-string">'_'</tt> <tt class="py-op">+</tt> <tt class="py-name">function</tt> <tt class="py-op">+</tt> <tt class="py-string">'.py'</tt><tt class="py-op">)</tt> </tt>
<a name="L357"></a><tt class="py-lineno">357</tt>  <tt class="py-line">            <tt id="link-166" class="py-name"><a title="web2py.gluon.fileutils.write_file" class="py-name" href="#" onclick="return doclink('link-166', 'write_file', 'link-12');">write_file</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt class="py-name">command</tt><tt class="py-op">)</tt> </tt>
<a name="L358"></a><tt class="py-lineno">358</tt>  <tt class="py-line">            <tt id="link-167" class="py-name"><a title="web2py.gluon.compileapp.save_pyc" class="py-name" href="#" onclick="return doclink('link-167', 'save_pyc', 'link-151');">save_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L359"></a><tt class="py-lineno">359</tt>  <tt class="py-line">            <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
</div><a name="L360"></a><tt class="py-lineno">360</tt>  <tt class="py-line"> </tt>
<a name="L361"></a><tt class="py-lineno">361</tt>  <tt class="py-line"> </tt>
<a name="run_models_in"></a><div id="run_models_in-def"><a name="L362"></a><tt class="py-lineno">362</tt> <a class="py-toggle" href="#" id="run_models_in-toggle" onclick="return toggle('run_models_in');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#run_models_in">run_models_in</a><tt class="py-op">(</tt><tt class="py-param">environment</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="run_models_in-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="run_models_in-expanded"><a name="L363"></a><tt class="py-lineno">363</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L364"></a><tt class="py-lineno">364</tt>  <tt class="py-line"><tt class="py-docstring">    Runs all models (in the app specified by the current folder)</tt> </tt>
<a name="L365"></a><tt class="py-lineno">365</tt>  <tt class="py-line"><tt class="py-docstring">    It tries pre-compiled models first before compiling them.</tt> </tt>
<a name="L366"></a><tt class="py-lineno">366</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L367"></a><tt class="py-lineno">367</tt>  <tt class="py-line"> </tt>
<a name="L368"></a><tt class="py-lineno">368</tt>  <tt class="py-line">    <tt class="py-name">folder</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">folder</tt> </tt>
<a name="L369"></a><tt class="py-lineno">369</tt>  <tt class="py-line">    <tt class="py-name">c</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">controller</tt> </tt>
<a name="L370"></a><tt class="py-lineno">370</tt>  <tt class="py-line">    <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">function</tt> </tt>
<a name="L371"></a><tt class="py-lineno">371</tt>  <tt class="py-line">    <tt class="py-name">cpath</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-168" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-168', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">)</tt> </tt>
<a name="L372"></a><tt class="py-lineno">372</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-169" class="py-name" targets="Static Method web2py.gluon.dal.DatabaseStoredFile.exists()=web2py.gluon.dal.DatabaseStoredFile-class.html#exists"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-169', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">cpath</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L373"></a><tt class="py-lineno">373</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">model</tt> <tt class="py-keyword">in</tt> <tt id="link-170" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-170', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">cpath</tt><tt class="py-op">,</tt> <tt class="py-string">'^models_\w+\.pyc$'</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L374"></a><tt class="py-lineno">374</tt>  <tt class="py-line">            <tt id="link-171" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-171', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt id="link-172" class="py-name" targets="Function web2py.gluon.compileapp.read_pyc()=web2py.gluon.compileapp-module.html#read_pyc"><a title="web2py.gluon.compileapp.read_pyc" class="py-name" href="#" onclick="return doclink('link-172', 'read_pyc', 'link-172');">read_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">model</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">layer</tt><tt class="py-op">=</tt><tt class="py-name">model</tt><tt class="py-op">)</tt> </tt>
<a name="L375"></a><tt class="py-lineno">375</tt>  <tt class="py-line">        <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-173" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-173', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">cpath</tt><tt class="py-op">,</tt> <tt class="py-string">'models'</tt><tt class="py-op">)</tt> </tt>
<a name="L376"></a><tt class="py-lineno">376</tt>  <tt class="py-line">        <tt class="py-name">models</tt> <tt class="py-op">=</tt> <tt id="link-174" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-174', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-string">'^\w+\.pyc$'</tt><tt class="py-op">,</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt id="link-175" class="py-name" targets="Method web2py.gluon.dal.Rows.sort()=web2py.gluon.dal.Rows-class.html#sort"><a title="web2py.gluon.dal.Rows.sort" class="py-name" href="#" onclick="return doclink('link-175', 'sort', 'link-175');">sort</a></tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
<a name="L377"></a><tt class="py-lineno">377</tt>  <tt class="py-line">        <tt class="py-name">compiled</tt><tt class="py-op">=</tt><tt class="py-name">True</tt> </tt>
<a name="L378"></a><tt class="py-lineno">378</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L379"></a><tt class="py-lineno">379</tt>  <tt class="py-line">        <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-176" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-176', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'models'</tt><tt class="py-op">)</tt> </tt>
<a name="L380"></a><tt class="py-lineno">380</tt>  <tt class="py-line">        <tt class="py-name">models</tt> <tt class="py-op">=</tt> <tt id="link-177" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-177', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-string">'^\w+\.py$'</tt><tt class="py-op">,</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt id="link-178" class="py-name"><a title="web2py.gluon.dal.Rows.sort" class="py-name" href="#" onclick="return doclink('link-178', 'sort', 'link-175');">sort</a></tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
<a name="L381"></a><tt class="py-lineno">381</tt>  <tt class="py-line">        <tt class="py-name">compiled</tt><tt class="py-op">=</tt><tt class="py-name">False</tt> </tt>
<a name="L382"></a><tt class="py-lineno">382</tt>  <tt class="py-line">    <tt class="py-name">paths</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-179" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-179', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt><tt class="py-name">c</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-180" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-180', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt><tt class="py-name">c</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L383"></a><tt class="py-lineno">383</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">model</tt> <tt class="py-keyword">in</tt> <tt class="py-name">models</tt><tt class="py-op">:</tt> </tt>
<a name="L384"></a><tt class="py-lineno">384</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-name">model</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">in</tt> <tt class="py-name">paths</tt> <tt class="py-keyword">and</tt> <tt class="py-name">c</tt><tt class="py-op">!=</tt><tt class="py-string">'appadmin'</tt><tt class="py-op">:</tt> </tt>
<a name="L385"></a><tt class="py-lineno">385</tt>  <tt class="py-line">            <tt class="py-keyword">continue</tt> </tt>
<a name="L386"></a><tt class="py-lineno">386</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">compiled</tt><tt class="py-op">:</tt> </tt>
<a name="L387"></a><tt class="py-lineno">387</tt>  <tt class="py-line">            <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-181" class="py-name"><a title="web2py.gluon.compileapp.read_pyc" class="py-name" href="#" onclick="return doclink('link-181', 'read_pyc', 'link-172');">read_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">model</tt><tt class="py-op">)</tt> </tt>
<a name="L388"></a><tt class="py-lineno">388</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt id="link-182" class="py-name"><a title="web2py.gluon.compileapp.is_gae
web2py.gluon.languages.is_gae" class="py-name" href="#" onclick="return doclink('link-182', 'is_gae', 'link-39');">is_gae</a></tt><tt class="py-op">:</tt> </tt>
<a name="L389"></a><tt class="py-lineno">389</tt>  <tt class="py-line">            <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-183" class="py-name"><a title="web2py.gluon.cfs.getcfs" class="py-name" href="#" onclick="return doclink('link-183', 'getcfs', 'link-30');">getcfs</a></tt><tt class="py-op">(</tt><tt class="py-name">model</tt><tt class="py-op">,</tt> <tt class="py-name">model</tt><tt class="py-op">,</tt> </tt>
<a name="L390"></a><tt class="py-lineno">390</tt>  <tt class="py-line">                          <tt class="py-keyword">lambda</tt><tt class="py-op">:</tt> <tt id="link-184" class="py-name"><a title="web2py.gluon.restricted.compile2" class="py-name" href="#" onclick="return doclink('link-184', 'compile2', 'link-7');">compile2</a></tt><tt class="py-op">(</tt><tt id="link-185" class="py-name"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-185', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt class="py-name">model</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">model</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L391"></a><tt class="py-lineno">391</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L392"></a><tt class="py-lineno">392</tt>  <tt class="py-line">            <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-186" class="py-name"><a title="web2py.gluon.cfs.getcfs" class="py-name" href="#" onclick="return doclink('link-186', 'getcfs', 'link-30');">getcfs</a></tt><tt class="py-op">(</tt><tt class="py-name">model</tt><tt class="py-op">,</tt> <tt class="py-name">model</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L393"></a><tt class="py-lineno">393</tt>  <tt class="py-line">        <tt id="link-187" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-187', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">layer</tt><tt class="py-op">=</tt><tt class="py-name">model</tt><tt class="py-op">)</tt> </tt>
</div><a name="L394"></a><tt class="py-lineno">394</tt>  <tt class="py-line"> </tt>
<a name="L395"></a><tt class="py-lineno">395</tt>  <tt class="py-line"> </tt>
<a name="run_controller_in"></a><div id="run_controller_in-def"><a name="L396"></a><tt class="py-lineno">396</tt> <a class="py-toggle" href="#" id="run_controller_in-toggle" onclick="return toggle('run_controller_in');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#run_controller_in">run_controller_in</a><tt class="py-op">(</tt><tt class="py-param">controller</tt><tt class="py-op">,</tt> <tt class="py-param">function</tt><tt class="py-op">,</tt> <tt class="py-param">environment</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="run_controller_in-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="run_controller_in-expanded"><a name="L397"></a><tt class="py-lineno">397</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L398"></a><tt class="py-lineno">398</tt>  <tt class="py-line"><tt class="py-docstring">    Runs the controller.function() (for the app specified by</tt> </tt>
<a name="L399"></a><tt class="py-lineno">399</tt>  <tt class="py-line"><tt class="py-docstring">    the current folder).</tt> </tt>
<a name="L400"></a><tt class="py-lineno">400</tt>  <tt class="py-line"><tt class="py-docstring">    It tries pre-compiled controller_function.pyc first before compiling it.</tt> </tt>
<a name="L401"></a><tt class="py-lineno">401</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L402"></a><tt class="py-lineno">402</tt>  <tt class="py-line"> </tt>
<a name="L403"></a><tt class="py-lineno">403</tt>  <tt class="py-line">    <tt class="py-comment"># if compiled should run compiled!</tt> </tt>
<a name="L404"></a><tt class="py-lineno">404</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L405"></a><tt class="py-lineno">405</tt>  <tt class="py-line">    <tt class="py-name">folder</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">folder</tt> </tt>
<a name="L406"></a><tt class="py-lineno">406</tt>  <tt class="py-line">    <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-188" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-188', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">)</tt> </tt>
<a name="L407"></a><tt class="py-lineno">407</tt>  <tt class="py-line">    <tt class="py-name">badc</tt> <tt class="py-op">=</tt> <tt class="py-string">'invalid controller (%s/%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">controller</tt><tt class="py-op">,</tt> <tt class="py-name">function</tt><tt class="py-op">)</tt> </tt>
<a name="L408"></a><tt class="py-lineno">408</tt>  <tt class="py-line">    <tt class="py-name">badf</tt> <tt class="py-op">=</tt> <tt class="py-string">'invalid function (%s/%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">controller</tt><tt class="py-op">,</tt> <tt class="py-name">function</tt><tt class="py-op">)</tt> </tt>
<a name="L409"></a><tt class="py-lineno">409</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-189" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-189', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L410"></a><tt class="py-lineno">410</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-190" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-190', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-string">'controllers_%s_%s.pyc'</tt> </tt>
<a name="L411"></a><tt class="py-lineno">411</tt>  <tt class="py-line">                                 <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">controller</tt><tt class="py-op">,</tt> <tt class="py-name">function</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L412"></a><tt class="py-lineno">412</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-191" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-191', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L413"></a><tt class="py-lineno">413</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-192" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-192', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">(</tt><tt class="py-number">404</tt><tt class="py-op">,</tt> </tt>
<a name="L414"></a><tt class="py-lineno">414</tt>  <tt class="py-line">                       <tt id="link-193" class="py-name"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-193', 'rewrite', 'link-37');">rewrite</a></tt><tt class="py-op">.</tt><tt id="link-194" class="py-name" targets="Variable web2py.gluon.dal.thread=web2py.gluon.dal-module.html#thread,Variable web2py.gluon.rewrite.thread=web2py.gluon.rewrite-module.html#thread"><a title="web2py.gluon.dal.thread
web2py.gluon.rewrite.thread" class="py-name" href="#" onclick="return doclink('link-194', 'thread', 'link-194');">thread</a></tt><tt class="py-op">.</tt><tt class="py-name">routes</tt><tt class="py-op">.</tt><tt class="py-name">error_message</tt> <tt class="py-op">%</tt> <tt class="py-name">badf</tt><tt class="py-op">,</tt> </tt>
<a name="L415"></a><tt class="py-lineno">415</tt>  <tt class="py-line">                       <tt class="py-name">web2py_error</tt><tt class="py-op">=</tt><tt class="py-name">badf</tt><tt class="py-op">)</tt> </tt>
<a name="L416"></a><tt class="py-lineno">416</tt>  <tt class="py-line">        <tt id="link-195" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-195', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt id="link-196" class="py-name"><a title="web2py.gluon.compileapp.read_pyc" class="py-name" href="#" onclick="return doclink('link-196', 'read_pyc', 'link-172');">read_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">layer</tt><tt class="py-op">=</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L417"></a><tt class="py-lineno">417</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">function</tt> <tt class="py-op">==</tt> <tt class="py-string">'_TEST'</tt><tt class="py-op">:</tt> </tt>
<a name="L418"></a><tt class="py-lineno">418</tt>  <tt class="py-line">        <tt class="py-comment"># TESTING: adjust the path to include site packages</tt> </tt>
<a name="L419"></a><tt class="py-lineno">419</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">from</tt> <tt id="link-197" class="py-name"><a title="web2py.gluon.settings
web2py.gluon.settings.settings" class="py-name" href="#" onclick="return doclink('link-197', 'settings', 'link-28');">settings</a></tt> <tt class="py-keyword">import</tt> <tt id="link-198" class="py-name"><a title="web2py.gluon.settings.global_settings" class="py-name" href="#" onclick="return doclink('link-198', 'global_settings', 'link-41');">global_settings</a></tt> </tt>
<a name="L420"></a><tt class="py-lineno">420</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt id="link-199" class="py-name" targets="Module web2py.gluon.admin=web2py.gluon.admin-module.html"><a title="web2py.gluon.admin" class="py-name" href="#" onclick="return doclink('link-199', 'admin', 'link-199');">admin</a></tt> <tt class="py-keyword">import</tt> <tt id="link-200" class="py-name" targets="Function web2py.gluon.fileutils.abspath()=web2py.gluon.fileutils-module.html#abspath"><a title="web2py.gluon.fileutils.abspath" class="py-name" href="#" onclick="return doclink('link-200', 'abspath', 'link-200');">abspath</a></tt><tt class="py-op">,</tt> <tt id="link-201" class="py-name" targets="Function web2py.gluon.admin.add_path_first()=web2py.gluon.admin-module.html#add_path_first"><a title="web2py.gluon.admin.add_path_first" class="py-name" href="#" onclick="return doclink('link-201', 'add_path_first', 'link-201');">add_path_first</a></tt> </tt>
<a name="L421"></a><tt class="py-lineno">421</tt>  <tt class="py-line">        <tt class="py-name">paths</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt id="link-202" class="py-name"><a title="web2py.gluon.settings.global_settings" class="py-name" href="#" onclick="return doclink('link-202', 'global_settings', 'link-41');">global_settings</a></tt><tt class="py-op">.</tt><tt class="py-name">gluon_parent</tt><tt class="py-op">,</tt> <tt id="link-203" class="py-name"><a title="web2py.gluon.fileutils.abspath" class="py-name" href="#" onclick="return doclink('link-203', 'abspath', 'link-200');">abspath</a></tt><tt class="py-op">(</tt><tt class="py-string">'site-packages'</tt><tt class="py-op">,</tt> <tt id="link-204" class="py-name" targets="Package web2py.gluon=web2py.gluon-module.html"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-204', 'gluon', 'link-204');">gluon</a></tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">,</tt>  <tt id="link-205" class="py-name"><a title="web2py.gluon.fileutils.abspath" class="py-name" href="#" onclick="return doclink('link-205', 'abspath', 'link-200');">abspath</a></tt><tt class="py-op">(</tt><tt class="py-string">'gluon'</tt><tt class="py-op">,</tt> <tt id="link-206" class="py-name"><a title="web2py.gluon" class="py-name" href="#" onclick="return doclink('link-206', 'gluon', 'link-204');">gluon</a></tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L422"></a><tt class="py-lineno">422</tt>  <tt class="py-line">        <tt class="py-op">[</tt><tt id="link-207" class="py-name"><a title="web2py.gluon.admin.add_path_first" class="py-name" href="#" onclick="return doclink('link-207', 'add_path_first', 'link-201');">add_path_first</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">path</tt> <tt class="py-keyword">in</tt> <tt class="py-name">paths</tt><tt class="py-op">]</tt> </tt>
<a name="L423"></a><tt class="py-lineno">423</tt>  <tt class="py-line">        <tt class="py-comment"># TESTING END</tt> </tt>
<a name="L424"></a><tt class="py-lineno">424</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L425"></a><tt class="py-lineno">425</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-208" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-208', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'controllers/%s.py'</tt> </tt>
<a name="L426"></a><tt class="py-lineno">426</tt>  <tt class="py-line">                                 <tt class="py-op">%</tt> <tt class="py-name">controller</tt><tt class="py-op">)</tt> </tt>
<a name="L427"></a><tt class="py-lineno">427</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-209" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-209', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L428"></a><tt class="py-lineno">428</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-210" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-210', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">(</tt><tt class="py-number">404</tt><tt class="py-op">,</tt> </tt>
<a name="L429"></a><tt class="py-lineno">429</tt>  <tt class="py-line">                       <tt id="link-211" class="py-name"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-211', 'rewrite', 'link-37');">rewrite</a></tt><tt class="py-op">.</tt><tt id="link-212" class="py-name"><a title="web2py.gluon.dal.thread
web2py.gluon.rewrite.thread" class="py-name" href="#" onclick="return doclink('link-212', 'thread', 'link-194');">thread</a></tt><tt class="py-op">.</tt><tt class="py-name">routes</tt><tt class="py-op">.</tt><tt class="py-name">error_message</tt> <tt class="py-op">%</tt> <tt class="py-name">badc</tt><tt class="py-op">,</tt> </tt>
<a name="L430"></a><tt class="py-lineno">430</tt>  <tt class="py-line">                       <tt class="py-name">web2py_error</tt><tt class="py-op">=</tt><tt class="py-name">badc</tt><tt class="py-op">)</tt> </tt>
<a name="L431"></a><tt class="py-lineno">431</tt>  <tt class="py-line">        <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'__symbols__'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">.</tt><tt id="link-213" class="py-name" targets="Method web2py.gluon.rocket.Headers.keys()=web2py.gluon.rocket.Headers-class.html#keys,Method web2py.gluon.tools.PluginManager.keys()=web2py.gluon.tools.PluginManager-class.html#keys"><a title="web2py.gluon.rocket.Headers.keys
web2py.gluon.tools.PluginManager.keys" class="py-name" href="#" onclick="return doclink('link-213', 'keys', 'link-213');">keys</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L432"></a><tt class="py-lineno">432</tt>  <tt class="py-line">        <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-214" class="py-name"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-214', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L433"></a><tt class="py-lineno">433</tt>  <tt class="py-line">        <tt class="py-name">code</tt> <tt class="py-op">+=</tt> <tt id="link-215" class="py-name"><a title="web2py.gluon.compileapp.TEST_CODE" class="py-name" href="#" onclick="return doclink('link-215', 'TEST_CODE', 'link-48');">TEST_CODE</a></tt> </tt>
<a name="L434"></a><tt class="py-lineno">434</tt>  <tt class="py-line">        <tt id="link-216" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-216', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">layer</tt><tt class="py-op">=</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L435"></a><tt class="py-lineno">435</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L436"></a><tt class="py-lineno">436</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-217" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-217', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'controllers/%s.py'</tt> </tt>
<a name="L437"></a><tt class="py-lineno">437</tt>  <tt class="py-line">                                 <tt class="py-op">%</tt> <tt class="py-name">controller</tt><tt class="py-op">)</tt> </tt>
<a name="L438"></a><tt class="py-lineno">438</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-218" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-218', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L439"></a><tt class="py-lineno">439</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-219" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-219', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">(</tt><tt class="py-number">404</tt><tt class="py-op">,</tt> </tt>
<a name="L440"></a><tt class="py-lineno">440</tt>  <tt class="py-line">                       <tt id="link-220" class="py-name"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-220', 'rewrite', 'link-37');">rewrite</a></tt><tt class="py-op">.</tt><tt id="link-221" class="py-name"><a title="web2py.gluon.dal.thread
web2py.gluon.rewrite.thread" class="py-name" href="#" onclick="return doclink('link-221', 'thread', 'link-194');">thread</a></tt><tt class="py-op">.</tt><tt class="py-name">routes</tt><tt class="py-op">.</tt><tt class="py-name">error_message</tt> <tt class="py-op">%</tt> <tt class="py-name">badc</tt><tt class="py-op">,</tt> </tt>
<a name="L441"></a><tt class="py-lineno">441</tt>  <tt class="py-line">                       <tt class="py-name">web2py_error</tt><tt class="py-op">=</tt><tt class="py-name">badc</tt><tt class="py-op">)</tt> </tt>
<a name="L442"></a><tt class="py-lineno">442</tt>  <tt class="py-line">        <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-222" class="py-name"><a title="web2py.gluon.fileutils.read_file" class="py-name" href="#" onclick="return doclink('link-222', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L443"></a><tt class="py-lineno">443</tt>  <tt class="py-line">        <tt class="py-name">exposed</tt> <tt class="py-op">=</tt> <tt id="link-223" class="py-name"><a title="web2py.gluon.myregex.regex_expose" class="py-name" href="#" onclick="return doclink('link-223', 'regex_expose', 'link-14');">regex_expose</a></tt><tt class="py-op">.</tt><tt class="py-name">findall</tt><tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">)</tt> </tt>
<a name="L444"></a><tt class="py-lineno">444</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">function</tt> <tt class="py-keyword">in</tt> <tt class="py-name">exposed</tt><tt class="py-op">:</tt> </tt>
<a name="L445"></a><tt class="py-lineno">445</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-224" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-224', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">(</tt><tt class="py-number">404</tt><tt class="py-op">,</tt> </tt>
<a name="L446"></a><tt class="py-lineno">446</tt>  <tt class="py-line">                       <tt id="link-225" class="py-name"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-225', 'rewrite', 'link-37');">rewrite</a></tt><tt class="py-op">.</tt><tt id="link-226" class="py-name"><a title="web2py.gluon.dal.thread
web2py.gluon.rewrite.thread" class="py-name" href="#" onclick="return doclink('link-226', 'thread', 'link-194');">thread</a></tt><tt class="py-op">.</tt><tt class="py-name">routes</tt><tt class="py-op">.</tt><tt class="py-name">error_message</tt> <tt class="py-op">%</tt> <tt class="py-name">badf</tt><tt class="py-op">,</tt> </tt>
<a name="L447"></a><tt class="py-lineno">447</tt>  <tt class="py-line">                       <tt class="py-name">web2py_error</tt><tt class="py-op">=</tt><tt class="py-name">badf</tt><tt class="py-op">)</tt> </tt>
<a name="L448"></a><tt class="py-lineno">448</tt>  <tt class="py-line">        <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt class="py-string">"%s\nresponse._vars=response._caller(%s)\n"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">,</tt> <tt class="py-name">function</tt><tt class="py-op">)</tt> </tt>
<a name="L449"></a><tt class="py-lineno">449</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-227" class="py-name"><a title="web2py.gluon.compileapp.is_gae
web2py.gluon.languages.is_gae" class="py-name" href="#" onclick="return doclink('link-227', 'is_gae', 'link-39');">is_gae</a></tt><tt class="py-op">:</tt> </tt>
<a name="L450"></a><tt class="py-lineno">450</tt>  <tt class="py-line">            <tt class="py-name">layer</tt> <tt class="py-op">=</tt> <tt class="py-name">filename</tt> <tt class="py-op">+</tt> <tt class="py-string">':'</tt> <tt class="py-op">+</tt> <tt class="py-name">function</tt> </tt>
<a name="L451"></a><tt class="py-lineno">451</tt>  <tt class="py-line">            <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-228" class="py-name"><a title="web2py.gluon.cfs.getcfs" class="py-name" href="#" onclick="return doclink('link-228', 'getcfs', 'link-30');">getcfs</a></tt><tt class="py-op">(</tt><tt class="py-name">layer</tt><tt class="py-op">,</tt> <tt class="py-name">filename</tt><tt class="py-op">,</tt>  <tt class="py-keyword">lambda</tt><tt class="py-op">:</tt> <tt id="link-229" class="py-name"><a title="web2py.gluon.restricted.compile2" class="py-name" href="#" onclick="return doclink('link-229', 'compile2', 'link-7');">compile2</a></tt><tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">,</tt><tt class="py-name">layer</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L452"></a><tt class="py-lineno">452</tt>  <tt class="py-line">        <tt id="link-230" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-230', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L453"></a><tt class="py-lineno">453</tt>  <tt class="py-line">    <tt class="py-name">response</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'response'</tt><tt class="py-op">]</tt> </tt>
<a name="L454"></a><tt class="py-lineno">454</tt>  <tt class="py-line">    <tt class="py-name">vars</tt><tt class="py-op">=</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">_vars</tt> </tt>
<a name="L455"></a><tt class="py-lineno">455</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">postprocessing</tt><tt class="py-op">:</tt> </tt>
<a name="L456"></a><tt class="py-lineno">456</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">p</tt> <tt class="py-keyword">in</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">postprocessing</tt><tt class="py-op">:</tt> </tt>
<a name="L457"></a><tt class="py-lineno">457</tt>  <tt class="py-line">            <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">p</tt><tt class="py-op">(</tt><tt class="py-name">vars</tt><tt class="py-op">)</tt> </tt>
<a name="L458"></a><tt class="py-lineno">458</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt><tt class="py-name">unicode</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L459"></a><tt class="py-lineno">459</tt>  <tt class="py-line">        <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">vars</tt><tt class="py-op">.</tt><tt id="link-231" class="py-name" targets="Method web2py.gluon.languages.lazyT.encode()=web2py.gluon.languages.lazyT-class.html#encode"><a title="web2py.gluon.languages.lazyT.encode" class="py-name" href="#" onclick="return doclink('link-231', 'encode', 'link-231');">encode</a></tt><tt class="py-op">(</tt><tt class="py-string">'utf8'</tt><tt class="py-op">)</tt> </tt>
<a name="L460"></a><tt class="py-lineno">460</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">vars</tt><tt class="py-op">,</tt><tt class="py-string">'xml'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L461"></a><tt class="py-lineno">461</tt>  <tt class="py-line">        <tt class="py-name">vars</tt> <tt class="py-op">=</tt> <tt class="py-name">vars</tt><tt class="py-op">.</tt><tt id="link-232" class="py-name" targets="Method web2py.gluon.dal.Rows.xml()=web2py.gluon.dal.Rows-class.html#xml,Method web2py.gluon.html.A.xml()=web2py.gluon.html.A-class.html#xml,Method web2py.gluon.html.CODE.xml()=web2py.gluon.html.CODE-class.html#xml,Method web2py.gluon.html.DIV.xml()=web2py.gluon.html.DIV-class.html#xml,Method web2py.gluon.html.FORM.xml()=web2py.gluon.html.FORM-class.html#xml,Method web2py.gluon.html.HTML.xml()=web2py.gluon.html.HTML-class.html#xml,Method web2py.gluon.html.INPUT.xml()=web2py.gluon.html.INPUT-class.html#xml,Method web2py.gluon.html.MARKMIN.xml()=web2py.gluon.html.MARKMIN-class.html#xml,Method web2py.gluon.html.MENU.xml()=web2py.gluon.html.MENU-class.html#xml,Method web2py.gluon.html.P.xml()=web2py.gluon.html.P-class.html#xml,Method web2py.gluon.html.SCRIPT.xml()=web2py.gluon.html.SCRIPT-class.html#xml,Method web2py.gluon.html.STYLE.xml()=web2py.gluon.html.STYLE-class.html#xml,Method web2py.gluon.html.XHTML.xml()=web2py.gluon.html.XHTML-class.html#xml,Method web2py.gluon.html.XML.xml()=web2py.gluon.html.XML-class.html#xml,Method web2py.gluon.html.XmlComponent.xml()=web2py.gluon.html.XmlComponent-class.html#xml,Method web2py.gluon.languages.lazyT.xml()=web2py.gluon.languages.lazyT-class.html#xml,Function web2py.gluon.serializers.xml()=web2py.gluon.serializers-module.html#xml,Method web2py.gluon.tools.Recaptcha.xml()=web2py.gluon.tools.Recaptcha-class.html#xml,Method web2py.gluon.tools.Service.xml()=web2py.gluon.tools.Service-class.html#xml"><a title="web2py.gluon.dal.Rows.xml
web2py.gluon.html.A.xml
web2py.gluon.html.CODE.xml
web2py.gluon.html.DIV.xml
web2py.gluon.html.FORM.xml
web2py.gluon.html.HTML.xml
web2py.gluon.html.INPUT.xml
web2py.gluon.html.MARKMIN.xml
web2py.gluon.html.MENU.xml
web2py.gluon.html.P.xml
web2py.gluon.html.SCRIPT.xml
web2py.gluon.html.STYLE.xml
web2py.gluon.html.XHTML.xml
web2py.gluon.html.XML.xml
web2py.gluon.html.XmlComponent.xml
web2py.gluon.languages.lazyT.xml
web2py.gluon.serializers.xml
web2py.gluon.tools.Recaptcha.xml
web2py.gluon.tools.Service.xml" class="py-name" href="#" onclick="return doclink('link-232', 'xml', 'link-232');">xml</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L462"></a><tt class="py-lineno">462</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">vars</tt> </tt>
</div><a name="L463"></a><tt class="py-lineno">463</tt>  <tt class="py-line"> </tt>
<a name="run_view_in"></a><div id="run_view_in-def"><a name="L464"></a><tt class="py-lineno">464</tt> <a class="py-toggle" href="#" id="run_view_in-toggle" onclick="return toggle('run_view_in');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#run_view_in">run_view_in</a><tt class="py-op">(</tt><tt class="py-param">environment</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="run_view_in-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="run_view_in-expanded"><a name="L465"></a><tt class="py-lineno">465</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L466"></a><tt class="py-lineno">466</tt>  <tt class="py-line"><tt class="py-docstring">    Executes the view for the requested action.</tt> </tt>
<a name="L467"></a><tt class="py-lineno">467</tt>  <tt class="py-line"><tt class="py-docstring">    The view is the one specified in `response.view` or determined by the url</tt> </tt>
<a name="L468"></a><tt class="py-lineno">468</tt>  <tt class="py-line"><tt class="py-docstring">    or `view/generic.extension`</tt> </tt>
<a name="L469"></a><tt class="py-lineno">469</tt>  <tt class="py-line"><tt class="py-docstring">    It tries the pre-compiled views_controller_function.pyc before compiling it.</tt> </tt>
<a name="L470"></a><tt class="py-lineno">470</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L471"></a><tt class="py-lineno">471</tt>  <tt class="py-line"> </tt>
<a name="L472"></a><tt class="py-lineno">472</tt>  <tt class="py-line">    <tt class="py-name">request</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'request'</tt><tt class="py-op">]</tt> </tt>
<a name="L473"></a><tt class="py-lineno">473</tt>  <tt class="py-line">    <tt class="py-name">response</tt> <tt class="py-op">=</tt> <tt class="py-name">environment</tt><tt class="py-op">[</tt><tt class="py-string">'response'</tt><tt class="py-op">]</tt> </tt>
<a name="L474"></a><tt class="py-lineno">474</tt>  <tt class="py-line">    <tt class="py-name">folder</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">folder</tt> </tt>
<a name="L475"></a><tt class="py-lineno">475</tt>  <tt class="py-line">    <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-233" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-233', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">)</tt> </tt>
<a name="L476"></a><tt class="py-lineno">476</tt>  <tt class="py-line">    <tt class="py-name">badv</tt> <tt class="py-op">=</tt> <tt class="py-string">'invalid view (%s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt> </tt>
<a name="L477"></a><tt class="py-lineno">477</tt>  <tt class="py-line">    <tt class="py-name">patterns</tt> <tt class="py-op">=</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">generic_patterns</tt> <tt class="py-keyword">or</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L478"></a><tt class="py-lineno">478</tt>  <tt class="py-line">    <tt id="link-234" class="py-name" targets="Variable web2py.gluon.validators.IS_EMAIL.regex=web2py.gluon.validators.IS_EMAIL-class.html#regex,Variable web2py.gluon.validators.IS_IPV4.regex=web2py.gluon.validators.IS_IPV4-class.html#regex"><a title="web2py.gluon.validators.IS_EMAIL.regex
web2py.gluon.validators.IS_IPV4.regex" class="py-name" href="#" onclick="return doclink('link-234', 'regex', 'link-234');">regex</a></tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">'|'</tt><tt class="py-op">.</tt><tt id="link-235" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-235', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">fnmatch</tt><tt class="py-op">.</tt><tt id="link-236" class="py-name" targets="Method web2py.gluon.languages.translator.translate()=web2py.gluon.languages.translator-class.html#translate,Function web2py.gluon.validators.translate()=web2py.gluon.validators-module.html#translate"><a title="web2py.gluon.languages.translator.translate
web2py.gluon.validators.translate" class="py-name" href="#" onclick="return doclink('link-236', 'translate', 'link-236');">translate</a></tt><tt class="py-op">(</tt><tt class="py-name">r</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">r</tt> <tt class="py-keyword">in</tt> <tt class="py-name">patterns</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L479"></a><tt class="py-lineno">479</tt>  <tt class="py-line">    <tt class="py-name">short_action</tt> <tt class="py-op">=</tt>  <tt class="py-string">'%(controller)s/%(function)s.%(extension)s'</tt> <tt class="py-op">%</tt> <tt class="py-name">request</tt> </tt>
<a name="L480"></a><tt class="py-lineno">480</tt>  <tt class="py-line">    <tt class="py-name">allow_generic</tt> <tt class="py-op">=</tt> <tt class="py-name">patterns</tt> <tt class="py-keyword">and</tt> <tt id="link-237" class="py-name"><a title="web2py.gluon.validators.IS_EMAIL.regex
web2py.gluon.validators.IS_IPV4.regex" class="py-name" href="#" onclick="return doclink('link-237', 'regex', 'link-234');">regex</a></tt><tt class="py-op">.</tt><tt id="link-238" class="py-name" targets="Method web2py.gluon.tools.Crud.search()=web2py.gluon.tools.Crud-class.html#search"><a title="web2py.gluon.tools.Crud.search" class="py-name" href="#" onclick="return doclink('link-238', 'search', 'link-238');">search</a></tt><tt class="py-op">(</tt><tt class="py-name">short_action</tt><tt class="py-op">)</tt> </tt>
<a name="L481"></a><tt class="py-lineno">481</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L482"></a><tt class="py-lineno">482</tt>  <tt class="py-line">        <tt class="py-name">ccode</tt> <tt class="py-op">=</tt> <tt id="link-239" class="py-name"><a title="web2py.gluon.template.parse_template" class="py-name" href="#" onclick="return doclink('link-239', 'parse_template', 'link-4');">parse_template</a></tt><tt class="py-op">(</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-240" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-240', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'views'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L483"></a><tt class="py-lineno">483</tt>  <tt class="py-line">                               <tt class="py-name">context</tt><tt class="py-op">=</tt><tt class="py-name">environment</tt><tt class="py-op">)</tt> </tt>
<a name="L484"></a><tt class="py-lineno">484</tt>  <tt class="py-line">        <tt id="link-241" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-241', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt class="py-name">ccode</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-string">'file stream'</tt><tt class="py-op">)</tt> </tt>
<a name="L485"></a><tt class="py-lineno">485</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-242" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-242', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L486"></a><tt class="py-lineno">486</tt>  <tt class="py-line">        <tt id="link-243" class="py-name" targets="Variable sqlite3.dbapi2.x=sqlite3.dbapi2-module.html#x"><a title="sqlite3.dbapi2.x" class="py-name" href="#" onclick="return doclink('link-243', 'x', 'link-243');">x</a></tt> <tt class="py-op">=</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'/'</tt><tt class="py-op">,</tt> <tt class="py-string">'_'</tt><tt class="py-op">)</tt> </tt>
<a name="L487"></a><tt class="py-lineno">487</tt>  <tt class="py-line">        <tt id="link-244" class="py-name" targets="Variable web2py.gluon.import_all.files=web2py.gluon.import_all-module.html#files"><a title="web2py.gluon.import_all.files" class="py-name" href="#" onclick="return doclink('link-244', 'files', 'link-244');">files</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">'views_%s.pyc'</tt> <tt class="py-op">%</tt> <tt id="link-245" class="py-name"><a title="sqlite3.dbapi2.x" class="py-name" href="#" onclick="return doclink('link-245', 'x', 'link-243');">x</a></tt><tt class="py-op">]</tt> </tt>
<a name="L488"></a><tt class="py-lineno">488</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">allow_generic</tt><tt class="py-op">:</tt> </tt>
<a name="L489"></a><tt class="py-lineno">489</tt>  <tt class="py-line">            <tt id="link-246" class="py-name"><a title="web2py.gluon.import_all.files" class="py-name" href="#" onclick="return doclink('link-246', 'files', 'link-244');">files</a></tt><tt class="py-op">.</tt><tt id="link-247" class="py-name" targets="Method web2py.gluon.html.DIV.append()=web2py.gluon.html.DIV-class.html#append,Method web2py.gluon.template.BlockNode.append()=web2py.gluon.template.BlockNode-class.html#append,Method web2py.gluon.template.Content.append()=web2py.gluon.template.Content-class.html#append"><a title="web2py.gluon.html.DIV.append
web2py.gluon.template.BlockNode.append
web2py.gluon.template.Content.append" class="py-name" href="#" onclick="return doclink('link-247', 'append', 'link-247');">append</a></tt><tt class="py-op">(</tt><tt class="py-string">'views_generic.%s.pyc'</tt> <tt class="py-op">%</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">extension</tt><tt class="py-op">)</tt> </tt>
<a name="L490"></a><tt class="py-lineno">490</tt>  <tt class="py-line">        <tt class="py-comment"># for backward compatibility</tt> </tt>
<a name="L491"></a><tt class="py-lineno">491</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">extension</tt> <tt class="py-op">==</tt> <tt class="py-string">'html'</tt><tt class="py-op">:</tt> </tt>
<a name="L492"></a><tt class="py-lineno">492</tt>  <tt class="py-line">            <tt id="link-248" class="py-name"><a title="web2py.gluon.import_all.files" class="py-name" href="#" onclick="return doclink('link-248', 'files', 'link-244');">files</a></tt><tt class="py-op">.</tt><tt id="link-249" class="py-name"><a title="web2py.gluon.html.DIV.append
web2py.gluon.template.BlockNode.append
web2py.gluon.template.Content.append" class="py-name" href="#" onclick="return doclink('link-249', 'append', 'link-247');">append</a></tt><tt class="py-op">(</tt><tt class="py-string">'views_%s.pyc'</tt> <tt class="py-op">%</tt> <tt id="link-250" class="py-name"><a title="sqlite3.dbapi2.x" class="py-name" href="#" onclick="return doclink('link-250', 'x', 'link-243');">x</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">5</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L493"></a><tt class="py-lineno">493</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">allow_generic</tt><tt class="py-op">:</tt> </tt>
<a name="L494"></a><tt class="py-lineno">494</tt>  <tt class="py-line">                <tt id="link-251" class="py-name"><a title="web2py.gluon.import_all.files" class="py-name" href="#" onclick="return doclink('link-251', 'files', 'link-244');">files</a></tt><tt class="py-op">.</tt><tt id="link-252" class="py-name"><a title="web2py.gluon.html.DIV.append
web2py.gluon.template.BlockNode.append
web2py.gluon.template.Content.append" class="py-name" href="#" onclick="return doclink('link-252', 'append', 'link-247');">append</a></tt><tt class="py-op">(</tt><tt class="py-string">'views_generic.pyc'</tt><tt class="py-op">)</tt> </tt>
<a name="L495"></a><tt class="py-lineno">495</tt>  <tt class="py-line">        <tt class="py-comment"># end backward compatibility code</tt> </tt>
<a name="L496"></a><tt class="py-lineno">496</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">for</tt> <tt class="py-name">f</tt> <tt class="py-keyword">in</tt> <tt id="link-253" class="py-name"><a title="web2py.gluon.import_all.files" class="py-name" href="#" onclick="return doclink('link-253', 'files', 'link-244');">files</a></tt><tt class="py-op">:</tt> </tt>
<a name="L497"></a><tt class="py-lineno">497</tt>  <tt class="py-line">            <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-254" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-254', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
<a name="L498"></a><tt class="py-lineno">498</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-255" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-255', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L499"></a><tt class="py-lineno">499</tt>  <tt class="py-line">                <tt class="py-name">code</tt> <tt class="py-op">=</tt> <tt id="link-256" class="py-name"><a title="web2py.gluon.compileapp.read_pyc" class="py-name" href="#" onclick="return doclink('link-256', 'read_pyc', 'link-172');">read_pyc</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L500"></a><tt class="py-lineno">500</tt>  <tt class="py-line">                <tt id="link-257" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-257', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt class="py-name">code</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">layer</tt><tt class="py-op">=</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L501"></a><tt class="py-lineno">501</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> </tt>
<a name="L502"></a><tt class="py-lineno">502</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt id="link-258" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-258', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">(</tt><tt class="py-number">404</tt><tt class="py-op">,</tt> </tt>
<a name="L503"></a><tt class="py-lineno">503</tt>  <tt class="py-line">                   <tt id="link-259" class="py-name"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-259', 'rewrite', 'link-37');">rewrite</a></tt><tt class="py-op">.</tt><tt id="link-260" class="py-name"><a title="web2py.gluon.dal.thread
web2py.gluon.rewrite.thread" class="py-name" href="#" onclick="return doclink('link-260', 'thread', 'link-194');">thread</a></tt><tt class="py-op">.</tt><tt class="py-name">routes</tt><tt class="py-op">.</tt><tt class="py-name">error_message</tt> <tt class="py-op">%</tt> <tt class="py-name">badv</tt><tt class="py-op">,</tt> </tt>
<a name="L504"></a><tt class="py-lineno">504</tt>  <tt class="py-line">                   <tt class="py-name">web2py_error</tt><tt class="py-op">=</tt><tt class="py-name">badv</tt><tt class="py-op">)</tt> </tt>
<a name="L505"></a><tt class="py-lineno">505</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L506"></a><tt class="py-lineno">506</tt>  <tt class="py-line">        <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-261" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-261', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'views'</tt><tt class="py-op">,</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">)</tt> </tt>
<a name="L507"></a><tt class="py-lineno">507</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-262" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-262', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">allow_generic</tt><tt class="py-op">:</tt> </tt>
<a name="L508"></a><tt class="py-lineno">508</tt>  <tt class="py-line">            <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt> <tt class="py-op">=</tt> <tt class="py-string">'generic.'</tt> <tt class="py-op">+</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt class="py-name">extension</tt> </tt>
<a name="L509"></a><tt class="py-lineno">509</tt>  <tt class="py-line">            <tt class="py-name">filename</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-263" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-263', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'views'</tt><tt class="py-op">,</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">)</tt> </tt>
<a name="L510"></a><tt class="py-lineno">510</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-264" class="py-name"><a title="web2py.gluon.dal.DatabaseStoredFile.exists" class="py-name" href="#" onclick="return doclink('link-264', 'exists', 'link-169');">exists</a></tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L511"></a><tt class="py-lineno">511</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-265" class="py-name"><a title="web2py.gluon.http.HTTP" class="py-name" href="#" onclick="return doclink('link-265', 'HTTP', 'link-34');">HTTP</a></tt><tt class="py-op">(</tt><tt class="py-number">404</tt><tt class="py-op">,</tt> </tt>
<a name="L512"></a><tt class="py-lineno">512</tt>  <tt class="py-line">                       <tt id="link-266" class="py-name"><a title="web2py.gluon.rewrite" class="py-name" href="#" onclick="return doclink('link-266', 'rewrite', 'link-37');">rewrite</a></tt><tt class="py-op">.</tt><tt id="link-267" class="py-name"><a title="web2py.gluon.dal.thread
web2py.gluon.rewrite.thread" class="py-name" href="#" onclick="return doclink('link-267', 'thread', 'link-194');">thread</a></tt><tt class="py-op">.</tt><tt class="py-name">routes</tt><tt class="py-op">.</tt><tt class="py-name">error_message</tt> <tt class="py-op">%</tt> <tt class="py-name">badv</tt><tt class="py-op">,</tt> </tt>
<a name="L513"></a><tt class="py-lineno">513</tt>  <tt class="py-line">                       <tt class="py-name">web2py_error</tt><tt class="py-op">=</tt><tt class="py-name">badv</tt><tt class="py-op">)</tt> </tt>
<a name="L514"></a><tt class="py-lineno">514</tt>  <tt class="py-line">        <tt class="py-name">layer</tt> <tt class="py-op">=</tt> <tt class="py-name">filename</tt> </tt>
<a name="L515"></a><tt class="py-lineno">515</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-268" class="py-name"><a title="web2py.gluon.compileapp.is_gae
web2py.gluon.languages.is_gae" class="py-name" href="#" onclick="return doclink('link-268', 'is_gae', 'link-39');">is_gae</a></tt><tt class="py-op">:</tt> </tt>
<a name="L516"></a><tt class="py-lineno">516</tt>  <tt class="py-line">            <tt class="py-name">ccode</tt> <tt class="py-op">=</tt> <tt id="link-269" class="py-name"><a title="web2py.gluon.cfs.getcfs" class="py-name" href="#" onclick="return doclink('link-269', 'getcfs', 'link-30');">getcfs</a></tt><tt class="py-op">(</tt><tt class="py-name">layer</tt><tt class="py-op">,</tt> <tt class="py-name">filename</tt><tt class="py-op">,</tt> </tt>
<a name="L517"></a><tt class="py-lineno">517</tt>  <tt class="py-line">                           <tt class="py-keyword">lambda</tt><tt class="py-op">:</tt> <tt id="link-270" class="py-name"><a title="web2py.gluon.restricted.compile2" class="py-name" href="#" onclick="return doclink('link-270', 'compile2', 'link-7');">compile2</a></tt><tt class="py-op">(</tt><tt id="link-271" class="py-name"><a title="web2py.gluon.template.parse_template" class="py-name" href="#" onclick="return doclink('link-271', 'parse_template', 'link-4');">parse_template</a></tt><tt class="py-op">(</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">,</tt> </tt>
<a name="L518"></a><tt class="py-lineno">518</tt>  <tt class="py-line">                                            <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-272" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-272', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'views'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L519"></a><tt class="py-lineno">519</tt>  <tt class="py-line">                                            <tt class="py-name">context</tt><tt class="py-op">=</tt><tt class="py-name">environment</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">layer</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L520"></a><tt class="py-lineno">520</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L521"></a><tt class="py-lineno">521</tt>  <tt class="py-line">            <tt class="py-name">ccode</tt> <tt class="py-op">=</tt> <tt id="link-273" class="py-name"><a title="web2py.gluon.template.parse_template" class="py-name" href="#" onclick="return doclink('link-273', 'parse_template', 'link-4');">parse_template</a></tt><tt class="py-op">(</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">view</tt><tt class="py-op">,</tt> </tt>
<a name="L522"></a><tt class="py-lineno">522</tt>  <tt class="py-line">                                   <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-274" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-274', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'views'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L523"></a><tt class="py-lineno">523</tt>  <tt class="py-line">                                   <tt class="py-name">context</tt><tt class="py-op">=</tt><tt class="py-name">environment</tt><tt class="py-op">)</tt> </tt>
<a name="L524"></a><tt class="py-lineno">524</tt>  <tt class="py-line">        <tt id="link-275" class="py-name"><a title="web2py.gluon.restricted
web2py.gluon.restricted.restricted" class="py-name" href="#" onclick="return doclink('link-275', 'restricted', 'link-5');">restricted</a></tt><tt class="py-op">(</tt><tt class="py-name">ccode</tt><tt class="py-op">,</tt> <tt class="py-name">environment</tt><tt class="py-op">,</tt> <tt class="py-name">layer</tt><tt class="py-op">)</tt> </tt>
</div><a name="L525"></a><tt class="py-lineno">525</tt>  <tt class="py-line"> </tt>
<a name="remove_compiled_application"></a><div id="remove_compiled_application-def"><a name="L526"></a><tt class="py-lineno">526</tt> <a class="py-toggle" href="#" id="remove_compiled_application-toggle" onclick="return toggle('remove_compiled_application');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#remove_compiled_application">remove_compiled_application</a><tt class="py-op">(</tt><tt class="py-param">folder</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="remove_compiled_application-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="remove_compiled_application-expanded"><a name="L527"></a><tt class="py-lineno">527</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L528"></a><tt class="py-lineno">528</tt>  <tt class="py-line"><tt class="py-docstring">    Deletes the folder `compiled` containing the compiled application.</tt> </tt>
<a name="L529"></a><tt class="py-lineno">529</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L530"></a><tt class="py-lineno">530</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L531"></a><tt class="py-lineno">531</tt>  <tt class="py-line">        <tt class="py-name">shutil</tt><tt class="py-op">.</tt><tt class="py-name">rmtree</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-276" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-276', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L532"></a><tt class="py-lineno">532</tt>  <tt class="py-line">        <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-277" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-277', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'controllers'</tt><tt class="py-op">)</tt> </tt>
<a name="L533"></a><tt class="py-lineno">533</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">file</tt> <tt class="py-keyword">in</tt> <tt id="link-278" class="py-name"><a title="web2py.gluon.fileutils.listdir" class="py-name" href="#" onclick="return doclink('link-278', 'listdir', 'link-10');">listdir</a></tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">,</tt><tt class="py-string">'.*\.pyc$'</tt><tt class="py-op">,</tt><tt id="link-279" class="py-name" targets="Method web2py.gluon.dal.BaseAdapter.drop()=web2py.gluon.dal.BaseAdapter-class.html#drop,Method web2py.gluon.dal.NoSQLAdapter.drop()=web2py.gluon.dal.NoSQLAdapter-class.html#drop,Method web2py.gluon.dal.Table.drop()=web2py.gluon.dal.Table-class.html#drop"><a title="web2py.gluon.dal.BaseAdapter.drop
web2py.gluon.dal.NoSQLAdapter.drop
web2py.gluon.dal.Table.drop" class="py-name" href="#" onclick="return doclink('link-279', 'drop', 'link-279');">drop</a></tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L534"></a><tt class="py-lineno">534</tt>  <tt class="py-line">            <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">)</tt> </tt>
<a name="L535"></a><tt class="py-lineno">535</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">OSError</tt><tt class="py-op">:</tt> </tt>
<a name="L536"></a><tt class="py-lineno">536</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
</div><a name="L537"></a><tt class="py-lineno">537</tt>  <tt class="py-line"> </tt>
<a name="L538"></a><tt class="py-lineno">538</tt>  <tt class="py-line"> </tt>
<a name="compile_application"></a><div id="compile_application-def"><a name="L539"></a><tt class="py-lineno">539</tt> <a class="py-toggle" href="#" id="compile_application-toggle" onclick="return toggle('compile_application');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#compile_application">compile_application</a><tt class="py-op">(</tt><tt class="py-param">folder</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="compile_application-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="compile_application-expanded"><a name="L540"></a><tt class="py-lineno">540</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L541"></a><tt class="py-lineno">541</tt>  <tt class="py-line"><tt class="py-docstring">    Compiles all models, views, controller for the application in `folder`.</tt> </tt>
<a name="L542"></a><tt class="py-lineno">542</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L543"></a><tt class="py-lineno">543</tt>  <tt class="py-line">    <tt id="link-280" class="py-name" targets="Function web2py.gluon.compileapp.remove_compiled_application()=web2py.gluon.compileapp-module.html#remove_compiled_application"><a title="web2py.gluon.compileapp.remove_compiled_application" class="py-name" href="#" onclick="return doclink('link-280', 'remove_compiled_application', 'link-280');">remove_compiled_application</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">)</tt> </tt>
<a name="L544"></a><tt class="py-lineno">544</tt>  <tt class="py-line">    <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">mkdir</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt id="link-281" class="py-name"><a title="web2py.gluon.html.join" class="py-name" href="#" onclick="return doclink('link-281', 'join', 'link-75');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">,</tt> <tt class="py-string">'compiled'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L545"></a><tt class="py-lineno">545</tt>  <tt class="py-line">    <tt id="link-282" class="py-name" targets="Function web2py.gluon.compileapp.compile_models()=web2py.gluon.compileapp-module.html#compile_models"><a title="web2py.gluon.compileapp.compile_models" class="py-name" href="#" onclick="return doclink('link-282', 'compile_models', 'link-282');">compile_models</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">)</tt> </tt>
<a name="L546"></a><tt class="py-lineno">546</tt>  <tt class="py-line">    <tt id="link-283" class="py-name" targets="Function web2py.gluon.compileapp.compile_controllers()=web2py.gluon.compileapp-module.html#compile_controllers"><a title="web2py.gluon.compileapp.compile_controllers" class="py-name" href="#" onclick="return doclink('link-283', 'compile_controllers', 'link-283');">compile_controllers</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">)</tt> </tt>
<a name="L547"></a><tt class="py-lineno">547</tt>  <tt class="py-line">    <tt id="link-284" class="py-name" targets="Function web2py.gluon.compileapp.compile_views()=web2py.gluon.compileapp-module.html#compile_views"><a title="web2py.gluon.compileapp.compile_views" class="py-name" href="#" onclick="return doclink('link-284', 'compile_views', 'link-284');">compile_views</a></tt><tt class="py-op">(</tt><tt class="py-name">folder</tt><tt class="py-op">)</tt> </tt>
</div><a name="L548"></a><tt class="py-lineno">548</tt>  <tt class="py-line"> </tt>
<a name="L549"></a><tt class="py-lineno">549</tt>  <tt class="py-line"> </tt>
<a name="test"></a><div id="test-def"><a name="L550"></a><tt class="py-lineno">550</tt> <a class="py-toggle" href="#" id="test-toggle" onclick="return toggle('test');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="web2py.gluon.compileapp-module.html#test">test</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="test-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="test-expanded"><a name="L551"></a><tt class="py-lineno">551</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L552"></a><tt class="py-lineno">552</tt>  <tt class="py-line"><tt class="py-docstring">    Example::</tt> </tt>
<a name="L553"></a><tt class="py-lineno">553</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L554"></a><tt class="py-lineno">554</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; import traceback, types</tt> </tt>
<a name="L555"></a><tt class="py-lineno">555</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; environment={'x':1}</tt> </tt>
<a name="L556"></a><tt class="py-lineno">556</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; open('a.py', 'w').write('print 1/x')</tt> </tt>
<a name="L557"></a><tt class="py-lineno">557</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; save_pyc('a.py')</tt> </tt>
<a name="L558"></a><tt class="py-lineno">558</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; os.unlink('a.py')</tt> </tt>
<a name="L559"></a><tt class="py-lineno">559</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; if type(read_pyc('a.pyc'))==types.CodeType: print 'code'</tt> </tt>
<a name="L560"></a><tt class="py-lineno">560</tt>  <tt class="py-line"><tt class="py-docstring">        code</tt> </tt>
<a name="L561"></a><tt class="py-lineno">561</tt>  <tt class="py-line"><tt class="py-docstring">        &gt;&gt;&gt; exec read_pyc('a.pyc') in environment</tt> </tt>
<a name="L562"></a><tt class="py-lineno">562</tt>  <tt class="py-line"><tt class="py-docstring">        1</tt> </tt>
<a name="L563"></a><tt class="py-lineno">563</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L564"></a><tt class="py-lineno">564</tt>  <tt class="py-line"> </tt>
<a name="L565"></a><tt class="py-lineno">565</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> </tt>
</div><a name="L566"></a><tt class="py-lineno">566</tt>  <tt class="py-line"> </tt>
<a name="L567"></a><tt class="py-lineno">567</tt>  <tt class="py-line"> </tt>
<a name="L568"></a><tt class="py-lineno">568</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L569"></a><tt class="py-lineno">569</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">doctest</tt> </tt>
<a name="L570"></a><tt class="py-lineno">570</tt>  <tt class="py-line">    <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">testmod</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L571"></a><tt class="py-lineno">571</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<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:47:08 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>