Python web development that resembles PHP or classic ASP

erik.oosterwaal at gmail.com erik.oosterwaal at gmail.com
Mon May 26 17:24:19 EDT 2008


> There are a couple points I don't get here. Mostly: how is your
> application logic separated from the presentation logic if you "intermix
> code directly into the HTML" ? Or are you pages including the libs,
> getting the appropriate data out of the DB, and then including another
> file acting as a template ? If so, then how are you're "pages" different
> from MVC frameworks controllers ?

I have the WSC files as "libraries" I can open in a standard ASP page,
So for example, to get a recordset in one of my ASP pages, I would use
something like

	Dim objUsers, Recordset_of_users
	Set objUsers= GetObject("script:" & Server.MapPath("/~components/
users.wsc"))
		objUsers.open()
		Set Recordset_of_users =
objUsers.getUsersByGroup(request.queryString("group_id"))
		objUsers.close()
	Set objUsers= Nothing

I put code like this at the top of my ASP pages, and inside the HTML
code I can use "Recordset_of_users" and loop through it (for example).
All code in the asp pages is getting and setting information, or
looping through it. All real (business) logic is inside the WSC files.

The only real difference is that I don't use the "C" of MVC. I dislike
a controller that calls and routes functionality based on the URL. The
M (model) functionality is covered by the WSC files. The V (view) are
the asp pages themselves. The controller part is handled by the asp
pages aswell, just using regular links, GETs and POSTs in forms.

> But, IMHO, writing PHP-style Python webapp is silly.

:) Maybe I need to pick up a new style of programming as well, on top
of just a new language...

> Better shoot yourself in the foot with a PHP-like Python-thing, than
> committing suicide by shooting yourself into the head with PHP ...

LOL, point taken.

So to summarize: it should be possible to get exactly what I want, but
it's not advisable, because the frameworks aren't designed to work
like this. That makes sense.
I want to thank you guys for all the advice, I have a lot of
frameworks and template-engines to look into now, I'll have a look at
all that you mentioned to see which one suits me best. Judging from
the quick and thorough support from the Python community, I think I
will stick with a proven framework and/or style, so I can ask a
question once in a while.
There is probably less sense in trying to pick up a new language while
at the same time trying to stick to the methods I used in an old
language. But hey, I thought, maybe a thing like this already exists
exactly like I want it... Ah well.

Thanks again all, take care!

Erik






More information about the Python-list mailing list