In this case I wanted the following behaviour: If there is at least one error message then display the first error message else display the page message.
I just tested the template code without the {{break}} and the {{pass}} at the end and it passes the syntax check - I just get all the error messages. If no-one has any solutions I suppose I can get around it with if len(form.errors)>0 or similar. Bill On Oct 11, 10:09 pm, "Daniel Contag" <[EMAIL PROTECTED]> wrote: > What is the "break" for? > > Daniel > > On Sat, Oct 11, 2008 at 22:50, billf <[EMAIL PROTECTED]> wrote: > > > Adding a {{pass}} at the end doesn't make any difference. > > > On Oct 11, 9:45 pm, billf <[EMAIL PROTECTED]> wrote: > >> New to python, I believe that the following is valid syntax: > > >> for item in list: > >> print item > >> else: > >> print 'no items in list' > > >> When I put the following in a template I get a SyntaxError: invalid > >> syntax error with "else:" highlighted: > > >> {{for key,value in form.errors.items():}} > >> <span class="error_message">{{=key}} {{=value}}</span> > >> {{break}} > >> {{else:}} > >> <span class="page_message">{{=message}}</span> > > >> What am I missing/ > > >> Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---