Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Web development with Python 3.1

Reply
Thread Tools

Re: Web development with Python 3.1

 
 
Dotan Cohen
Guest
Posts: n/a
 
      10-30-2009
> I took a look a both yesterday. They are both generic text templating
> systems that seem to pretty much do the same thing. I suspect you will
> prefer Mako since it avoids duplicating Python's comtrol structures. But I
> think it worthwhile to look at both anyway since doing so will help to
> separate the concepts from the particular implementations.
>
> My take on them is this: when text mixes code that is meant to be
> interpreted and text data meant to be taken literally, some means must be
> devised to distinguish the two. In programs files, the code is left unquoted
> and the text data is quoted. In template files, the marking is reversed: the
> literal text is left unquoted and the code *is* quoted. In Mako, expressions
> are quoted with braces ({...}), single statements with '%' prefix, and
> multiple statements as well as Mako tags with <% ...>.
>


Thanks, Terry, that should save me some time.


--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      10-30-2009
On 2009-10-30 15:55 PM, Dotan Cohen wrote:
>>> It is clear and obvious. But it has the "template engine" duplicating
>>> a function that Python has built in. My goal is to learn reusable
>>> Python (reusable for non-web projects). My goal is not to find the
>>> quickest way to a website.

>>
>> Please correct me if I'm wrong, but you did learn HTML, CSS and SQL, didn't
>> you ? How do any of these languages relates to Python ?-)

>
> HTML and CSS yes, but just enough SQL to fake it. None of those
> languages relate to Python, each language performs a different
> function. However, the template language looks completely redundant as
> it duplicates functionality of the language that I intend to learn.


Templating languages serve a different, highly specialized purpose. They may
have similar flow constructs, but the context and specializations matter a lot.
Use the right language for the job. Sometimes the job is a weird mix of concerns
and requires a weird mix of constructs to be convenient. If you're writing web
apps, you should learn a templating language. If you're primarily concerned with
learning Python and nothing else, you should find a different kind of project.

But if you insist, you may be interested in Breve:

http://pypi.python.org/pypi/Breve/

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

 
Reply With Quote
 
 
 
 
erob
Guest
Posts: n/a
 
      10-30-2009
On Oct 28, 5:16*am, "Diez B. Roggisch" <(E-Mail Removed)> wrote:
> Dotan Cohen schrieb:
>
>
>
> >> While I know that to be true in the general sense, from what I've
> >> looked at Django and other frameworks it seems that the web frameworks
> >> push the coder to use templates, not letting him near the HTML.

>
> >> For instance, I was looking for a class / framework that provided a
> >> proven method of decoding cookies (setting them is no problem),
> >> decoding POST and GET variables, escaping variables for safe entry
> >> into MySQL, and other things. Django and the other frameworks seem to
> >> force the user to use templates. I just want the functions, and to
> >> print the HTML as stdout to the *browser making the request. I had to
> >> settle on PHP to do this, which admittedly is what PHP was invented to
> >> do. However, for obvious reasons, I would have prefered to code in
> >> Python. In fact, I still would.

>
> > I should probably expand on this:

>
> > How can I get an array with all the GET variables in Python?
> > How can I get an array with all the POST variables in Python?
> > How can I get an array with all the COOKIE variables in Python?
> > How can I get the request URI path (everything after
> >http://[www.?]example.com/)?

>
> > That's all I want: no templates and nothing between me and the HTML.
> > The HTTP headers I can output to stdout myself as well.

>
> Again: if you insist on doing everything yourself - then of course any
> library or framework isn't for you.
>
> But then do you deal with headers correctly? Do you respect character
> encodings? Form-encodings? Is your generated HTML valid? Are
> timestamp-formats generated according to RFCs for your cookies? Do you
> parse content negotiation headers?
>
> I think you underestimate the task it is to make a webapplication good.
> And even if not, what you will do is ... code your own webframework.
> Because there is a lot of boilerplate otherwis. If that's a
> learning-experience your after, fine.
>
> Besides, yes, you can get all these things nonetheless. You just don't
> need them most of the time.
>
> And at least pylons/TG2 lets you return whatever you want instead, as a
> string. Not via "print" though - which is simply only for CGI, and no
> other means (e.g. mod_wsgi) of python-web-programming.
>
> Diez


notmm uses Python 2.6 and will probably work just fine with Python
3000.


Cheers,

Etienne

P.S - We all don't think in the same box.
 
Reply With Quote
 
erob
Guest
Posts: n/a
 
      10-30-2009
On Oct 30, 7:01*pm, erob <(E-Mail Removed)> wrote:
> On Oct 28, 5:16*am, "Diez B. Roggisch" <(E-Mail Removed)> wrote:
>
>
>
> > Dotan Cohen schrieb:

>
> > >> While I know that to be true in the general sense, from what I've
> > >> looked at Django and other frameworks it seems that the web frameworks
> > >> push the coder to use templates, not letting him near the HTML.

>
> > >> For instance, I was looking for a class / framework that provided a
> > >> proven method of decoding cookies (setting them is no problem),
> > >> decoding POST and GET variables, escaping variables for safe entry
> > >> into MySQL, and other things. Django and the other frameworks seem to
> > >> force the user to use templates. I just want the functions, and to
> > >> print the HTML as stdout to the *browser making the request. I had to
> > >> settle on PHP to do this, which admittedly is what PHP was invented to
> > >> do. However, for obvious reasons, I would have prefered to code in
> > >> Python. In fact, I still would.

>
> > > I should probably expand on this:

>
> > > How can I get an array with all the GET variables in Python?
> > > How can I get an array with all the POST variables in Python?
> > > How can I get an array with all the COOKIE variables in Python?
> > > How can I get the request URI path (everything after
> > >http://[www.?]example.com/)?

>
> > > That's all I want: no templates and nothing between me and the HTML.
> > > The HTTP headers I can output to stdout myself as well.

>
> > Again: if you insist on doing everything yourself - then of course any
> > library or framework isn't for you.

>
> > But then do you deal with headers correctly? Do you respect character
> > encodings? Form-encodings? Is your generated HTML valid? Are
> > timestamp-formats generated according to RFCs for your cookies? Do you
> > parse content negotiation headers?

>
> > I think you underestimate the task it is to make a webapplication good.
> > And even if not, what you will do is ... code your own webframework.
> > Because there is a lot of boilerplate otherwis. If that's a
> > learning-experience your after, fine.

>
> > Besides, yes, you can get all these things nonetheless. You just don't
> > need them most of the time.

>
> > And at least pylons/TG2 lets you return whatever you want instead, as a
> > string. Not via "print" though - which is simply only for CGI, and no
> > other means (e.g. mod_wsgi) of python-web-programming.

>
> > Diez

>
> notmm uses Python 2.6 and will probably work just fine with Python
> 3000.
>
> Cheers,
>
> Etienne
>
> P.S - We all don't think in the same box.


"I am free, no matter what rules surround me. If I find them
tolerable, I tolerate them; if I find them too obnoxious, I break
them. I am free because I know that I alone am morally responsible for
everything I do." -- Robert A. Heinlein
 
Reply With Quote
 
Dotan Cohen
Guest
Posts: n/a
 
      10-31-2009
>> notmm uses Python 2.6 and will probably work just fine with Python
>> 3000.
>>


The only reference to "notmm" that I could find in Google was this thread!


> "I am free, no matter what rules surround me. If I find them
> tolerable, I tolerate them; if I find them too obnoxious, I break
> them. I am free because I know that I alone am morally responsible for
> everything I do." -- Robert A. Heinlein
>


Heinlein said that? It's been a long time since I've read Heinlein,
and his quotes are as vivid as his books.

--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
 
Reply With Quote
 
mario ruggier
Guest
Posts: n/a
 
      11-03-2009
With respect to to original question regarding web frameworks +
database and Python 3, all the following have been available for
Python 3 since the day Python 3.0 was released:

QP, a Web Framework
http://pypi.python.org/pypi/qp/

Durus, a Python Object Database (the "default" in qp, for user
sessions, etc)
http://pypi.python.org/pypi/Durus/

Evoque, state-of-the-art templating engine
http://pypi.python.org/pypi/evoque/
(this one is available for py3.0 since a little later, 21-jan-2009)

All the above also runs on python 2.4 (thru to python 3)

For the record, you may see the list of all pypi packages availabe for
Python 3 at:
http://pypi.python.org/pypi?:action=...show=all&c=533

m.
 
Reply With Quote
 
rustom
Guest
Posts: n/a
 
      11-04-2009
On Oct 30, 6:23*pm, Dotan Cohen <(E-Mail Removed)> wrote:

> The point is that I want to use only _Python_ features, not
> Django/Mako/whatever features.


Pure python has a builtin templating system -- its called %

See http://simonwillison.net/2003/Jul/28/simpleTemplates/
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      11-05-2009
rustom a écrit :
> On Oct 30, 6:23 pm, Dotan Cohen <(E-Mail Removed)> wrote:
>
>> The point is that I want to use only _Python_ features, not
>> Django/Mako/whatever features.

>
> Pure python has a builtin templating system -- its called %


Poor man's template... It only do variable substitutions - no branching
nor iteration (and let's not talk about macros, inclusions, filters etc).

 
Reply With Quote
 
rustom
Guest
Posts: n/a
 
      11-05-2009
On Nov 5, 2:23*pm, Bruno Desthuilliers <bruno.
(E-Mail Removed)> wrote:
> rustom a écrit :
>
> > On Oct 30, 6:23 pm, Dotan Cohen <(E-Mail Removed)> wrote:

>
> >> The point is that I want to use only _Python_ features, not
> >> Django/Mako/whatever features.

>
> > Pure python has a builtin templating system -- its called *%

>
> Poor man's template... It only do variable substitutions - no branching
> nor iteration (and let's not talk about macros, inclusions, filters etc).


I realised that that link
http://simonwillison.net/2003/Jul/28/simpleTemplates/
was written in 2003

Subsequently python has sprouted something explicitly templateish
http://docs.python.org/library/strin...mplate-strings
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      11-05-2009
rustom a écrit :
> On Nov 5, 2:23 pm, Bruno Desthuilliers <bruno.
> (E-Mail Removed)> wrote:
>> rustom a écrit :
>>
>>> On Oct 30, 6:23 pm, Dotan Cohen <(E-Mail Removed)> wrote:
>>>> The point is that I want to use only _Python_ features, not
>>>> Django/Mako/whatever features.
>>> Pure python has a builtin templating system -- its called %

>> Poor man's template... It only do variable substitutions - no branching
>> nor iteration (and let's not talk about macros, inclusions, filters etc).

>
> I realised that that link
> http://simonwillison.net/2003/Jul/28/simpleTemplates/
> was written in 2003
>
> Subsequently python has sprouted something explicitly templateish
> http://docs.python.org/library/strin...mplate-strings


Still poor man's template. Just don't hope to do any realworld web
templating with this.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Application development vs windows client development cabernet123@hotmail.com ASP .Net 0 11-17-2005 12:09 AM
Lisp development with macros faster than Python development?.. seberino@spawar.navy.mil Python 37 07-11-2005 02:10 PM
Web Clients, the role of ASP.NET and the Future of Web Development and Web Standards Guadala Harry ASP .Net 9 11-06-2004 03:05 AM
development environment architecture for ASP.NET development team Akhlaq Khan ASP .Net 4 09-27-2004 01:33 PM
Re: Development best practices and knowing when to exercise control over development Kevin Spencer ASP .Net 2 08-06-2003 09:33 PM



Advertisments