MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/manual/mod/mod_python/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/manual/mod/mod_python/pyapi-apmeth.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="modpython.css" type='text/css'>
<link rel="first" href="modpython.html" title='Mod_python Manual'>
<link rel='contents' href='contents.html' title="Contents">
<link rel='index' href='genindex.html' title='Index'>
<link rel='last' href='about.html' title='About this document...'>
<link rel='help' href='about.html' title='About this document...'>
<LINK REL="next" href="pyapi-mptable.html">
<LINK REL="prev" href="module-apache.html">
<LINK REL="parent" href="module-apache.html">
<LINK REL="next" href="pyapi-mptable.html">
<meta name='aesop' content='information'>
<META NAME="description" CONTENT="Functions">
<META NAME="keywords" CONTENT="modpython">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<title>4.5.1 Functions</title>
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><a rel="prev" title="4.5 apache - Access" 
  href="module-apache.html"><img src='previous.gif'
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
<td><a rel="parent" title="4.5 apache - Access" 
  href="module-apache.html"><img src='up.gif'
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
<td><a rel="next" title="4.5.2 Table Object (mp_table)&nbsp;" 
  href="pyapi-mptable.html"><img src='next.gif'
  border='0' height='32'  alt='Next Page' width='32'></A></td>
<td align="center" width="100%">Mod_python Manual</td>
<td><a rel="contents" title="Table of Contents" 
  href="contents.html"><img src='contents.gif'
  border='0' height='32'  alt='Contents' width='32'></A></td>
<td><img src='blank.gif'
  border='0' height='32'  alt='' width='32'></td>
<td><a rel="index" title="Index" 
  href="genindex.html"><img src='index.gif'
  border='0' height='32'  alt='Index' width='32'></A></td>
</tr></table>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-apache.html">4.5 apache - Access</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-apache.html">4.5 apache - Access</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="pyapi-mptable.html">4.5.2 Table Object (mp_table)&nbsp;</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION006510000000000000000">&nbsp;</A>
<BR>
4.5.1 Functions
</H2>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-27"><tt class="function">log_error</tt></a></b>(</nobr></td>
  <td><var>message</var><big>[</big><var>, level, server</var><big>]</big>)</td></tr></table>
<dd>
  An interface to the Apache <code>ap_log_error()</code>
  function. <var>message</var> is a string with the error message,
  <var>level</var> is one of the following flags constants:

<P>
<div class="verbatim"><pre>
    APLOG_EMERG
    APLOG_ALERT
    APLOG_CRIT
    APLOG_ERR
    APLOG_WARNING
    APLOG_NOTICE
    APLOG_INFO
    APLOG_DEBUG
    APLOG_NOERRNO
</pre></div>            

<P>
<var>server</var> is a reference to a <tt class="member">req.server</tt> object. If
  <var>server</var> is not specified, then the error will be logged to the
  default error log, otherwise it will be written to the error log for
  the appropriate virtual server. When <var>server</var> is not specified,
  the setting of LogLevel does not apply, the LogLevel is dictated by
  an httpd compile-time default, usually <code>warn</code>.

<P>
If you have a reference to a request object available, consider using
  <tt class="method">req.log_error</tt> instead, it will prepend request-specific
  information such as the source IP of the request to the log entry.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-28"><tt class="function">import_module</tt></a></b>(</nobr></td>
  <td><var>module_name</var><big>[</big><var>, autoreload=1, log=0, path=None</var><big>]</big>)</td></tr></table>
<dd>
  This function can be used to import modules taking advantage of
  mod_python's internal mechanism which reloads modules automatically
  if they have changed since last import. 

<P>
<var>module_name</var> is a string containing the module name (it can
  contain dots, e.g. <code>mypackage.mymodule</code>); <var>autoreload</var>
  indicates whether the module should be reloaded if it has changed since
  last import; when <var>log</var> is true, a message will be written to
  the logs when a module is reloaded; <var>path</var> allows restricting
  modules to specific paths.

<P>
Example:

<P>
<div class="verbatim"><pre>
    from mod_python import apache
    mymodule = apache.import_module('mymodule', log=1)
</pre></div>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-29"><tt class="function">allow_methods</tt></a></b>(</nobr></td>
  <td><big>[</big><var>*args</var><big>]</big>)</td></tr></table>
<dd>
  A convenience function to set values in <tt class="member">req.allowed</tt>.
  <tt class="member">req.allowed</tt> is a bitmask that is used to construct the
  "<tt class="samp">Allow:</tt>" header. It should be set before returning a
  <code>HTTP_NOT_IMPLEMENTED</code> error.

<P>
Arguments can be one or more of the following:
  <div class="verbatim"><pre>
    M_GET
    M_PUT
    M_POST
    M_DELETE
    M_CONNECT
    M_OPTIONS
    M_TRACE
    M_PATCH
    M_PROPFIND
    M_PROPPATCH
    M_MKCOL
    M_COPY
    M_MOVE
    M_LOCK
    M_UNLOCK
    M_VERSION_CONTROL
    M_CHECKOUT
    M_UNCHECKOUT
    M_CHECKIN
    M_UPDATE
    M_LABEL
    M_REPORT
    M_MKWORKSPACE
    M_MKACTIVITY
    M_BASELINE_CONTROL
    M_MERGE
    M_INVALID
