Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - Re: Web development with Python 3.1

 
Thread Tools Search this Thread
Old 10-30-2009, 08:56 PM   #61
Default Re: Web development with Python 3.1


> 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


Dotan Cohen
  Reply With Quote
Old 10-30-2009, 09:13 PM   #62
Robert Kern
 
Posts: n/a
Default Re: Web development with Python 3.1
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



Robert Kern
  Reply With Quote
Old 10-30-2009, 11:01 PM   #63
erob
 
Posts: n/a
Default Re: Web development with Python 3.1
On Oct 28, 5:16*am, "Diez B. Roggisch" <de...@nospam.web.de> 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.


erob
  Reply With Quote
Old 10-30-2009, 11:16 PM   #64
erob
 
Posts: n/a
Default Re: Web development with Python 3.1
On Oct 30, 7:01*pm, erob <robillard.etie...@gmail.com> wrote:
> On Oct 28, 5:16*am, "Diez B. Roggisch" <de...@nospam.web.de> 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


erob
  Reply With Quote
Old 10-31-2009, 09:01 AM   #65
Dotan Cohen
 
Posts: n/a
Default Re: Web development with Python 3.1
>> 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


Dotan Cohen
  Reply With Quote
Old 11-03-2009, 03:50 PM   #66
mario ruggier
 
Posts: n/a
Default Re: Web development with Python 3.1
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.


mario ruggier
  Reply With Quote
Old 11-04-2009, 04:57 PM   #67
rustom
 
Posts: n/a
Default Re: Web development with Python 3.1
On Oct 30, 6:23*pm, Dotan Cohen <dotanco...@gmail.com> 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/


rustom
  Reply With Quote
Old 11-05-2009, 09:23 AM   #68
Bruno Desthuilliers
 
Posts: n/a
Default Re: Web development with Python 3.1
rustom a écrit :
> On Oct 30, 6:23 pm, Dotan Cohen <dotanco...@gmail.com> 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).



Bruno Desthuilliers
  Reply With Quote
Old 11-05-2009, 10:54 AM   #69
rustom
 
Posts: n/a
Default Re: Web development with Python 3.1
On Nov 5, 2:23*pm, Bruno Desthuilliers <bruno.
42.desthuilli...@websiteburo.invalid> wrote:
> rustom a écrit :
>
> > On Oct 30, 6:23 pm, Dotan Cohen <dotanco...@gmail.com> 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


rustom
  Reply With Quote
Old 11-05-2009, 12:16 PM   #70
Bruno Desthuilliers
 
Posts: n/a
Default Re: Web development with Python 3.1
rustom a écrit :
> On Nov 5, 2:23 pm, Bruno Desthuilliers <bruno.
> 42.desthuilli...@websiteburo.invalid> wrote:
>> rustom a écrit :
>>
>>> On Oct 30, 6:23 pm, Dotan Cohen <dotanco...@gmail.com> 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.


Bruno Desthuilliers
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Software Development Company hanusoft Software 0 12-23-2007 06:52 AM
Regarding MSTS SharePoint 2007 and WSS 3.0 Application Development Shiva MCTS 6 12-06-2007 06:32 AM
Business Software Development hanusoft Software 0 11-16-2007 01:21 PM
DVD Verdict reviews: ARRESTED DEVELOPMENT: SEASON TWO and more! DVD Verdict DVD Video 0 10-11-2005 09:16 AM
The Practice Test Package Development: A New Service on the Certification Market David Johnson A+ Certification 0 01-19-2005 10:52 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46