IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Maybe we should share.
I like at the top of the writeup Ben linked to that almost everyone writes a template system at some point - generally to reflect certain specific needs at the time.

I've linked to [link|http://yceran.org/qompose/|Qompose] before; is your template system available for general perusal?

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New Not ready for perusal
I really can't show it off right now because I'm in the middle of rewriting it, having just separated it from the ORM I wrote at the same time.

..but I can describe it. And I might as well name it: "Cation". Pronounce in two or three syllables as you see fit.

The actual templating is bare bones: slurp in a template and substitute in a dictionary (aka hashmap). That's all encapsulated in a nice base class, an "Assembly", which makes that easier, but that's the basic methodology. No flow control (or any code) inside templates, just static text. If you want to repeat table rows, for example, that doesn't go in the template; it goes in the handler script. The template would just write:

<table>\n    %(TableRows)s\n</table>


The templating is really the weakest part at the moment, and I may rewrite it on a whim sometime soon. But Cation is a larger app framework. I always like to describe frameworks primarily by pointing out those places where you can easily flex them. So here are the biggies:

0. Not exclusively for web apps. The core Application framework is delivery-method agnostic. But the web app interface is the only well-developed one at this point. The Assembly class is ML-agnostic; I've used it for email bodies as well as HTML, for example.

1. Web server: Comes with an adapter for IIS/ASP, another for Apache/mod_python. Working on a third for WSGI (an emerging Python web standard). These are all 100 lines or less; new ones would be a snap for Twisted, bare CGI, Roxen, AOL, etc. If WSGI takes off, I won't have to care. ;)

2. Handles async servers which expect a callable iterator (instead of write() calls).

3. File-based vs. in-code templates: up to the developer.

4. Data Persistence: not included so grab someone else's (preferably my ORM ;)

5. Use the builtin URI-to-script mapper or roll your own (usually just means a modified regex). Or, bypass the mapper and call _dispatch directly (error page redirection does this, for example).

6. Page caching: up to the developer. Most Cation apps have a persistent module or two--if you want caching, stick a reference to the right Assembly in there.


Other things it does/is/has:

1. Logging
2. Top-level error trapping, logging, and pretty printing
3. Timed, threaded Worker classes for getting things done on a schedule, possibly recurring.
4. Handles central application configs, either from code or INI-style files.
5. Security is minimal. Only keeps a list of superusers at the moment, which is crucial for...
6. Admin web page, from which you can reload modules, get user last login times, see template constants, start/stop/modify workers.
7. Registry of startup/shutdown functions.
8. UI's (active requests) are centrally registered and managed.
9. Data type coercion (both inbound and outbound).
10. Admins can capture profile data per user per request.
11. HTTP uploads.
12. Standard subclasses of Assembly for common html elements: option, input type=checkbox, table, frameset, whole redirect pages.

What it doesn't do:
1. Sessions. Can't get the bloody things to work with ASP and I don't currently need them anyway.
2. No defined interface for remapping scripts. TODO.
3. Lots of things I can't think of right now.




The Sig:
"Despite the seemingly endless necessity for doing
so, it's actually not possible to reverse-engineer intended invariants
from staring at thousands of lines of code (not in C, and not in
Python code either)."

Tim Peters on python-dev
     Ruby on Rails - (cforde) - (8)
         Not I - (ben_tilly) - (7)
             Thanks for the link - (FuManChu) - (2)
                 Maybe we should share. - (static) - (1)
                     Not ready for perusal - (FuManChu)
             In a nutshell - (cforde) - (3)
                 Dumb question regarding mentioned spag code - (boxley) - (2)
                     Re: question regarding mentioned spag code - (cforde) - (1)
                         thats what I was after, thanx -NT - (boxley)

Specifically, they will not save the ship and crew, they will not win a stack of quatloos, and they will especially not get to sleep
62 ms