Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Web development with Python 3.1
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 76 - 90 of 90 - Collapse all  -  Translate all to Translated (View all originals) < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bruno Desthuilliers  
View profile  
 More options Oct 31, 1:15 am
Newsgroups: comp.lang.python
From: Bruno Desthuilliers <bruno.42.desthuilli...@websiteburo.invalid>
Date: Fri, 30 Oct 2009 15:15:02 +0100
Local: Sat, Oct 31 2009 1:15 am
Subject: Re: Web development with Python 3.1
Dotan Cohen a écrit :

>>> Look at this "templating code":
>>> {% for entry in blog_entries %}
>>>    <h2>{{ entry.title }}</h2>
>>>    <p>{{ entry.body }}</p>
>>> {% endfor %}
>> What's the problem ? Simple, clear and obvious.

> 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 ?-)

>>> Why would I want to learn that when Python already has a real for
>>> loop ?
>> If you know even 101 Python, understanding the above code shouldn't be such
>> a great challenge !-)

> It is not a great challenge, but it is redundant. Learning Django
> language

<pedantic>
Django's templating language, actually
</pedantic>

> won't help me learn Python any more than learning PHP would.
> So going from PHP to Django is pointless.

Please get out of the "server page" mindset. Templates are just that :
templates. Period. You don't use templates to write your *applicative* code.

>>> I know HTML, and I have a goal of learning Python for it's
>>> reusability (desktop apps, for instance).
>> Using templates instead of harcoding HTML in the applicative code actually
>> plays a big part when it comes to reusability.

> I meant reusable knowledge, not reusable code.

There's very few "reusable knowledge" to be gained from templating code
anyway- even if using a "python-based" template system like Mako. Unless
you think doing a loop or a conditional are things you need to learn ?-)

>> Telling Django's template
>> loader where to look for templates is just a matter of configuration, so
>> using templates you can segment your whole project in small, possibly
>> reusable apps - then in another project where you need the same features but
>> with a totally different presentation, it's just a matter of writing
>> project-specific templates. Quite a few django apps work that way, and they
>> really save you a LOT of time. This wouldn't be possible using your beloved
>> antipattern...

> I think that the time that I invest codng in Python as opposed to
> Django Template Language is time well spent.

Then write your own templating system - and your own framework FWIW !-)

>>> I don't want to learn some
>>> "templating language" that duplicates what Python already has built
>>> in!
>> Then use Mako - it uses plain Python to manage the presentation logic.

> Now we're talking! I will look further into Pylons and Mako.

Beware that the above comments about how less there's to learn from the
templates code still apply - basically, the "programming" part of a
template is restricted to simple branching, iterations, and variable
substitution.

>> Now wrt/ "why having a distinct templating language", there are pros and
>> cons. On the pros side, having a language that is clearly restricted to
>> presentation logic prevents you (and anyone else working on the project -
>> and sometimes you have to deal with well-below-average guys in your team) to
>> put anything else than presentation logic in the templates.

> I don't expect to ever have a "team",

Possibly not. But as strange as it migh be, there are other peoples that
do, and most of these frameworks are written by professional web
programmers.

>> Now, as far as I'm concerned, having Mako instead of Django's templates
>> wouldn't bother me at all. But Django has it's own template system, which
>> from experience get the job done (believe me, there are way worse
>> alternatives), and the overall qualities and features of the whole framework
>> are IMHO enough to justify learning it's templating language.

> I see. I will have to spend some time with each to decide, though.

That's usually the best thing to do - take a couple days doing the
tutorials, and choose the one that fits your brain.

>> Given the restricted and rather unintersting nature of pure presentation
>> logic, you won't learn much from this part of the project anyway. You'd
>> probably learn way more using Django's templates and learning how to write
>> your own template tags. Or if you prefer Mako / Pylons, learning to make
>> proper use of Mako's advanced features. But one thing is clear - if you
>> persist on applying your favorite antipattern, you'll just waste more of
>> your time. Your choice, as usual...

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

If so, you shouldn't use *any* third-part libs, and possibly not even
the stdlib.

More seriously : reinventing the wheel - unless for educational purposes
- is not really pythonic. If what you want is to learn, write your own
framework, template system, form handling etc... You'll very certainly
find out that they suck big time compared to existing projects, but
you'll learn _at least_ one thing: that writing a sensible non-trivial
framework or lib is *hard*.

