Webware / WebKit / Docs / Developing.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.8:" />
<title>Developing Webware</title>
<link rel="stylesheet" href="../../Docs/Doc.css" type="text/css" />
<div class="document" id="developing-webware">
<h1 class="title">Developing Webware</h1>

<p>This document should outline the details you need to understand
Webware and WebKit internals, and assist in becoming a more advanced
Webware programmer.</p>
<div class="section" id="style-guidelines">
<h1>Style Guidelines</h1>
<p>Webware developers are requested to observe the rules defined
in the <a class="reference external" href="../../Docs/StyleGuidelines.html">Webware Style Guidelines</a>.</p>
<div class="section" id="creating-plugins">
<h1>Creating Plugins</h1>
<p>Each plugin is a Python Package.  WebKit finds plugins using the
<tt class="docutils literal">PlugIns</tt> and <tt class="docutils literal">PluginDirs</tt> -- see <a class="reference external" href="Configuration.html#appserver-config">Configuration</a>.  See also the
<a class="reference external" href="">Python tutorial on packages</a> and the <tt class="docutils literal"></tt> doc string.</p>
<p>A plug-in must have <tt class="docutils literal"></tt> and <tt class="docutils literal"></tt> files.
You can disable a specific plug-in by placing a <tt class="docutils literal">dontload</tt> file in it.</p>
<p><tt class="docutils literal">__init.py__</tt> must contain a function like:</p>
<pre class="literal-block">
def InstallInWebKit(appServer):
<p>The function doesn't need to do anything, but this gives it the
opportunity to do something with the AppServer -- for instance, the
PSP plugin uses AppServer.addServletFactory to add a handler for <tt class="docutils literal">.psp</tt>
<p>The <tt class="docutils literal"></tt> file should contain a number of assignments:</p>
<pre class="literal-block">
name = &quot;Plugin name&quot;
version = (1, 0, 0)
docs = [{'name': 'Quick Start Guide', 'file': 'QuickStart.html'},
        {'name': 'Reference Guide, 'file': 'Reference.html'}]
status = 'beta'
requiredPyVersion = (2, 4, 0)
requiredOpSys = 'posix'
synopsis = &quot;&quot;&quot;A paragraph-long description of the plugin&quot;&quot;&quot;
WebKitConfig = {
    'examplePages': [
def willRunFunc():
    if softwareNotInstalled:
        return &quot;some message to that effect&quot;
        return None
<p>The documents (e.g. <tt class="docutils literal">QuickStart.html</tt>) should be located in a <tt class="docutils literal">Docs/</tt>
subdirectory.  The example pages go in an <tt class="docutils literal">Examples/</tt> subdirectory.</p>
<p>A plugin who's <tt class="docutils literal">requiredPyVersion</tt> or <tt class="docutils literal">requiredOpSys</tt> aren't satisfied will
simply be ignored.  <tt class="docutils literal">requiredOpSys</tt> should be something returned by
<tt class="docutils literal"></tt>, like <tt class="docutils literal">posix</tt> or <tt class="docutils literal">nt</tt>.  Or you can define a function
<tt class="docutils literal">willRunFunc</tt> to test.  If there aren't requirements you can leave these
variables and functions out.</p>