Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion application processor returning page with "function <lambda>..."

Received: by 10.50.154.164 with SMTP id vp4mr7406192igb.2.1348772503177;
        Thu, 27 Sep 2012 12:01:43 -0700 (PDT)
X-BeenThere: webpy@googlegroups.com
Received: by 10.42.73.70 with SMTP id r6ls325807icj.7.gmail; Thu, 27 Sep 2012
 12:01:40 -0700 (PDT)
Received: by 10.42.172.68 with SMTP id m4mr893759icz.1.1348772500905;
        Thu, 27 Sep 2012 12:01:40 -0700 (PDT)
Received: by 10.42.172.68 with SMTP id m4mr893758icz.1.1348772500886;
        Thu, 27 Sep 2012 12:01:40 -0700 (PDT)
Return-Path: <jasonmacgo...@gmail.com>
Received: from mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172])
        by gmr-mx.google.com with ESMTPS id wo9si949301igc.1.2012.09.27.12.01.40
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 27 Sep 2012 12:01:40 -0700 (PDT)
Received-SPF: pass (google.com: domain of jasonmacgo...@gmail.com designates 209.85.214.172 as permitted sender) client-ip=209.85.214.172;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jasonmacgo...@gmail.com designates 209.85.214.172 as permitted sender) smtp.mail=jasonmacgo...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-ob0-f172.google.com with SMTP id v19so2834101obq.17
        for <webpy@googlegroups.com>; Thu, 27 Sep 2012 12:01:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        bh=qOQK9n5aOAoGuUWwzTop2d7u1SRc/rs8pkR55TPY1jI=;
        b=ib4bWiOeZcBaOuByFF3wu7BP6h39QmhmMk+LxZDPUGlz8IOUqxPU1jOa63THbBxBMz
         4mKmi6HdPHTRTGUl2DN9KkYMEYonAisGvLdlSrBjWuelfFwBHArPFT2/gBxeHeHrqt/b
         AN97ALh15M7Sn9/iH7+r1AF0Ly7LUzw10o+POQdtML7ZXX1Obd9u7NGa8OGkdAcatMJ9
         oca7Ry1ujhM84fZjssM4JrTIR3P49yNR2VAyDv/wSXLdyEuvvuPYjbWM6s00osucmYuH
         ELwaMpHBFdA/tvAGdkkda5NE5wqUfC6TyaZU18BkTxnl0gSmy4P8WxX6RvJ7DbJAOP6v
         v2gQ==
MIME-Version: 1.0
Received: by 10.182.121.38 with SMTP id lh6mr3945618obb.16.1348772500662; Thu,
 27 Sep 2012 12:01:40 -0700 (PDT)
Received: by 10.76.93.37 with HTTP; Thu, 27 Sep 2012 12:01:40 -0700 (PDT)
In-Reply-To: <b67b19b3-4b7f-42a0-a80b-62d397803220@googlegroups.com>
References: <b67b19b3-4b7f-42a0-a80b-62d397803220@googlegroups.com>
Date: Thu, 27 Sep 2012 15:01:40 -0400
Message-ID: <CAF_rn3=Y0CwBM4k-9NS-13oPNtqEsUBLPCc_cnUZH++AuMe...@mail.gmail.com>
Subject: Re: [webpy] application processor returning page with "function <lambda>..."
From: Jason Macgowan <jasonmacgo...@gmail.com>
To: webpy@googlegroups.com
Content-Type: multipart/alternative; boundary=14dae9399871c8e9ee04cab39196

--14dae9399871c8e9ee04cab39196
Content-Type: text/plain; charset=ISO-8859-1

You're returning an instance of a function instead of the value of the
function.  Change "return handle" to return handle()

On Mon, Sep 24, 2012 at 8:02 AM, Bill Seitz <flux...@gmail.com> wrote:

> I'm trying to stick an application processor in my app to check whether
> the user is logged in. The code is:
>
> def check_authorized(handle):
>     path = web.ctx.path
>     if path in ('/login', '/register'):
>     return handle
>     if not session.has_key('user_id'):
>         web.debug('check_authorized: no session user_id')
>         raise web.seeother('/static/splash.html')
>     return handle
> app.add_processor(check_authorized)
>
> When I hit the "normal" pages I get bounced to the splash page nicely.
>
> But when I hit /login or /register I get a page whose entire contents are:
> <function <lambda> at 0x101bd6578>
>
> What stupid mistake am I making?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/webpy/-/K9DkQ-NkcQ4J.
> To post to this group, send email to webpy@googlegroups.com.
> To unsubscribe from this group, send email to
> webpy+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>

--14dae9399871c8e9ee04cab39196
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

You&#39;re returning an instance of a function instead of the value of the =
function.=A0 Change &quot;return handle&quot; to return handle()<br><br><di=
v class=3D"gmail_quote">On Mon, Sep 24, 2012 at 8:02 AM, Bill Seitz <span d=
ir=3D"ltr">&lt;<a href=3D"mailto:flux...@gmail.com" target=3D"_blank">fluxe=
n...@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">I&#39;m trying to stick an application proce=
ssor in my app to check whether the user is logged in. The code is:<div><br=
>
</div><div><div>def check_authorized(handle):</div><div>=A0 =A0 path =3D we=
b.ctx.path</div><div>=A0 =A0 if path in (&#39;/login&#39;, &#39;/register&#=
39;):</div><div>=A0 =A0 <span style=3D"white-space:pre-wrap">	</span>return=
 handle</div>
<div>=A0 =A0 if not session.has_key(&#39;user_id&#39;):</div><div>=A0 =A0 =
=A0 =A0 web.debug(&#39;check_authorized: no session user_id&#39;)</div><div=
>=A0 =A0 =A0 =A0 raise web.seeother(&#39;/static/splash.html&#39;)</div><di=
v>=A0 =A0 return handle<br>
</div><div>app.add_processor(check_authorized)</div></div><div><br></div><d=
iv>When I hit the &quot;normal&quot; pages I get bounced to the splash page=
 nicely.</div><div><br></div><div>But when I hit /login or /register I get =
a page whose entire contents are:</div>
<div><table><tbody><tr><td></td><td>&lt;function &lt;lambda&gt; at 0x101bd6=
578&gt;<br><br>What stupid mistake am I making?<span class=3D"HOEnZb"><font=
 color=3D"#888888"><br><br></font></span></td></tr></tbody></table></div><s=
pan class=3D"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;web.py&quot; group.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msg/webpy/-/K9DkQ-NkcQ4J" target=3D"_blank">https://groups.google.com/=
d/msg/webpy/-/K9DkQ-NkcQ4J</a>.<br>=20
To post to this group, send email to <a href=3D"mailto:we...@googlegroups.c=
om" target=3D"_blank">webpy@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:webpy%2Buns=
ubscribe@googlegroups.com" target=3D"_blank">webpy+unsubscribe@googlegroups=
.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/webpy?hl=3Den" target=3D"_blank">http://groups.google.com/group/webpy?=
hl=3Den</a>.<br>


</font></span></blockquote></div><br>

--14dae9399871c8e9ee04cab39196--