Once again, been here, done that...

> However I am aware that some things I
> should not touch for security reasons. That is why I want a framework:
> to provide the security aspects of things like converting UTF-8,

from what and to what ?-)

string / unicode encoding and decoding is a builtin Python feature.

> database escaping,

Already provided by any DB-API compliant connector, at least if
correctly used.

Now there's *much* more in security (specially when doing web
programming) than this...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Terry Reedy  
View profile  
 More options Oct 31, 6:25 am
Newsgroups: comp.lang.python
From: Terry Reedy <tjre...@udel.edu>
Date: Fri, 30 Oct 2009 15:25:14 -0400
Local: Sat, Oct 31 2009 6:25 am
Subject: Re: Web development with Python 3.1

Dotan Cohen wrote:

> It is clear and obvious. But it has the "template engine" duplicating
> a function that Python has built in.

...

>> Then use Mako - it uses plain Python to manage the presentation logic. And
>> if you go for Mako, then you might as well switch to Pylons. Great framework
>> too (better than Django on some parts FWIW), but you'll probably need much
>> more time to be fully productive with it (power and flexibility come with a
>> price...).

> Now we're talking! I will look further into Pylons and Mako.

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 <% ...>.

Terry Jan Reedy


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dotan Cohen  
View profile  
 More options Oct 31, 7:55 am
Newsgroups: comp.lang.python
From: Dotan Cohen <dotanco...@gmail.com>
Date: Fri, 30 Oct 2009 22:55:21 +0200
Local: Sat, Oct 31 2009 7:55 am
Subject: Re: Web development with Python 3.1

>> 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.

>> won't help me learn Python any more than learning PHP would.
>> So going from PHP to Django is pointless.

> Please get out of the "server page" mindset. Templates are just that :
> templates. Period. You don't use templates to write your *applicative* code.

I understand that.

>> I meant reusable knowledge, not reusable code.

> There's very few "reusable knowledge" to be gained from templating code
> anyway- even if using a "python-based" template system like Mako. Unless you
> think doing a loop or a conditional are things you need to learn ?-)

I would say that one needs to know how to do a for loop in Python, in
order to program in Python!

>>> Then use Mako - it uses plain Python to manage the presentation logic.

>> Now we're talking! I will look further into Pylons and Mako.

> Beware that the above comments about how less there's to learn from the
> templates code still apply - basically, the "programming" part of a template
> is restricted to simple branching, iterations, and variable substitution.

I see.

>> I don't expect to ever have a "team",

> Possibly not. But as strange as it migh be, there are other peoples that do,
> and most of these frameworks are written by professional web programmers.

I therefore counter that these frameworks were designed for people
unlike myself, which easily explains my resistance to them.

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

> If so, you shouldn't use *any* third-part libs, and possibly not even the
> stdlib.

THat is going just a bit far!

> More seriously : reinventing the wheel - unless for educational purposes -
> is not really pythonic. If what you want is to learn, write your own
> framework, template system, form handling etc... You'll very certainly find
> out that they suck big time compared to existing projects, but you'll learn
> _at least_ one thing: that writing a sensible non-trivial framework or lib
> is *hard*.

Actually, I konw just how hard it is. PHP and some C in university.

>> However I am aware that some things I
>> should not touch for security reasons. That is why I want a framework:
>> to provide the security aspects of things like converting UTF-8,

> from what and to what ?-)

Into and out of the database.

> string / unicode encoding and decoding is a builtin Python feature.

I know, but I need to play with it a bit before I become comfortable
with how it is handled.

>> database escaping,

> Already provided by any DB-API compliant connector, at least if correctly
> used.

> Now there's *much* more in security (specially when doing web programming)
> than this...

Of course. But these are the relevant issues for Python.

--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dotan Cohen  
View profile  
 More options Oct 31, 7:56 am
Newsgroups: comp.lang.python
From: Dotan Cohen <dotanco...@gmail.com>
Date: Fri, 30 Oct 2009 22:56:47 +0200
Local: Sat, Oct 31 2009 7:56 am
Subject: 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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Kern  
View profile  
 More options Oct 31, 8:13 am
