Author: ianb
Date: 2005-03-16 14:18:01 -0700 (Wed, 16 Mar 2005)
New Revision: 2114
Added:
Component/trunk/Docs/
Component/trunk/Docs/default.css
Component/trunk/Docs/index.txt
Component/trunk/disttools/
Component/trunk/disttools/build
Component/trunk/disttools/upload-docs
Removed:
Component/trunk/README.txt
Modified:
Component/trunk/Properties.py
Log:
Documented Component, set it up for a real release
Property changes on: Component/trunk/Docs
___________________________________________________________________
Name: svn:ignore
+ *.html
Added: Component/trunk/Docs/default.css
===================================================================
--- Component/trunk/Docs/default.css 2005-03-16 20:29:20 UTC (rev 2113)
+++ Component/trunk/Docs/default.css 2005-03-16 21:18:01 UTC (rev 2114)
@@ -0,0 +1,289 @@
+/*
+:Author: David Goodger
+:Contact: goodger@...
+:date: $Date: 2003/06/28 22:18:49 $
+:version: $Revision: 1.2 $
+:copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+*/
+
+body {
+ background-color: #eeeeee;
+ font-family: Arial, sans-serif;
+}
+
+em {
+ font-family: Times New Roman, Times, serif;
+}
+
+li {
+ list-style-type: circle;
+}
+
+a.target {
+ color: blue }
+
+a.toc-backref {
+ text-decoration: none ;
+ color: black }
+
+a:hover {
+ background-color: #cccccc;
+}
+
+cite {
+ font-style: normal;
+ font-family: monospace;
+ font-weight: bold;
+}
+
+dd {
+ margin-bottom: 0.5em }
+
+div.abstract {
+ margin: 2em 5em }
+
+div.abstract p.topic-title {
+ font-weight: bold ;
+ text-align: center }
+
+div.attention, div.caution, div.danger, div.error, div.hint,
+div.important, div.note, div.tip, div.warning {
+ // margin: 2em ;
+ background-color: #cccccc;
+ align: center;
+ width: 40%;
+ border: medium outset ;
+ padding: 3px;
+ float: right;
+ }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+ color: red ;
+ font-weight: bold ;
+ font-family: sans-serif;
+ text-align: center;
+ display: block;
+ background-color: #999999;
+ margin: 0; }
+
+div.hint p.admonition-title, div.important p.admonition-title,
+div.note p.admonition-title, div.tip p.admonition-title {
+ font-weight: bold ;
+ font-family: sans-serif;
+ text-align: center;
+ display: block;
+ background-color: #999999;
+ margin: 0; }
+
+div.dedication {
+ margin: 2em 5em ;
+ text-align: center ;
+ font-style: italic }
+
+div.dedication p.topic-title {
+ font-weight: bold ;
+ font-style: normal }
+
+div.figure {
+ margin-left: 2em }
+
+div.footer, div.header {
+ font-size: smaller }
+
+div.system-messages {
+ margin: 5em }
+
+div.system-messages h1 {
+ color: red }
+
+div.system-message {
+ border: medium outset ;
+ padding: 1em }
+
+div.system-message p.system-message-title {
+ color: red ;
+ font-weight: bold }
+
+div.topic {
+ margin: 2em }
+
+h1, h2, h3, h4, h5, h6 {
+ font-family: Helvetica, Arial, sans-serif;
+ border: thin solid black;
+ -moz-border-radius: 8px;
+ padding: 4px;
+ }
+
+h1 {
+ background-color: #444499;
+ border: medium solid black;
+ color: #ffffff;
+}
+
+h2 {
+ background-color: #666666;
+ color: #ffffff;
+ border: medium solid black;
+}
+
+h1 a:link, h2 a:link {
+ color: #ffffff;
+}
+
+h3, h4, h5, h6 {
+ background-color: #cccccc;
+ color: #000000;
+}
+
+h3 a:link, h4 a:link, h5 a:link, h6 a:link {
+ color: #000000;
+}
+
+h1.title {
+ text-align: center;
+ background-color: #444499;
+ color: #eeeeee;
+ border: thick solid black;
+ -moz-border-radius: 20px;
+ }
+
+h2.subtitle {
+ text-align: center }
+
+hr {
+ width: 75% }
+
+ol.simple, ul.simple {
+ margin-bottom: 1em }
+
+ol.arabic {
+ list-style: decimal }
+
+ol.loweralpha {
+ list-style: lower-alpha }
+
+ol.upperalpha {
+ list-style: upper-alpha }
+
+ol.lowerroman {
+ list-style: lower-roman }
+
+ol.upperroman {
+ list-style: upper-roman }
+
+p.caption {
+ font-style: italic }
+
+p.credits {
+ font-style: italic ;
+ font-size: smaller }
+
+p.first {
+ margin-top: 0 }
+
+p.label {
+ white-space: nowrap }
+
+p.topic-title {
+ font-weight: bold }
+
+pre.address {
+ margin-bottom: 0 ;
+ margin-top: 0 ;
+ font-family: serif ;
+ font-size: 100% }
+
+pre.line-block {
+ font-family: serif ;
+ font-size: 100% }
+
+pre.literal-block, pre.doctest-block {
+ margin-left: 2em ;
+ margin-right: 2em ;
+ background-color: #ffffff;
+ border: thin black solid;
+ padding: 5px;
+}
+
+span.classifier {
+ font-family: sans-serif ;
+ font-style: oblique }
+
+span.classifier-delimiter {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+span.interpreted {
+ font-family: sans-serif }
+
+span.option-argument {
+ font-style: italic }
+
+span.pre {
+ white-space: pre }
+
+span.problematic {
+ color: red }
+
+table {
+ margin-top: 0.5em ;
+ margin-bottom: 0.5em }
+
+table.citation {
+ border-left: solid thin gray ;
+ padding-left: 0.5ex }
+
+table.docinfo {
+ margin: 2em 4em }
+
+table.footnote {
+ border-left: solid thin black ;
+ padding-left: 0.5ex }
+
+td, th {
+ padding-left: 0.5em ;
+ padding-right: 0.5em ;
+ vertical-align: top }
+
+td > p:first-child, th > p:first-child {
+ margin-top: 0em }
+
+th.docinfo-name, th.field-name {
+ font-weight: bold ;
+ text-align: left ;
+ white-space: nowrap }
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+ font-size: 100% }
+
+tt {
+ //background-color: #eeeeee;
+ color: #000066 }
+
+ul.auto-toc {
+ list-style-type: none }
+
+// Highlighting:
+
+.function {color: #000077; font-weight: bold}
+.keyword {color: #004444;}
+.comment {color: #770000; font-style: italic}
+.normal {color: #000000;}
+.string {color: #006600;}
+.symbol {color: #000000;}
+
+.htmltag {color: #000077;}
+.htmlsymbol {color: #000000;}
+.htmlnormal {color: #000000;}
+.htmlcomment {color: #770000; font-style: italic}
+.htmlstring {color: #006600;}
+.htmlattr {color: #000000;}
+
+.stmlfunction {color: #000077; font-weight: bold}
+.stmlattr {color: #000000;}
+.stmlstring {color: #006600;}
+.stmlexpr {color: #004444;}
\ No newline at end of file
Added: Component/trunk/Docs/index.txt
===================================================================
--- Component/trunk/Docs/index.txt 2005-03-16 20:29:20 UTC (rev 2113)
+++ Component/trunk/Docs/index.txt 2005-03-16 21:18:01 UTC (rev 2114)
@@ -0,0 +1,150 @@
+Component 0.1
++++++++++++++
+
+.. contents::
+
+Downloads and Websites
+======================
+
+* Homepage: http://wiki.webwareforpython.org/component.html
+* Download: http://webwareforpython.org/downloads/Component-1.0.tar.gz
+* Source repository: http://svn/webwareforpython.org/Component/trunk
+* Discussion: `webware-discuss@...`__
+
+.. __: http://lists.sourceforge.net/lists/listinfo/webware-discuss
+
+The repository is a Subversion_ repository. To check out a copy::
+
+ $ svn co http://svn.webwareforpython.org/Component/trunk Component
+
+.. _Subversion: http://subversion.tigris.org/
+
+License and Prerequesites
+=========================
+
+ZPTKit is licensed under an `MIT-style license`__. This gives you
+permission to most anything you want with ZPTKit.
+
+.. __: http://www.opensource.org/licenses/mit-license.php
+
+ZPTKit is a toolkit for `Webware For Python`_. Webware is the only
+prerequisite.
+
+.. _Webware For Python: http://webwareforpython.org
+
+What Are They?
+==============
+
+Many enhancements in Webware require subclassing ``WebKit.Page``. But
+each of these enhancements is incompatible with the others, because
+you have to choose an specific inheritance hierarchy to use them. You
+can't subclass ``SecurePage`` and ``SidebarPage`` and ``MVCPage`` all
+at once.
+
+One solution is Mixins, using multiple inheritance to add various
+functions. This technique is available in Webware through
+``MiscUtils.MixIn``. However, there are many places where Mixins are
+mutually incompatible -- for instance, code often has to intercept the
+``awake()`` method, but delegating to each Mixin requires that they
+all know about each other.
+
+Components are essentially a way of creating Mixins that all know
+about each other.
+
+What's a Component Good For?
+----------------------------
+
+Components are useful if you have code that should know about the
+request and response, and possible intercept it. If the code doesn't
+need to know about the request at all, you should just create a normal
+Python library, and call into it explicitly. Components can also be a
+convenient way to add new convenience methods to your servlet.
+
+Using CPage
+===========
+
+In order to use components, all your servlets must inherit from
+``Component.CPage``. This subclass of ``WebKit.Page`` adds some new
+convenient methods, but mostly just adds component support.
+
+New methods:
+
+``writeHeader()``:
+ Called automatically in ``writeBodyParts``. If you are not using
+ a template, this can be used to write the HTML that goes at the
+ top of every page (the text written goes just *after* ``<body>``).
+
+``writeFooter()``:
+ ``writeHeader`` compliment.
+
+``setView(view_name)``:
+ ``CPage`` adds the idea of *views*. The default view is
+ ``writeContent`` -- that's the innermost method that is called.
+ This can be used with actions so that the action method performs
+ some work, then changes the view to display a different body.
+ This way actions occur before content display, but can effect
+ later display without losing the normal Python templating
+ mechanism (``writeHead``, etc). Templating components (like
+ ZPTKit) may use this concept of view to indicate a template to
+ use.
+
+``view()``:
+ Returns the view, as a string.
+
+``sendResponseAndEnd(status, headers={}, body=None)``:
+ For error responses. This can be used like::
+
+ def awake(self, trans):
+ CPage.awake(self, trans)
+ try:
+ self.id = int(
+ self.request().extraURLPath().split('/')[1])
+ except (ValueError, IndexError):
+ self.sendResponseAndEnd(500)
+
+ A simple error body is created if you don't pass one in.
+
+``preAction`` and ``postAction`` are modified to do nothing (in
+``WebKit.Page`` they output a little HTML).
+
+Using Components
+================
+
+``CPage`` looks for any components you have in the ``.components``
+class variable (which should be a list). One very simple component is
+included, ``NotifyComponent``. As an example you can use this
+component like::
+
+ from Component import CPage
+ from Component.notify import NotifyComponent
+
+ class SitePage(CPage):
+
+ components = [NotifyComponent()]
+
+ def writeHeader(self):
+ self.writeMessages()
+
+If the component was configured, it would probably take arguments to
+its constructor (this simple component has no configuration). A
+component can add new methods to the servlet. In this case it adds a
+``.message(text)`` method, which adds your message to the session, and
+a ``.writeMessages()`` method which writes the messages and clears them
+from the session. (Also a ``.messageText()`` method if you don't want
+to write the messages immediately.)
+
+It's up to the component to add methods or attributes to the servlet.
+It can also respond to "events" -- one example (and one of the only
+current events) is the ``awake`` event, where it could intercept the
+request. An example of this is in LoginKit_, where the component
+checks the servlet for permission settings, and may abort the
+transaction with a login screen (or a Forbidden response) during
+``awake()``.
+
+.. _LoginKit: http://svn.w4py.org/LoginKit
+
+Writing Components
+==================
+
+Read the source -- there are many docstrings in ``Component.py``.
+
Modified: Component/trunk/Properties.py
===================================================================
--- Component/trunk/Properties.py 2005-03-16 20:29:20 UTC (rev 2113)
+++ Component/trunk/Properties.py 2005-03-16 21:18:01 UTC (rev 2114)
@@ -1,10 +1,10 @@
name = 'Components'
-version = ('X', 'Y', 0)
+version = ('0', '1', 0)
-docs = []
+docs = [{'name': "User's Guide", 'file': 'index.html'}]
-status = 'alpha'
+status = 'beta'
requiredPyVersion = (2, 2, 0)
Deleted: Component/trunk/README.txt
===================================================================
--- Component/trunk/README.txt 2005-03-16 20:29:20 UTC (rev 2113)
+++ Component/trunk/README.txt 2005-03-16 21:18:01 UTC (rev 2114)
@@ -1,4 +0,0 @@
-To try this out:
-
-./AppServer --AppServer.PlugIns='["/path/to/repository/Component"]'
-
Property changes on: Component/trunk/disttools
___________________________________________________________________
Name: svn:ignore
+ Component*
Added: Component/trunk/disttools/build
===================================================================
--- Component/trunk/disttools/build 2005-03-16 20:29:20 UTC (rev 2113)
+++ Component/trunk/disttools/build 2005-03-16 21:18:01 UTC (rev 2114)
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+VERSION="$1"
+PKG_NAME="Component"
+
+
+if test "$VERSION" = "-h" || test "$VERSION" = "" ; then
+ echo "Usage: build X.Y"
+ echo "Builds a downloadable package with the given version."
+ exit 2
+fi
+
+THISDIR=`dirname $0`
+if [ "$THISDIR" != "" ] ; then
+ cd "$THISDIR"
+fi
+
+cd ../Docs
+rst2html.py --no-toc-backlinks < index.txt > index.html
+cd ../disttools
+
+OUTFILE="${PKG_NAME}-${VERSION}.tar.gz"
+OUTDIR="${PKG_NAME}-${VERSION}"
+
+if [ -e $OUTDIR ] ; then
+ rm -r $OUTDIR
+fi
+
+for DIR in / /Docs ; do
+ mkdir $OUTDIR$DIR
+done
+
+cd ..
+find ./ ./Docs -depth 1 \
+ \( -name '*.html' -o -name '*.txt' \
+ -o -name '*.css' -o -name '*.py' -o -name '*.pt' \
+ -o -name '*.data' \) \
+ -exec cp {} disttools/$OUTDIR/{} \;
+cd disttools
+tar cfz $OUTFILE $OUTDIR
Property changes on: Component/trunk/disttools/build
___________________________________________________________________
Name: svn:executable
+ *
Added: Component/trunk/disttools/upload-docs
===================================================================
--- Component/trunk/disttools/upload-docs 2005-03-16 20:29:20 UTC (rev 2113)
+++ Component/trunk/disttools/upload-docs 2005-03-16 21:18:01 UTC (rev 2114)
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+DEST="w4py.org:/var/www/downloads"
+
+THISDIR=`dirname $0`
+if [ "$THISDIR" != "" ] ; then
+ cd "$THISDIR"
+fi
+
+#rst2html.py --no-toc-backlinks ../Docs/index.txt > index.html
+
+#scp index.html "$DEST/index.html" && rm index.html
+
+scp *.tar.gz "$DEST"
Property changes on: Component/trunk/disttools/upload-docs
___________________________________________________________________
Name: svn:executable
+ *
|