</pre></div>

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-30"><tt class="function">exists_config_define</tt></a></b>(</nobr></td>
  <td><var>name</var>)</td></tr></table>
<dd>
    This function returns True if the Apache server was launched
    with the definition with the given <var>name</var>. This means
    that you can test whether Apache was launched with the <code>-DFOOBAR</code>
    parameter by calling <code>apache.exists_config_define('FOOBAR')</code>.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-31"><tt class="method">register_cleanup</tt></a></b>(</nobr></td>
  <td><var>handler</var><big>[</big><var>, data</var><big>]</big>)</td></tr></table>
<dd>
  Registers a cleanup. Equivalent to <tt class="function">req.register_cleanup()</tt>
  or <tt class="function">req.server.register_cleanup()</tt>, except that a server or request
  object is not required.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-32"><tt class="function">config_tree</tt></a></b>(</nobr></td>
  <td>)</td></tr></table>
<dd>
  Returns the server-level configuration tree. This tree does not
  include directives from .htaccess files. This is a <i>copy</i> of
  the tree, modifying it has no effect on the actual configuration.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-33"><tt class="function">server_root</tt></a></b>(</nobr></td>
  <td>)</td></tr></table>
<dd>
  Returns the value of ServerRoot.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-34"><tt class="function">make_table</tt></a></b>(</nobr></td>
  <td>)</td></tr></table>
<dd> 
  This function is obsolete and is an alias to <tt class="class">table</tt> (see below).
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><a name="l2h-35"><tt class="function">mpm_query</tt></a></b>(</nobr></td>
  <td><var>code</var>)</td></tr></table>
<dd>
  Allows querying of the MPM for various parameters such as numbers of
  processes and threads. The return value is one of three constants:
  <div class="verbatim"><pre>
AP_MPMQ_NOT_SUPPORTED      = 0  # This value specifies whether 
                                # an MPM is capable of         
                                # threading or forking.        
AP_MPMQ_STATIC             = 1  # This value specifies whether 
                                # an MPM is using a static # of
                                # threads or daemons.          
AP_MPMQ_DYNAMIC            = 2  # This value specifies whether 
                                # an MPM is using a dynamic # of
                                # threads or daemons.
</pre></div>

<P>
The <var>code</var> argument must be one of the following:
  <div class="verbatim"><pre>
AP_MPMQ_MAX_DAEMON_USED    = 1  # Max # of daemons used so far 
AP_MPMQ_IS_THREADED        = 2  # MPM can do threading         
AP_MPMQ_IS_FORKED          = 3  # MPM can do forking           
AP_MPMQ_HARD_LIMIT_DAEMONS = 4  # The compiled max # daemons   
AP_MPMQ_HARD_LIMIT_THREADS = 5  # The compiled max # threads   
AP_MPMQ_MAX_THREADS        = 6  # # of threads/child by config 
AP_MPMQ_MIN_SPARE_DAEMONS  = 7  # Min # of spare daemons       
AP_MPMQ_MIN_SPARE_THREADS  = 8  # Min # of spare threads       
AP_MPMQ_MAX_SPARE_DAEMONS  = 9  # Max # of spare daemons       
AP_MPMQ_MAX_SPARE_THREADS  = 10 # Max # of spare threads       
AP_MPMQ_MAX_REQUESTS_DAEMON= 11 # Max # of requests per daemon 
AP_MPMQ_MAX_DAEMONS        = 12 # Max # of daemons by config
</pre></div>

<P>
Example:
  <div class="verbatim"><pre>
if apache.mpm_query(apache.AP_MPMQ_IS_THREADED):
    # do something
else:
    # do something else
</pre></div>
</dl>

<P>

<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><a rel="prev" title="4.5 apache - Access" 
  rel="prev" title="4.5 apache - Access" 
  href="module-apache.html"><img src='previous.gif'
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
<td><a rel="parent" title="4.5 apache - Access" 
  rel="parent" title="4.5 apache - Access" 
  href="module-apache.html"><img src='up.gif'
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
<td><a rel="next" title="4.5.2 Table Object (mp_table)&nbsp;" 
  rel="next" title="4.5.2 Table Object (mp_table)&nbsp;" 
  href="pyapi-mptable.html"><img src='next.gif'
  border='0' height='32'  alt='Next Page' width='32'></A></td>
<td align="center" width="100%">Mod_python Manual</td>
<td><a rel="contents" title="Table of Contents" 
  rel="contents" title="Table of Contents" 
  href="contents.html"><img src='contents.gif'
  border='0' height='32'  alt='Contents' width='32'></A></td>
<td><img src='blank.gif'
  border='0' height='32'  alt='' width='32'></td>
<td><a rel="index" title="Index" 
  rel="index" title="Index" 
  href="genindex.html"><img src='index.gif'
  border='0' height='32'  alt='Index' width='32'></A></td>
</tr></table>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-apache.html">4.5 apache - Access</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-apache.html">4.5 apache - Access</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="pyapi-mptable.html">4.5.2 Table Object (mp_table)&nbsp;</A>
<hr>
<span class="release-info">Release 3.2.8, documentation updated on February 19, 2006.</span>
</DIV>
<!--End of Navigation Panel-->

</BODY>
</HTML>

Anon7 - 2021