On Mon, Aug 10, 2009 at 4:33 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:

>
> {{ and }} have precedence over everything else in the views. This
> means you cannot have }} in comments. This is by design because it
> reduces the scope of the possible errors you can have. If you have
> a }} in a comment you need to add a space in between as in } }


What about in a string (you are talking about a docstring, not techincally a
comment here - since a docstring is valid data for a variable...

So what you have just created is a special case for strings - which is not
so great.

Would escaping within a string work, e.g.   "I have to type }} to end the
template code snippet."  if not valid, could it be typed

"I have to type \}\} to end the template code snippet.".

What do you think - would this work?

- Yarko


>
>
> Massimo
>
>
> On Aug 10, 10:28 am, Olivier <oli...@gmail.com> wrote:
> > On Aug 5, 3:57 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> >
> > > You can comment individual lines {{#....}}. To comment an a multiline
> > > block {{"""...."""} should work. What problem do you have with it?
> >
> > If there are '{{}}' syntax in the comments, an error is thrown:
> >
> > Traceback (most recent call last):
> >   File "/home/oli/work/dev/python/web2py/web2py/gluon/restricted.py",
> > line 176, in restricted
> >     ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
> >   File "/home/oli/work/dev/python/web2py/web2py/applications/wiki/
> > views/default/index.html", line 66
> >     """\n[ {{response.write(A('search', _href=URL(r=request,
> > f='search')))\nresponse.write(' ]<br/>\n"""}}\n\n',escape=False)
> > \n"""\n  vi: ft=htmljinja\n"""\nresponse.write('\n\n          </td>
> > \n          <!--\n               <td class="width10em column3">
> > \n                 <h2>Right Column</h2>\n               </td>
> > \n          //-->\n        </tr>\n        <tr>\n          <td
> > colspan="10" class="footer">\n            <p>\n            Copyright
> > &copy; 2009 -\n            Powered by <a 
> > href="http://www.web2py.com";>web2py</a>\n
>            </p>\n          </td>\n
> > </tr>\n      </table>\n    </div>\n  </body>\n</html>\n',escape=False)
> >
> > ^
> > SyntaxError: invalid syntax
> >
> > --
> > Olivier
> > Developer
> > OpenERP - Tiny sprl
> > Web:http://www.openerp.com
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to