Agreed. That's why I said "some indication".  I can think of a couple of
things that might be helpful:

1. If the nesting level returns to 0 at any point in the file, the missing
pass statement must be afterwards.  If that's the case, the error message
could say "missing pass statement after line 214."

2. Offer a collapsed view of the output, ie only the loops, conditionals,
and pass statements.  Should make the errors easier to spot.

Cheers,
Mike


On Mon, Aug 2, 2010 at 12:57 PM, Thadeus Burgess <thade...@thadeusb.com>wrote:

> Its not a matter of easy, but more a matter of it even being a
> possibility. There is no way to know where you intended to place the
> pass statement.
>
> --
> Thadeus
>
>
>
>
>
> On Mon, Aug 2, 2010 at 11:47 AM, Michael Ellis
> <michael.f.el...@gmail.com> wrote:
> > Ok, think I know what was going on:
> > 1. I did have a missing pass statement
> > 2. I had not restarted web2py after updating from tip this morning.
> > It's probably not fair to expect web2py to show the correct errors after
> > repairing the engine while the motor's still running :-}
> > So I immediately got the missing pass error after restarting.  FWIW it
> would
> > be really helpful if the template parser could give some indication of
> which
> > loop or conditional might responsible.  I know that's not as easy as it
> > sounds, though.
> > Thanks for the help!
> > Mike
> >
> >
> > On Mon, Aug 2, 2010 at 12:32 PM, Jonathan Lundell <jlund...@pobox.com>
> > wrote:
> >>
> >> On Aug 2, 2010, at 9:21 AM, Michael Ellis wrote:
> >>
> >> > I'm pretty sure it does because I've fixed several instances during
> >> > the past two days  by correcting pass statements.   I'll try to create
> >> > a minimal example to post here.
> >>
> >> That would be good. Whatever it is, it's leading to rocket seeing an
> empty
> >> request from the client. If it's possible to cause that from a view,
> then
> >> hopefully it'll be possible to catch the error earlier and raise a more
> >> helpful exception.
> >>
> >>
> >> >
> >> > On Aug 2, 12:13 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> >> >> The template system actually emits an error that says "Missing pass
> in
> >> >> view" or "too many pass in view".
> >> >>
> >> >> This has to do with cron / rocket failing, nothing to do with
> template.
> >> >>
> >> >> --
> >> >> Thadeus
> >> >>
> >> >> On Mon, Aug 2, 2010 at 10:57 AM, Michael Ellis
> >> >>
> >> >>
> >> >>
> >> >> <michael.f.el...@gmail.com> wrote:
> >> >>> One of my views has a number of if else clauses to control what the
> >> >>> user sees depending on context.  I'm finding it painfully difficult
> to
> >> >>> debug because omitting a pass statement generates a not very helpful
> >> >>> error:
> >> >>
> >> >>> Traceback (most recent call last):
> >> >>>  File "/Users/mellis/w2ptip/gluon/rocket.py", line 871, in run
> >> >>>    self.run_app(conn)
> >> >>>  File "/Users/mellis/w2ptip/gluon/rocket.py", line 1281, in run_app
> >> >>>    self.environ = environ = self.build_environ(sock_file, conn)
> >> >>>  File "/Users/mellis/w2ptip/gluon/rocket.py", line 1114, in
> >> >>> build_environ
> >> >>>    request = self.read_request_line(sock_file)
> >> >>>  File "/Users/mellis/w2ptip/gluon/rocket.py", line 942, in
> >> >>> read_request_line
> >> >>>    raise SocketClosed('Client closed socket.')
> >> >>> SocketClosed: Client closed socket.
> >> >>
> >> >>> Usually I can spot the problem visually, but I've been stuck for
> over
> >> >>> an hour just now and can't find what's wrong.  Are there errors
> other
> >> >>> than missing pass statements that will cause this?  Also, where
> would
> >> >>> I need to set a breakpoint to step through template parsing (and is
> >> >>> that a useful thing to do) ?
> >> >>
> >> >>> I'm working at tip.
> >> >>
> >> >>> Thanks,
> >> >>> Mike
> >>
> >>
> >
> >
>

Reply via email to