[Mailman-Developers] templating, search, and stuff...

Chuq Von Rospach chuqui@plaidworks.com
Sat, 06 Apr 2002 09:21:40 -0800


On 4/6/02 7:52 AM, "Barry A. Warsaw" <barry@zope.com> wrote:


>   JCL> just adding template support is good, but doesn't solve the
>   JCL> base problem of enabling mailman to be a well behaved
>   JCL> component in a web page that's otherwise assembled.
>=20
> Nicely said.

Thinking about it, here's how I'd do this (at first glance)

Define two new variables:

MAILMAN_HEADER

MAILMAN_FOOTER

You can point these two one of two things: a file, or a function. If
defined, the header replaces what Mailman normally spits out from <HTML> to
<BODY>. The footer replaces </BODY> through </HTML> inclusive. This allows
you to "box" the mailman content inside your site's interface (and FWIW, if
you look at what I've done on www.lists.apple.com, that's exactly what I
have done, only using mod_layout to do the boxing. It's also the way pages
like applenews.lists.apple.com/unsubscribe work, since marketing controls
the content and I control the cgi aspects, we built the pages to allow each
side to manage their part independently. As long as we both behave, of
course...)

If you have a simple interface, that's all you need. But if you have a more
complex one, that=B9s' where the function comes in. If you define these as
functions, then those functions need to be in the python include path, but
once you do that, you can do literally anything (suck the html out of a
database, write it on the fly, whatever). The function is called with a
single parameter that is one of a pre-defined set of constants that define
which page is being rendered, so those functions have the ability to adapt
the output to each page. The functions return a glop of text that is the
HTML to be output.

This would allow mailman to adapt easily to ANY templating system, while
being tied to none. Even the most complex interface system comes down to
writing two python functions to interface to mailman. In most cases, the
template files will be enough, but for big, complex sites the functionality
is there as well.

And even better -- it's quite easy to implement inside mailman. It's a
pretty trivial setup. And if you don't define those variables, mailman
continues to work as it does now, so there are no upgrade/compatibility
issues, either.=20

I'd guess this is 100 lines of python code, maybe less.

Thoughts?=20



--=20
Chuq Von Rospach, Architech
chuqui@plaidworks.com -- http://www.chuqui.com/

Stress is when you wake up screaming and you realize you haven't fallen
asleep yet.