Nevow - newbie stan question
"Harald Blåtand" <[email protected]> Mon, 3 Mar 2008 13:03:42 +0100
| Newsgroups | gmane.comp.python.quotient.dev |
|---|---|
| Message-ID | <[email protected]> |
--===============1262231911==
Content-Type: multipart/alternative;
boundary="----=_Part_313_12854484.1204545823073"
------=_Part_313_12854484.1204545823073
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi all,
Learning Nevow & Athena; seems xtremely good; however, right now I'm stuck
on the case below, & my head's spinning a bit.
Like the 2 commented lines show, I'm trying to set the <select>'s name
attribute from a parameter, and can't figure out how.
Any hint, please?
k
class Selector(rend.Page): # HTML for a <SELECT>
element. Called with SQL result list.
docFactory = loaders.stan(
T.select(
#name= ??? # How
do I fill this?
render=T.directive('sequence')
)[
T.option(pattern = 'item', render = T.directive('option'))
]
)
def render_option(self, ctx, data):
return ctx.tag(value='%s' % str(data[1]))[ unicode(data[0])]
@defer.inlineCallbacks
def _select(self, name, sql):
result = yield self._sqlCachedQuery(sql)
defer.returnValue(Selector([['', -1]] +
sorted(result))) # Works fine so far
#defer.returnValue(Selector([name, [['', -1]] +
sorted(result)])) # How can I call it with this (sort of) instead?
------=_Part_313_12854484.1204545823073
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<div>Hi all,</div>
<div>Learning Nevow & Athena; seems xtremely good; however, right now I'm stuck on the case below, & my head's spinning a bit.</div>
<div>Like the 2 commented lines show, I'm trying to set the <select>'s name attribute from a parameter, and can't figure out how.</div>
<div> </div>
<div>Any hint, please?</div>
<div>k</div>
<div> </div>
<div>class Selector(rend.Page): # HTML for a <SELECT> element. Called with SQL result list.<br> docFactory = loaders.stan(<br> T.select(<br> #name= ??? # How do I fill this?<br>
render=T.directive('sequence')<br> )[<br> T.option(pattern = 'item', render = T.directive('option'))<br> ]<br> )</div>
<div> </div>
<div> def render_option(self, ctx, data):<br> return ctx.tag(value='%s' % str(data[1]))[ unicode(data[0])]</div>
<div> </div>
<div> </div>
<div> @defer.inlineCallbacks<br> def _select(self, name, sql):<br> result = yield self._sqlCachedQuery(sql)<br> defer.returnValue(Selector([['', -1]] + sorted(result))) # Works fine so far<br>
#defer.returnValue(Selector([name, [['', -1]] + sorted(result)])) # How can I call it with this (sort of) instead?<br></div>
------=_Part_313_12854484.1204545823073--
--===============1262231911==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline