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


Groups > comp.lang.python > #93769

Re: A webpy Templetor question

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'means,': 0.07; 'subject:question': 0.08; 'cc:addr:python-list': 0.09; 'def': 0.13; 'argument': 0.15; '9:13': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'header :In-Reply-To:1': 0.24; 'all.': 0.24; 'figure': 0.27; 'message- id:@mail.gmail.com': 0.27; '14,': 0.27; 'function': 0.28; 'tue,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'there,': 0.37; "you'll": 0.61; 'skip:$ 10': 0.67; 'jul': 0.72; 'chrisa': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=IATelVmoeXLOpP0DmHImfuCdM6pT3xPPuqKFpKRUBoM=; b=NZQWka6CzEDOM9G9MkJ3k95B+wiSHVWFY8tg5FFPXlufUwGu9IHcOLAePNRmN5gx74 MqKDQhLieiIeuNqT9iX2KjNKX8yGORPPOw3mkqOtv7/nBMkhV16xfAaAMxlCGp1V+UrL +vnn7i4jiqBebrsT9jOGELF0iGXQNnkzFXRjL2xd4lLIEHNKbYFZntDfdDpEF5G0yrVS yobGnUqtxno8CpwrTISnETy+0S04ZELvNuH+Ln1s8sbF/rEqCGq9vVDm3i7gqh9Baxrt OBy8b9aF/bwCyYMIvJoPlQr6sciggcDRK6228yL499wv3YNbBquKpuchKRG9hAQ75h9F N22w==
MIME-Version 1.0
X-Received by 10.50.29.75 with SMTP id i11mr15648039igh.50.1436835548368; Mon, 13 Jul 2015 17:59:08 -0700 (PDT)
In-Reply-To <fc88437a-7776-4836-a57e-10c67e8f5925@googlegroups.com>
References <fc88437a-7776-4836-a57e-10c67e8f5925@googlegroups.com>
Date Tue, 14 Jul 2015 10:59:08 +1000
Subject Re: A webpy Templetor question
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.473.1436835551.3674.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436835551 news.xs4all.nl 2878 [2001:888:2000:d::a6]:54566
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93769

Show key headers only | View raw


On Tue, Jul 14, 2015 at 9:13 AM,  <yongzhi.chen@gmail.com> wrote:
> #in my application.py:
> def checknow():
> ...
>     return TN_str
>
> render = web.template.render('templates/',globals={'stat':checknow})
>
> #in the template:
> $def with(checknow)
> ... ...
>     <h1><div>Test: $stat(checknow)</div></h1>

You've effectively taken a reference to the checknow function and
given it the name 'stat'. So when you call $stat(), I would expect it
to call checknow() with exactly those arguments. I don't know what
"$def with(checknow)" means, but if you figure out what checknow is
inside there, then you'll know whether you want any argument at all. I
suspect just "$stat()" may well do what you want.

ChrisA

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


Thread

A webpy Templetor question yongzhi.chen@gmail.com - 2015-07-13 16:13 -0700
  Re: A webpy Templetor question Chris Angelico <rosuav@gmail.com> - 2015-07-14 10:59 +1000

csiph-web