Newsgroups: comp.lang.python
From: Robert Kern <robert.k...@gmail.com>
Date: Fri, 30 Oct 2009 16:13:58 -0500
Local: Sat, Oct 31 2009 8:13 am
Subject: 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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
erob  
View profile  
 More options Oct 31, 10:01 am
Newsgroups: comp.lang.python
From: erob <robillard.etie...@gmail.com>
Date: Fri, 30 Oct 2009 16:01:27 -0700 (PDT)
Local: Sat, Oct 31 2009 10:01 am
Subject: Re: Web development with Python 3.1
On Oct 28, 5:16 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:

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    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
erob  
View profile  
 More options Oct 31, 10:16 am
Newsgroups: comp.lang.python
From: erob <robillard.etie...@gmail.com>
Date: Fri, 30 Oct 2009 16:16:55 -0700 (PDT)
Local: Sat, Oct 31 2009 10:16 am
Subject: Re: Web development with Python 3.1
On Oct 30, 7:01 pm, erob <robillard.etie...@gmail.com> wrote:

"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    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dotan Cohen  
View profile  
 More options Oct 31, 8:01 pm
Newsgroups: comp.lang.python
From: Dotan Cohen <dotanco...@gmail.com>
Date: Sat, 31 Oct 2009 11:01:42 +0200
Local: Sat, Oct 31 2009 8:01 pm
Subject: 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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mario ruggier  
View profile  
 More options Nov 4, 2:50 am
Newsgroups: comp.lang.python
From: mario ruggier <mario.rugg...@gmail.com>
Date: Tue, 3 Nov 2009 07:50:22 -0800 (PST)
Local: Wed, Nov 4 2009 2:50 am
Subject: 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=browse&show=all&c=533

m.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rustom  
View profile  
 More options Nov 5, 3:57 am
Newsgroups: comp.lang.python
From: rustom <rustompm...@gmail.com>
Date: Wed, 4 Nov 2009 08:57:41 -0800 (PST)
Local: Thurs, Nov 5 2009 3:57 am
Subject: 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/


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruno Desthuilliers  
View profile  
 More options Nov 5, 8:23 pm
Newsgroups: comp.lang.python
From: Bruno Desthuilliers <bruno.42.desthuilli...@websiteburo.invalid>
Date: Thu, 05 Nov 2009 10:23:44 +0100
Local: Thurs, Nov 5 2009 8:23 pm
Subject: 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).

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rustom  
View profile  
 More options Nov 5, 9:54 pm
Newsgroups: comp.lang.python
From: rustom <rustompm...@gmail.com>
Date: Thu, 5 Nov 2009 02:54:55 -0800 (PST)
Local: Thurs, Nov 5 2009 9:54 pm
Subject: 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/string.html#template-strings


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruno Desthuilliers  
View profile  
 More options Nov 5, 11:16 pm
Newsgroups: comp.lang.python
From: Bruno Desthuilliers <bruno.42.desthuilli...@websiteburo.invalid>
Date: Thu, 05 Nov 2009 13:16:36 +0100
Local: Thurs, Nov 5 2009 11:16 pm
Subject: Re: Web development with Python 3.1
rustom a écrit :

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

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rustom  
View profile  
 More options Nov 5, 11:38 pm
Newsgroups: comp.lang.python
From: rustom <rustompm...@gmail.com>
Date: Thu, 5 Nov 2009 04:38:40 -0800 (PST)
Local: Thurs, Nov 5 2009 11:38 pm
Subject: Re: Web development with Python 3.1
On Nov 5, 5:16 pm, Bruno Desthuilliers <bruno.

This is said in the context of some of Dotan's quotes eg.

> I am not a programmer by trade, only by hobby.
> I want to learn Python not Django

etc

Python is generally imperative.
Templates are by and large declarative.

To get this 'Aha' across to him (remember he said hes a mechanical
engineer) is (IMHO) more important than converting him to some moral
high ground of reusability or some other nice software engineering
jargon.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan Harris-Reid  
View profile  
 More options Nov 8, 1:08 pm
Newsgroups: comp.lang.python
From: Alan Harris-Reid <a...@baselinedata.co.uk>
Date: Sun, 08 Nov 2009 02:08:22 +0000
Local: Sun, Nov 8 2009 1:08 pm
Subject: Re: Web development with Python 3.1

Thanks for those links Mario - I'll check them out asap..

Regards,
Alan


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google