Introduction
This file, ui.html
, defines the look-and-feel
of the user interface of the Spambayes Server. The various
pieces of HTML defined here are extracted and maniplulated at
runtime to dynamically produce the HTML that the Spambayes
Server serves up - this file acts as a palette of HTML
components. PyMeldLite
is the module that provides
the HTML-to-object mapping layer that makes all this possible.
Each piece of HTML that needs to be manipulated has an
id
tag, and becomes a Python object at runtime.
As an example of how this works, here is an editbox with
an id
of examplebox
:
PyMeldLite lets you manipulate the HTML programmatically:
>>> import PyMeldLite >>> html = open("ui.html", "rt").read() >>> doc = PyMeldLite.Container(html) >>> print doc.examplebox <input id="examplebox" size="10" type="text" value="example"/> >>> doc.examplebox.value = "Changed" >>> print doc.examplebox <input id="examplebox" size="10" type="text" value="Changed"/>
So the Python code to build the HTML user interface pages doesn't need to faff about pasting strings together, or building HTML components from scratch in code. And the look-and-feel is controlled solely by this one HTML file - changing the stylesheet, translating into other languages, adding a new piece of user interface - all of these things are very easy.
Below are all the user interface components along with their
id
s.
headedBox
Headed box | |
![]() |
This is a "headedBox". Most of the user interfaces pieces are
presented in one of these. The pieces aren't presented in these
boxes here in ui.html to avoid duplication of HTML.
|
status
POP3 proxy running on 1110,
proxying to example.com.
Active POP3 conversations: 0. POP3 conversations this session: 0. Emails classified this session: 0 spam, 0 ham, 0 unsure. Total emails trained: Spam: 0 Ham: 0 |
![]() system using the Configuration page. |
reviewText
The Spambayes proxy stores all the messages it sees. You can train the classifier based on those messages using the Review messages page.
reviewTable
These are emails that you can use to train the classifier. Check the appropriate button for each email, then click 'Train' below. 'Defer' leaves the message here, to be trained on later. Click one of the Discard / Defer / Ham / Spam headers to check all of the buttons in that section in one go.
upload
(The upload form gets used for both training and classifying - the inappropriate pieces are removed at runtime.)
wordQuery
findMessage
wordStats
Number of spam messages: 123.Number of ham messages: 456.
Probability that a message containing this word is spam: 0.789.
classifyResults
Spam probability: 0.123
(The table of clues goes here, like this but in a headedBox):Example word | 0.123 |
Return Home or classify another:
(The Classify form goes here)configForm
shutdownMessage
Shutdown. Goodbye.