🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #27652

Argumenty w Mako

#27652
From: Witold
Date: Fri, 27 Aug 2010 07:34
34 lines
1540 bytes
Witam,

czytam, szukam i nie bardzo wiem jak w Mako
przekazać argument do zdefiniowanej funkcji.

Przykład:

from mako.template import Template
test = '''
<%!
     def funcja(arg):
         arg += 1
         return arg
%>
<table>
% for x in range(count):
     <tr><td>
         Lp. ${funkcja(${lp})} <--- Błąd
     </td></tr>
% endfor
</table>

'''

t = Template(test, lp=0, count=5).render()

no i w miejscu gdzie zaznaczyłem wywala SyntaxError.
Nie mogę znaleźć rozwiązania stąd prośba o pomoc.

Z góry dziękuję

--
Pozdrawiam,
Witold
Technical Details
Message-ID: <4c776a8b$0$27040$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Fri, 27 Aug 2010 09:34:58 +0200
From: Witold <witold.bryla_nospam@gmail.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); pl; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2
MIME-Version: 1.0
Newsgroups: pl.comp.lang.python
Subject: Argumenty w Mako
Lines: 34
Message-ID: <4c776a8b$0$27040$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 83.23.173.153
X-Trace: 1282894475 unt-rea-a-02.news.neostrada.pl 27040 83.23.173.153:22965
X-Complaints-To: abuse@news.neostrada.pl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit