Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40469

Re: Embedding a for inside an html template for substitution

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <nikos.gr33k@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'thats': 0.07; 'python': 0.09; 'script,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'template': 0.11; 'marker': 0.16; 'script?': 0.16; 'substituted': 0.16; 'templating': 0.16; 'wrote:': 0.17; 'url:moin': 0.17; 'load': 0.19; 'sort': 0.21; 'bit': 0.21; 'parse': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'url:wiki': 0.26; 'am,': 0.27; '(maybe': 0.29; 'cgi': 0.29; 'stuff': 0.30; 'gets': 0.32; 'url:python': 0.32; 'file': 0.32; 'print': 0.32; 'another': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'michael': 0.36; 'but': 0.36; 'url:org': 0.36; 'data.': 0.36; 'thank': 0.36; 'xml': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'instead': 0.39; 'system.': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'kind': 0.61; '8bit%:100': 0.70; '8bit%:92': 0.70; '2013': 0.84; 'liens': 0.84
X-Received by 10.49.1.43 with SMTP id 11mr2111826qej.29.1362417758251; Mon, 04 Mar 2013 09:22:38 -0800 (PST)
Newsgroups comp.lang.python
Date Mon, 4 Mar 2013 09:22:38 -0800 (PST)
In-Reply-To <mailman.2845.1362412789.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=94.68.127.128; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4
References <1a5a68d8-a97e-4069-a860-c7737dd5a503@googlegroups.com> <mailman.2845.1362412789.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 94.68.127.128
MIME-Version 1.0
Subject Re: Embedding a for inside an html template for substitution
From Ferrous Cranus <nikos.gr33k@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.2852.1362417767.2939.python-list@python.org> (permalink)
Lines 63
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362417767 news.xs4all.nl 6971 [2001:888:2000:d::a6]:35755
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40469

Show key headers only | View raw


Τη Δευτέρα, 4 Μαρτίου 2013 5:59:34 μ.μ. UTC+2, ο χρήστης Michael Torrie έγραψε:
> On 03/04/2013 08:14 AM, Ferrous Cranus wrote:
> 
> > Instead of writing the above html data inside my html template how
> 
> > would i write it with a for that then will be substituted by the
> 
> > python script?
> 
> 
> 
> What templating system are you using?  Django's?
> 
> 
> 
> > can you please write an example for me that user "files.html" and
> 
> > gets populates by "files.py" ?
> 
> 
> 
> If you're using a CGI script, just use a normal python for loop and
> 
> print out the stuff you want using this kind of notation:
> 
> 
> 
> for x in xrange(4):
> 
>     print "<tr><td>{0}</td></tr>".format(x)
> 
> 
> 
> 
> 
> Another alternative is to make your own templating system.  Have it load
> 
> and parse the html file (maybe using one of the xml or html parsers),
> 
> and substitude some sort of field marker for data.  But that is
> 
> re-inventing the wheel.
> 
> 
> 
> http://wiki.python.org/moin/Templating



Firstly thank you for your answer, but iam a bit confised.

can i just put the liens you provided me inside "files.html" and thwy will work?

Thats pure pythjon code!

for x in xrange(4): 
    print "<tr><td>{0}</td></tr>".format(x) 

wont html complain?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Embedding a for inside an html template for substitution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-03-04 07:14 -0800
  Re: Embedding a for inside an html template for substitution Michael Torrie <torriem@gmail.com> - 2013-03-04 08:59 -0700
    Re: Embedding a for inside an html template for substitution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-03-04 09:22 -0800
      Re: Embedding a for inside an html template for substitution Michael Torrie <torriem@gmail.com> - 2013-03-04 20:56 -0700
      Re: Embedding a for inside an html template for substitution Roland Koebler <r.koebler@yahoo.de> - 2013-03-05 18:16 +0100
    Re: Embedding a for inside an html template for substitution Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-03-04 09:22 -0800
  Re: Embedding a for inside an html template for substitution nagia.retsina@gmail.com - 2013-03-04 23:46 -0800

csiph-web