Programming.PythonWeb History
Hide minor edits - Show changes to output - Cancel
2009-04-03 13:03 CEST
by
- add cheetah to the template engines to investigateChanged lines 18-19 from:
to:
* cheetah
2009-04-02 09:00 CEST
by
- Added lines 25-26:
Less appealing is the fact that the version I looked at in Debian is quite old, and since then Jinja evolved into something much bigger and somewhat more complex (in 1.2 and 2.x versions) despite not bringing much to the templates themselves.
2009-04-02 08:58 CEST
by
- Changed lines 79-80 from:
* wsgiref, the standard implementation
to:
* wsgiref, the standard implementation in Python 2.5 and later
2009-03-31 09:19 CEST
by
- Changed lines 71-74 from:
Routes has a clean separation of mapping model between URLs and code: it parses specified URL parts into controller, action and arguments to be passed to functions/methods; Then it maps controller and action names to objects and methods through a registry. I find it's easier to work with, and more powerful; It was designed to implement RESTful easily, which is nice and seems effective.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (with names from walking along the object tree). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm not sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside. It's also oriented towards static/predefined URLs.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (with names from walking along the object tree). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm not sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside. It's also oriented towards static/predefined URLs.
to:
'''Routes''' has a clean separation of mapping model between URLs and code: it parses specified URL parts into controller, action and arguments to be passed to functions/methods; Then it maps controller and action names to objects and methods through a registry. I find it's easier to work with, and more powerful; It was designed to implement RESTful easily, which is nice and seems effective.
'''CherryPy''' uses "exposition" of global or member functions to show them directly as URLs (with names from walking along the object tree). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm not sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside. It's also oriented towards static/predefined URLs.
'''CherryPy''' uses "exposition" of global or member functions to show them directly as URLs (with names from walking along the object tree). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm not sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside. It's also oriented towards static/predefined URLs.
2009-03-31 09:17 CEST
by
- Changed line 19 from:
I like Jinja because it's both small and simple to use and powerful all at the same time (remember "small is beautiful" ;-).
to:
I like '''Jinja''' because it's both small and simple to use and powerful all at the same time (remember "small is beautiful" ;-).
Changed line 25 from:
Templayer is more about embedding direct Python inside pages, which I dislike.
to:
'''Templayer''' is more about embedding direct Python inside pages, which I dislike.
Changed lines 28-31 from:
Same for Mako: despite it looks like Jinja (it actually inspired ''Jinja'' partially), and looking exhaustive, it is somewhat complex and embeds too much direct Python in the template for my own taste.
SimpleTAL templates are XML files with special "tal:" attributes on key elements. I want something more generic than XML-only.
SimpleTAL templates are XML files with special "tal:" attributes on key elements. I want something more generic than XML-only.
to:
Same for '''Mako''': despite it looks like Jinja (it actually inspired ''Jinja'' partially), and looking exhaustive, it is somewhat complex and embeds too much direct Python in the template for my own taste.
'''SimpleTAL''' templates are XML files with special "tal:" attributes on key elements. I want something more generic than XML-only.
'''SimpleTAL''' templates are XML files with special "tal:" attributes on key elements. I want something more generic than XML-only.
2009-03-29 23:26 CEST
by
- "ninja" preview downloadAdded lines 64-66:
Actually, by the time I think about it, I started writing a version of this.
Here is [[(Attach:)ninja.py]].
Here is [[(Attach:)ninja.py]].
2009-03-29 23:23 CEST
by
- comment on simpletalChanged lines 17-18 from:
* simpletal
to:
* simpletal NOTOK
Added lines 30-31:
SimpleTAL templates are XML files with special "tal:" attributes on key elements. I want something more generic than XML-only.
2009-03-26 18:37 CET
by
- update CherryPy=NOTOK, comment on MakoChanged line 16 from:
* mako
to:
* mako NOTOK
Changed lines 25-26 from:
Templayer is more about embedding direct Python inside pages, which I dislike. At least, Jinja is "sandboxed" with a restricted but sufficient expression language.
to:
Templayer is more about embedding direct Python inside pages, which I dislike.
At least, Jinja is "sandboxed" with a restricted but sufficient expression language.
Same for Mako: despite it looks like Jinja (it actually inspired ''Jinja'' partially), and looking exhaustive, it is somewhat complex and embeds too much direct Python in the template for my own taste.
At least, Jinja is "sandboxed" with a restricted but sufficient expression language.
Same for Mako: despite it looks like Jinja (it actually inspired ''Jinja'' partially), and looking exhaustive, it is somewhat complex and embeds too much direct Python in the template for my own taste.
Added line 73:
* CherryPy (2.2.x / 3.1.x) NOTOK by itself, OK for bare server in wsgid
Changed lines 75-76 from:
* CherryPy (2.2.x)
to:
2009-03-24 20:20 CET
by
- Changed line 73 from:
Flup is more comprehensive than the Debian package description says.
to:
'''Flup''' is more comprehensive than the Debian package description says.
Changed line 81 from:
CherryPy embeds a threaded WSGI server, URL mapping and other auth/session/cookie/etc tools.
to:
'''CherryPy''' embeds a threaded WSGI server, URL mapping and other auth/session/cookie/etc tools.
Changed lines 84-104 from:
For a web server I prefer the process/fork model, or a mixed one where I could limit the number of threads per process.
to:
For a web server I prefer the process/fork model, or a mixed one where I could limit the number of threads per process.
After some first tries with '''wsgid''' I was disappointed because it didn't work.
A bit of debugging and corrections have shown some parts of it are full of bugs, so I abandonned it at first.
At a 2nd look I saw it embeds the core HTTP server from CherryPy, so I tried to use it more directly and it was a success.
Here is some sample code which works (with v0.7):
from wsgid.servers.cherrypy import WSGIServer
from wsgid.main import get_config as get_wsgid_config
import sys
HTTP_OK = "200 OK"
TYPE_TEXT = ("Content-type", "text/plain")
def hello(env, start):
start(HTTP_OK, [TYPE_TEXT])
yield "Hello, world !\n"
config = get_wsgid_config(sys.argv)
server = WSGIServer(config, hello)
try:
server.start()
except KeyboardInterrupt:
print "Interrupt!"
server.stop()
After some first tries with '''wsgid''' I was disappointed because it didn't work.
A bit of debugging and corrections have shown some parts of it are full of bugs, so I abandonned it at first.
At a 2nd look I saw it embeds the core HTTP server from CherryPy, so I tried to use it more directly and it was a success.
Here is some sample code which works (with v0.7):
from wsgid.servers.cherrypy import WSGIServer
from wsgid.main import get_config as get_wsgid_config
import sys
HTTP_OK = "200 OK"
TYPE_TEXT = ("Content-type", "text/plain")
def hello(env, start):
start(HTTP_OK, [TYPE_TEXT])
yield "Hello, world !\n"
config = get_wsgid_config(sys.argv)
server = WSGIServer(config, hello)
try:
server.start()
except KeyboardInterrupt:
print "Interrupt!"
server.stop()
2009-03-24 20:09 CET
by
- Changed line 27 from:
Now that I think about this subject, I think it won't be very difficult to write an engine like jinja, since even simpler constructs would be enough.
to:
Now that I think about this subject, I think it won't be very difficult (or big) to write an engine like jinja, since even simpler constructs would be enough.
Added line 36:
Even the "," comma is ambiguous: should v|f1 x,y|f2 be computed as (v|f1 x,y)|f2 or v|f1 x,(y|f2).
Added line 52:
\\
Changed line 55 from:
More elaborate sub-template call with arguments:
to:
More elaborate sub-template call with arguments (ok, not quite lightweight yet):
Changed lines 63-66 from:
Routes has a clean separation of mapping model between URLs and code: it parses some URL parts into controller, action and programmer-specified arguments; Then it maps controller and action names to objects and methods through a registry. I find it's easier to work with, and more powerful.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (under their respective name). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (under their respective name). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside.
to:
Routes has a clean separation of mapping model between URLs and code: it parses specified URL parts into controller, action and arguments to be passed to functions/methods; Then it maps controller and action names to objects and methods through a registry. I find it's easier to work with, and more powerful; It was designed to implement RESTful easily, which is nice and seems effective.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (with names from walking along the object tree). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm not sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside. It's also oriented towards static/predefined URLs.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (with names from walking along the object tree). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm not sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside. It's also oriented towards static/predefined URLs.
2009-03-24 14:34 CET
by
- cherry and routes preliminary mapping commentChanged lines 59-60 from:
* CherryPy (2.2.x)
to:
* CherryPy (2.2.x) NOTOK
Routes has a clean separation of mapping model between URLs and code: it parses some URL parts into controller, action and programmer-specified arguments; Then it maps controller and action names to objects and methods through a registry. I find it's easier to work with, and more powerful.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (under their respective name). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside.
Routes has a clean separation of mapping model between URLs and code: it parses some URL parts into controller, action and programmer-specified arguments; Then it maps controller and action names to objects and methods through a registry. I find it's easier to work with, and more powerful.
CherryPy uses "exposition" of global or member functions to show them directly as URLs (under their respective name). Query arguments (GET or POST) are converted to call arguments, which is quite pratical -- though I'm sure how file uploads are handled. Looks somewhat difficult to get clean URLs since it makes the internal code structure appear near-directly outside.
2009-03-24 14:27 CET
by
- thought on making my own template mini-engine (continued)Changed lines 28-30 from:
Basically, you need:
* placeholders for data or text fragments: ${object.attr.val}
* expression language: the filter composition model seems to be smart and fine: ${val|esc} ${val|format "%08X"} ${val|subst "x", "y"};
* placeholders for data or text fragments: ${object.attr.val}
* expression language: the filter composition model seems to be smart and fine: ${val|esc} ${val|format "%08X"} ${val|subst "x", "y"};
to:
Basically, you need (assuming HTML or XML adapted syntax):
* placeholders for data or text fragments:
${object.attr.val}
* expression language: the filter composition model seems to be smart and fine:
${val|esc}
${val|format "%08X"}
${val|subst "x", "y"}
* placeholders for data or text fragments:
${object.attr.val}
* expression language: the filter composition model seems to be smart and fine:
${val|esc}
${val|format "%08X"}
${val|subst "x", "y"}
Changed lines 36-37 from:
* loops: on [range or] iterable (ranges could be generated from expression language), with else part
* conditionals: if, elif, else
* conditionals: if, elif, else
to:
* conditionals:
<?if cond1?>
<?else if cond2?>
<?else?>
<?endif?>
* peudo-variables/functions:
${scope:function}
* loops:
<?for var1[,var2...] in iter1[,iter2...] ?>
${var1}
${for:first/last/inner/only/iternum/odd/even/cycle/...}
<?elsefor?>
<?endfor?>
<?if cond1?>
<?else if cond2?>
<?else?>
<?endif?>
* peudo-variables/functions:
${scope:function}
* loops:
<?for var1[,var2...] in iter1[,iter2...] ?>
${var1}
${for:first/last/inner/only/iternum/odd/even/cycle/...}
<?elsefor?>
<?endfor?>
Added lines 51-54:
Direct inclusion, no arguments:
<?include "template"?>
More elaborate sub-template call with arguments:
<?call "template"[ with arg1="val1", arg2="val2"]?><?block "B1"?>...<?endblock?>...<?endcall?>
<?include "template"?>
More elaborate sub-template call with arguments:
<?call "template"[ with arg1="val1", arg2="val2"]?><?block "B1"?>...<?endblock?>...<?endcall?>
2009-03-24 13:43 CET
by
- thought on making my own template mini-engineChanged lines 11-12 from:
I started to study more thoroughly the following software:
to:
I started to study more thoroughly many python+web-related software:
Changed lines 18-28 from:
!!!! URL mapping to action/view/controllers
* Routes (1.5.2)
* CherryPy (2.2.x)
!!!! WSGI-hosting HTTP server
* Flup (0.2126) NOTOK
* wsgid (0.7, not in Debian) HALFOK
* wsgiref, the standard implementation
* CherryPy (2.2.x)
!!! Comments
* Routes (1.5.2)
* CherryPy (2.2.x)
!!!! WSGI-hosting HTTP server
* Flup (0.2126) NOTOK
* wsgid (0.7, not in Debian) HALFOK
* wsgiref, the standard implementation
* CherryPy (2.2.x)
!!! Comments
to:
Added lines 27-47:
Now that I think about this subject, I think it won't be very difficult to write an engine like jinja, since even simpler constructs would be enough.
Basically, you need:
* placeholders for data or text fragments: ${object.attr.val}
* expression language: the filter composition model seems to be smart and fine: ${val|esc} ${val|format "%08X"} ${val|subst "x", "y"};
Though the single-side '|' call separator prevents more complex multi-arg function composition/call.
* loops: on [range or] iterable (ranges could be generated from expression language), with else part
* conditionals: if, elif, else
* template composition: either inclusion with optional parameters (my preference) or inheritance;
Inheritance seems more complicated and less natural because the syntax to override block definitions in derived templates is heavy and doesn't mix as natural HTML/XML in the page.
Templates could easily be compiled to byte-code on the fly with the compiler in the standard library, then eventually accelerated with Psyco (since it's essentially string handling).
!!!! URL mapping to action/view/controllers
* Routes (1.5.2)
* CherryPy (2.2.x)
!!!! WSGI-hosting HTTP server
* Flup (0.2126) NOTOK
* wsgid (0.7, not in Debian) HALFOK
* wsgiref, the standard implementation
* CherryPy (2.2.x)
Basically, you need:
* placeholders for data or text fragments: ${object.attr.val}
* expression language: the filter composition model seems to be smart and fine: ${val|esc} ${val|format "%08X"} ${val|subst "x", "y"};
Though the single-side '|' call separator prevents more complex multi-arg function composition/call.
* loops: on [range or] iterable (ranges could be generated from expression language), with else part
* conditionals: if, elif, else
* template composition: either inclusion with optional parameters (my preference) or inheritance;
Inheritance seems more complicated and less natural because the syntax to override block definitions in derived templates is heavy and doesn't mix as natural HTML/XML in the page.
Templates could easily be compiled to byte-code on the fly with the compiler in the standard library, then eventually accelerated with Psyco (since it's essentially string handling).
!!!! URL mapping to action/view/controllers
* Routes (1.5.2)
* CherryPy (2.2.x)
!!!! WSGI-hosting HTTP server
* Flup (0.2126) NOTOK
* wsgid (0.7, not in Debian) HALFOK
* wsgiref, the standard implementation
* CherryPy (2.2.x)
2009-03-24 13:18 CET
by
- comment on CherryPyChanged line 19 from:
* CherryPy
to:
* CherryPy (2.2.x)
Changed lines 24-25 from:
* CherryPy
to:
* CherryPy (2.2.x)
Added lines 43-47:
CherryPy embeds a threaded WSGI server, URL mapping and other auth/session/cookie/etc tools.
May look interesting at first, but the provided components aren't WSGI-based, so you end up installing a lot of things with it, of which very few are actually used, because you're going to install and use WSGI variants of those infrastructure components.
Also, the thread-based model is interesting to share database connections, but not so to achieve high performance / parallelism (remember the Python "GIL" -- Global Interpreter Lock).
For a web server I prefer the process/fork model, or a mixed one where I could limit the number of threads per process.
2009-03-24 13:09 CET
by
- reshape presentation of tools, add some commentsChanged lines 12-20 from:
* Jinja (0.9) as a template engine
* Flup (0.2126) as WSGI server -- NOT
and I ''plan'' to study the following:
* Routes (1.5.2) as action/view <-> url mapping
* wsgid (0.7, not in Debian)
* templayer, a template engine
* mako, a template engine
* simpletal, a template engine
* Flup (0.2126) as WSGI server -- NOT
and I ''plan'' to study the following:
* Routes (1.5.2) as action/view <-> url mapping
* wsgid (0.7, not in Debian)
* templayer, a template engine
* mako, a template engine
* simpletal, a template engine
to:
!!!! Template engine
* Jinja (0.9) OK
* templayer NOTOK
* mako
* simpletal
!!!! URL mapping to action/view/controllers
* Routes (1.5.2)
* CherryPy
!!!! WSGI-hosting HTTP server
* Flup (0.2126) NOTOK
* wsgid (0.7, not in Debian) HALFOK
* wsgiref, the standard implementation
* CherryPy
!!! Comments
* Jinja (0.9) OK
* templayer NOTOK
* mako
* simpletal
!!!! URL mapping to action/view/controllers
* Routes (1.5.2)
* CherryPy
!!!! WSGI-hosting HTTP server
* Flup (0.2126) NOTOK
* wsgid (0.7, not in Debian) HALFOK
* wsgiref, the standard implementation
* CherryPy
!!! Comments
Added lines 34-35:
Templayer is more about embedding direct Python inside pages, which I dislike. At least, Jinja is "sandboxed" with a restricted but sufficient expression language.
2009-03-23 11:35 CET
by
- update list of investigated softwareDeleted line 12:
* Routes (1.5.2) as action/view <-> url mapping
Added lines 14-15:
and I ''plan'' to study the following:
* Routes (1.5.2) as action/view <-> url mapping
* Routes (1.5.2) as action/view <-> url mapping
Changed lines 17-18 from:
* wsgiref, the Python-standard sample implementation
to:
* templayer, a template engine
* mako, a template engine
* simpletal, a template engine
* mako, a template engine
* simpletal, a template engine
Deleted lines 33-34:
Need to read documentation on Routes.
2009-03-22 23:22 CET
by
- Changed lines 30-31 from:
to:
Sad, it was quite near and doesn't miss a lot to achieve it :-/
2009-03-22 23:16 CET
by
- not satisfied with FlupChanged lines 14-15 from:
* Flup (0.2126) as WSGI server
to:
* Flup (0.2126) as WSGI server -- NOT
* wsgid (0.7, not in Debian)
* wsgiref, the Python-standard sample implementation
* wsgid (0.7, not in Debian)
* wsgiref, the Python-standard sample implementation
Deleted line 26:
* or plain autonomous threading or forking web servers (which fills my need)
Changed lines 29-30 from:
Well not sure about the plain servers, just missing some doc in the package :(
to:
But actually Flup only has gateways, it is missing a plain HTTP server and hence doesn't meet my needs.
2009-03-22 22:37 CET
by
- Added lines 1-30:
!! Web programming with Python
I want to redevelop a little application I made some years ago with Zope2.
\\
But I want it to be smallest/simplest/smartest/pythonic possible.
Hence multi-megabytes frameworks like Django or Turbogears aren't desired.
So I started to investigate...
After half a day looking for packages in my Debian Etch and reading documentation,
I started to study more thoroughly the following software:
* Jinja (0.9) as a template engine
* Routes (1.5.2) as action/view <-> url mapping
* Flup (0.2126) as WSGI server
I like Jinja because it's both small and simple to use and powerful all at the same time (remember "small is beautiful" ;-).
Though maybe not the fastest one but a bit of Psyco will help for sure.
The doc says it looks like Django a lot, which makes me wonder because it's a lot smaller.
The filters system (inspired by Django) is amazing...
I already plan on writing a "widget framework" through a type-specific view/subview system using a "view" filter.
Flup is more comprehensive than the Debian package description says.
It has
* server gateways for many protocols (including AJP that is more usual to Tomcat and Java application servers)
* or plain autonomous threading or forking web servers (which fills my need)
* session, compression, error management
* basic (but practical) request routing to functions
Well not sure about the plain servers, just missing some doc in the package :(
Need to read documentation on Routes.
I want to redevelop a little application I made some years ago with Zope2.
\\
But I want it to be smallest/simplest/smartest/pythonic possible.
Hence multi-megabytes frameworks like Django or Turbogears aren't desired.
So I started to investigate...
After half a day looking for packages in my Debian Etch and reading documentation,
I started to study more thoroughly the following software:
* Jinja (0.9) as a template engine
* Routes (1.5.2) as action/view <-> url mapping
* Flup (0.2126) as WSGI server
I like Jinja because it's both small and simple to use and powerful all at the same time (remember "small is beautiful" ;-).
Though maybe not the fastest one but a bit of Psyco will help for sure.
The doc says it looks like Django a lot, which makes me wonder because it's a lot smaller.
The filters system (inspired by Django) is amazing...
I already plan on writing a "widget framework" through a type-specific view/subview system using a "view" filter.
Flup is more comprehensive than the Debian package description says.
It has
* server gateways for many protocols (including AJP that is more usual to Tomcat and Java application servers)
* or plain autonomous threading or forking web servers (which fills my need)
* session, compression, error management
* basic (but practical) request routing to functions
Well not sure about the plain servers, just missing some doc in the package :(
Need to read documentation on Routes.