Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'anyway.': 0.04; 'django.': 0.05; 'missed': 0.09; 'python': 0.09; 'system?': 0.09; 'static': 0.13; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'googling': 0.16; 'messy': 0.16; 'seperate': 0.16; 'templating': 0.16; 'wrote:': 0.17; 'url:moin': 0.17; 'examples': 0.18; '(not': 0.20; 'code.': 0.20; 'bit': 0.21; 'example': 0.23; 'work.': 0.23; "haven't": 0.23; 'idea': 0.24; 'least': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'url:wiki': 0.26; "i'm": 0.29; "skip:' 10": 0.30; 'code': 0.31; 'url:python': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'list': 0.35; 'doing': 0.35; 'pm,': 0.35; 'received:org': 0.36; 'but': 0.36; 'message- id:@gmail.com': 0.36; 'url:org': 0.36; 'method': 0.36; 'useful': 0.36; 'does': 0.37; 'uses': 0.37; 'previous': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'link': 0.60; 'most': 0.61; 'you.': 0.61; 'first': 0.61; 'provide': 0.62; 'mentioned': 0.63; 'more': 0.63; 'become': 0.65; 'choose': 0.65; 'others:': 0.84; 'to:name:python': 0.84; 'engines.': 0.91; 'url:fr': 0.95 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Mon, 04 Mar 2013 20:56:14 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12 MIME-Version: 1.0 To: python Subject: Re: Embedding a for inside an html template for substitution References: <1a5a68d8-a97e-4069-a860-c7737dd5a503@googlegroups.com> <6ce88927-ed2f-4045-a23c-033f18cb332a@googlegroups.com> <5134FEB5.4090104@gmail.com> In-Reply-To: <5134FEB5.4090104@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362455785 news.xs4all.nl 6959 [2001:888:2000:d::a6]:47303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40499 On 03/04/2013 01:06 PM, Ferrous Cranus wrote: > What do you advise me to do? > Generate html via python code like print '''stuf......''' or use an > html templating system? > Up until now i was using the first method and i though it would be a > nice idea to seperate design from code. > > But please also provide me a simple example of 'files.html' and > 'files.py' so i can understand how does the templating system you > mentioned work. Was it Django?! Just generating html code is simple, but it does become a bit messy over time. Check out that link in my previous e-mail to a list of python templating engines. Choose one and try it. No I cannot provide any example code. I haven't used any of these systems; I'm just googling for you. Most of them come with examples anyway. Check out, among others: http://www.cheetahtemplate.org/docs/users_guide_html/ And actually this one uses cheetah to do static pages (not a full-blown web app): http://www.ivy.fr/tahchee/ I do recommend you at least take a look at Django. It may be overkill for your needs. It does contain a templating engine, but it also contains a whole lot more useful things for doing web-based applications. Here's the link in case you missed it: http://wiki.python.org/moin/Templating