ANNOUNCE: JOTWeb 1.11, preview of new web application system.

Sean Reifschneider jafo-pythonlist at tummy.com
Thu Jun 19 19:43:28 EDT 2003


On Thu, Jun 19, 2003 at 09:27:59PM +1000, Dave Cole wrote:
>One thing I have discovered is it takes a lot more effort to document
>these toolkits and build examples than it does to build the actual
>toolkit.

That is certainly true...

>Again there is no argument here.  I might add that if the setup is not
>purely exposing data to the templating then there is no way that the
>toolkit will be doing that work for you.  That means that the code has
>to be provided by the application and has to reside somewhere.

Sure.  Along those lines, I'm adding to JOTWeb a way to set up per-site
startup scripts (probably of both HTML/TAL and Python varieties, so that
you can use whichever one is more comfortable).  I'm tempted to add
per-page "configuration" because it would be easy, but it seems that it
can be handled directly in the HTML/TAL (tal:define) or in the normal
python modules.

>If I read your comment correctly you are making the point that it is
>preferable to glue the pieces of application code together by
>references in the templates:
>
>   <span tal:replace="code/currenttime"></span>
>
>which then implicitly imports code.py and invokes currenttime()

I don't really think that it makes sense to have the user have to build
up the namespaceto say what "currenttime" is.  It just makes sense to me
that if you ask for the "currenttime" attribute of the "code" entity,
and you have a module called "code" which contains a function
"currenttime", that you (as an application framework) can go ahead and
call that for the user, instead of making the user go through the extra
step of creating a context, importing the module, and setting up a name
in the name-space...

>In Albatross the glue at that level is all in Python, and in your
>application.  This means that you have to do a little more work in
>locating the code that provides the currenttime() function.  No big
>deal really.

Big Deal or not, it seems to me that like 90% or more of the time when
you have a template and somebody references it, you want to provide a
name-space and render it.  I put a template there for a reason -- to be
rendered to the browser.  I really believe that if that is such a common
case, that the user shouldn't have to do anything special to make it
happen.

It's no big deal to specify time.localtime(time.time()) as the argument
to strftime(), but I definitely think that making that the default was
a good thing...

>From your example above, JOTWeb takes a much finer grained approach in
>that the template identified by the browser request pulls in Python
>code fragments from a namespace structured by the file system.

That's what it boils down to...

It seems to me, now, that you could do the same thing with Albatross,
using a default handler with mod_python and overriding the context.

>When you make something implicit you remove some flexibility from the
>application developer.  I imagine you wondered from time to time when

I'm not sure that I agree that making something implicit prevents it
from being overridden.  So far, in the development I've done with
JOTWeb, I haven't really run into a case where I wanted to change the
default behavior in a way that required me to override the default
rendering code, yet still have it do template rendering.

Sean
-- 
 Hell hath no fury, like a file-system scorned.  -- Sean Reifschneider, 1998
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin
      Back off man. I'm a scientist.   http://HackingSociety.org/





More information about the Python-list mailing list