You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Michael C. Neel" <ne...@mediapulse.com> on 2004/05/27 19:42:07 UTC

OT: web app kits Was: Announcing: Mod_python Servlets

> Fast forward a few years.  I looked again at what was out there and
> found most toolkits were still too "big" or required a "buy-in" to a
> content form I was unwilling to make.  I felt I was looking at someone
> else's solution to a content management system rather than a toolkit
> that allowed me to build my own.  (Which is fine, of course, if what
> you want is a solution, but a solution does not necessarily make for a
> good toolkit.)
> 



I'm curious if your looked at / tried Albatross and if so can you
compare / contrast your system to it?  I came to the same about some of
the other options you mentioned, and your goals of a toolkit are very
similar to mine, so would value your remarks about Albatross as it's
what I've set up on.

I don't think I'll be switching anytime soon, but I think there is room
to share ideas and maybe help out each toolkit.

Mike

Re: OT: web app kits Was: Announcing: Mod_python Servlets

Posted by "Michael C. Neel" <ne...@mediapulse.com>.

> Perhaps an easily accessible tutorial ("Hello, World!") would help,
> too.  That's one reason I didn't want to publish without first putting
> together a fairly comprehensive tutorial: without it, Servlets are too
> hard to explain, with it, it looks like common sense (well, to someone
> familiar with OO).
> 


Yes, I agree that while albatross has good reference documentation, it
lacks good tutorial documentation.  A wiki was created to help this
problem at  
http://www.object-craft.com.au/projects/albatross/wiki/ and there is
even a Hello World, but right now most of the examples posted focus on
the templates rather than the system as a whole.



> Interesting.  Albatross is probably closer to Servlets than I ever
> expected.  I hope you have the opportunity to go through my tutorial
> and I look forward to your informed opinion.
> 



I work in the source code of Albatross alot, so I'll be spending time in
yours as well.  It might just take me a week or so til I've got some
time to do more than browse though, but I will post my notes.

Mike

Re: OT: web app kits Was: Announcing: Mod_python Servlets

Posted by Daniel Popowich <dp...@mtrsd.k12.ma.us>.
Michael C. Neel writes:

>> On Thu, 2004-05-27 at 15:09, Daniel J. Popowich wrote:
>>
>
>>> > I did look at Albatross, albeit trivially.  I was scared off almost
>>> > immediately by the templating and macros.  I really, really, REALLY,
>>> > don't like coding web apps in that paradigm.
>
>>
>> If you took it to be like a psp or php system...


This is certainly the impression one gets (I got) when at the
Albatross home page.  As I've already said, psp/php/asp/etc are not my
cup of tea, so I didn't go very deep in my exploration of it.

Perhaps an easily accessible tutorial ("Hello, World!") would help,
too.  That's one reason I didn't want to publish without first putting
together a fairly comprehensive tutorial: without it, Servlets are too
hard to explain, with it, it looks like common sense (well, to someone
familiar with OO).


>>> > Also, it seemed to have
>>> > its own implementation of many features (sessions, for example) that
>>> > come out of the box with mod_python.
>
>>
>>
>> When albatross was started, mod_python didn't have session support
>> (at all), it's pretty new...Plus, albatross session support is much
>> more robut than mpd_python's...


Point well taken.


>>> > Here's a trivial difference: on
>>> > Albatross' homepage it says their system is under 2600 lines of code
>>> > according to pycount.  Mine squeaks in just under 400 (the other
>>> > thousand being doc strings, comments and blank lines).  Publisher is
>>> > 158, for comparison.
>
>>
>> I don't think this is relevant, because albatross offers much more
>> options that the other two...


You're right (mostly) that it's not relevant.  HOWEVER, I was, in
part, poking fun at their own hubris.  I quote the second paragraph on
their home page:

  "In slightly less than 2600 lines of Python (according to pycount),
  you get the following:"

Live by the sword, die by the sword, as they say.  And yes, while
Albatross does offer more, that is, in part, my point.  Many of these
web kit packages offer too much, in my opinion.  I'm an ol' unix guy
that likes my tools to do one thing, and one thing well.  If I need
more functionality I'll pipe it on to the next utility.  (And yes, I
hate perl nearly as much as php.)

If I can offer Servlets-and-only-the-Servlets in 400 lines of code and
that's all one wants as the base-line of their toolkit, why use a
system with 6.5 times the code and functionality you never want.

My GOAL was to build something small and simple that can be the basic
building blocks of something larger.


>>> > Mod_python Servlets is small and has NO
>>> > requirements or expectations of the content.  No filtering or content
>>> > processing at ALL.  It is a framework for coding your apps.  If you
>>> > choose to use the framework to filter/process macros in your content,
>>> > fine, but that is something you would build on top of Servlets.
>
>>
>> You can (though I don't know why you would) build an albatross system
>> that didn't ues any of the templating features.  To give you an idea of
>> how it all works (something I really don't think you can get from the
>> site and docs sadly), here is the normal way I go about things, for say
>> a form to email submit:


>> ...


Interesting.  Albatross is probably closer to Servlets than I ever
expected.  I hope you have the opportunity to go through my tutorial
and I look forward to your informed opinion.

Cheers,

Daniel


Re: OT: web app kits Was: Announcing: Mod_python Servlets

Posted by "Michael C. Neel" <ne...@mediapulse.com>.
On Thu, 2004-05-27 at 15:09, Daniel J. Popowich wrote:

> I did look at Albatross, albeit trivially.  I was scared off almost
> immediately by the templating and macros.  I really, really, REALLY,
> don't like coding web apps in that paradigm.  


If you took it to be like a psp or php system, it can be, but it's not
meant to be.  I don't think you can avoid the need for matkup in the
templates, and you really will need some basic if login and loop
control.  98% of what I do is pull a set of rows from the database and
put them in an html table =p.


> Also, it seemed to have
> its own implementation of many features (sessions, for example) that
> come out of the box with mod_python.  


When albatross was started, mod_python didn't have session support (at
all), it's pretty new.  It's also not supported under apache 1.3, so if
like me you need to work in both 2.0 and 1.3 you don't want to have to
switch between methods.

Plus, albatross session support is much more robut than mpd_python's. 
Albatross store the session client side in hidden fields, server side in
files, or even in a session server if the app is spread across multiple
servers, much like you would do with a database.


> Here's a trivial difference: on
> Albatross' homepage it says their system is under 2600 lines of code
> according to pycount.  Mine squeaks in just under 400 (the other
> thousand being doc strings, comments and blank lines).  Publisher is
> 158, for comparison.  


I don't think this is relevant, because albatross offers much more
options that the other two.  Besides the sessions I mentioned, it also
works for cgi, mod_python, fastcgi, and includes it's own httpd server
if you need to develop somewhere you don't have access a real server. 
Also it contains a template engine, which you can extend with custom
tags.


> Mod_python Servlets is small and has NO
> requirements or expectations of the content.  No filtering or content
> processing at ALL.  It is a framework for coding your apps.  If you
> choose to use the framework to filter/process macros in your content,
> fine, but that is something you would build on top of Servlets.


You can (though I don't know why you would) build an albatross system
that didn't ues any of the templating features.  To give you an idea of
how it all works (something I really don't think you can get from the
site and docs sadly), here is the normal way I go about things, for say
a form to email submit:

First request hits mod_python.  Here I will use mod_python to preform
any authentication and security checks.  I know this is done outside of
the application, but I've come to prefer that over the years as the
outside code becomes very portable, and I'm more likely to code an
exploit in the app if I have to write it each time.  It also makes it
easier to check/debug.

Next mod python has the job of setting up  the Albatross app.  This is
where the session preference is set, and also if I'm going to use a page
module scheme or a page object scheme, most the time I prefer page
objects (note that both of these handle more than one html page, usally
for me they handle all pages related to a section, like account
management screens).  This is also where the database connection
(because there is always a database connection, lol) is checked/setup. 
Last, I have some logic to decide which page ojbect will be used for
this request.  Albatross can do this on it's own, but since my scheme is
simple (one object per directory type simple) I find it easier to do it
here and keep that code out of the app itself.

Next the app is run, which loads and executes the page object/module. 
This is all python code, no templates.  A java applet-like interface is
used, where page_enter, page_process, page_display, and page_exit
methods are called.  We know from the http protocol that you reall can't
know all these phases, but Albatross abstracts them from this with it's
session management.

The only two I really use are display, and process.  In process I look
at the request, check the fields, save the database or prepare some
data, send an email or two, or whatever action is needed.  I update the
session with information about errors or what was done, like saving
"Message sent" or "that's not a real email address".  Last, in process I
set the template to use to display the result, which can be a success
page or the same form they just came from if I need more/correct info.

Page display I use to load the template on disk, run it, and send the
results to the client.  I also load up a set of macros to be used in the
template, but don't think of them as macros that do processing, they
really are closer to server side includes that contain the header,
footer, nave, etc.  Each on of these is a separate file that the
designers can edit without involving me in any way.

Besides the above, I've also created some versions of the app that on an
error gather every scrape of data about the crash (env, traceback, point
in the template we were, session vars, etc) and send me an email which
taking the client to an oops.html page.  I can easily switch between an
app the sends these, to one that doesn't, or from one session method to
another - my code lies in the page object after all.

I think the idea is the same between Albatross and Servlets, though the
implementations will differ.  I think that's one of the advantages of
"45 web kits"; each one will take a different approach and we
(developers) end up with alot of choice - which I can never see as a bad
thing =P



> 
> An uninformed assumption: if Mod_python Servlets pre-existed
> Albatross, they might have well used it as a building block for their
> system.


you'll have to ask the object craft guys that, lol.

Mike

Re: OT: web app kits Was: Announcing: Mod_python Servlets

Posted by "Daniel J. Popowich" <dp...@mtrsd.k12.ma.us>.
Michael C. Neel writes:
> > Fast forward a few years.  I looked again at what was out there and
> > found most toolkits were still too "big" or required a "buy-in" to a
> > content form I was unwilling to make.  I felt I was looking at someone
> > else's solution to a content management system rather than a toolkit
> > that allowed me to build my own.  (Which is fine, of course, if what
> > you want is a solution, but a solution does not necessarily make for a
> > good toolkit.)
> > 
> 
> I'm curious if your looked at / tried Albatross and if so can you
> compare / contrast your system to it?  I came to the same about some of
> the other options you mentioned, and your goals of a toolkit are very
> similar to mine, so would value your remarks about Albatross as it's
> what I've set up on.

I did look at Albatross, albeit trivially.  I was scared off almost
immediately by the templating and macros.  I really, really, REALLY,
don't like coding web apps in that paradigm.  Also, it seemed to have
its own implementation of many features (sessions, for example) that
come out of the box with mod_python.  Here's a trivial difference: on
Albatross' homepage it says their system is under 2600 lines of code
according to pycount.  Mine squeaks in just under 400 (the other
thousand being doc strings, comments and blank lines).  Publisher is
158, for comparison.  Mod_python Servlets is small and has NO
requirements or expectations of the content.  No filtering or content
processing at ALL.  It is a framework for coding your apps.  If you
choose to use the framework to filter/process macros in your content,
fine, but that is something you would build on top of Servlets.

An uninformed assumption: if Mod_python Servlets pre-existed
Albatross, they might have well used it as a building block for their
system.