thats even more elegant^^
Am Mittwoch, 30. Mai 2012 17:04:16 UTC+2 schrieb Niphlod: > > .... you're overcomplicating a small issue > > {{if articles and len(articles)>0:}} > display whatever you want in a for loop > {{else:}} > display your static message > {{pass}} > > Il giorno mercoledì 30 maggio 2012 16:44:22 UTC+2, BlueShadow ha scritto: >> >> I tried it too and for some weird reason it works. >> The missing doublepoint you spotted is in my complete code on my server^^ >> what I really want to do is: diyplaying a database entry in a table. >> this entry varies from no entries to about 10. >> I didn't account for the no entries part but I got a bunch of error >> messages in my log which result from this for loop which is going through >> the entries Titles if there are none it still requests the tile and crashes >> so >> this is more close to my code: >> >> <table> >> {{for z in articles:}} >> <TR><TD>{{=z.Title}} >> </TD><TD>{{=A(z.Title,_href=URL(r=request,f='article',vars=dict(id= >> z.id)))}}</TD></TR> >> {{pass}} >> <\table> >> Now what I want is to skip this loop and display a static message if >> there are no articles >> >> >> >> Am Mittwoch, 30. Mai 2012 16:19:32 UTC+2 schrieb Niphlod:btw, this works >> perfectly as intended.... >> >> trying to do 1/0 >> {{try:}} >> {{for a in range(15):}} >> {{=1/0}} >> {{pass}} >> {{except:}} >> can't divide by 0 >> {{pass}} >> >> Il giorno mercoledì 30 maggio 2012 16:15:10 UTC+2, Niphlod ha scritto: >> didn't test it, but I spot a missing : after "for x in db.test" >> >> >> Il giorno mercoledì 30 maggio 2012 16:08:10 UTC+2, BlueShadow ha >> scritto:Hi I like to put a for-loop in a try except clause in an html file. >> My problem is that the pass from the for loop terminates the try block. >> {{try:}} >> {{for x in db.test}} >> {{=x.title}} >> {{pass}} >> {{except:}} >> no database entries >> {{pass}} >> >>