<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Facebook apps in Python and Pylons part 2</title>
	<atom:link href="http://niallohiggins.com/2008/11/22/facebook-apps-in-python-and-pylons-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://niallohiggins.com/2008/11/22/facebook-apps-in-python-and-pylons-part-2/</link>
	<description>The website of Niall O'Higgins: A few, immature words</description>
	<lastBuildDate>Tue, 09 Mar 2010 12:15:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Colin</title>
		<link>http://niallohiggins.com/2008/11/22/facebook-apps-in-python-and-pylons-part-2/comment-page-1/#comment-897</link>
		<dc:creator>Colin</dc:creator>
		<pubDate>Thu, 25 Feb 2010 12:06:55 +0000</pubDate>
		<guid isPermaLink="false">http://niallohiggins.com/?p=178#comment-897</guid>
		<description>I replaced the &quot;if not fb.check_session(request)...&quot; line with:

    if not fb.check_session(request):
        if not fb.auth_token:

I don&#039;t know why that works and the other doesn&#039;t - perhaps there&#039;s something lazy going on as it evaluates the &#039;or&#039;.</description>
		<content:encoded><![CDATA[<p>I replaced the &#8220;if not fb.check_session(request)&#8230;&#8221; line with:</p>
<p>    if not fb.check_session(request):<br />
        if not fb.auth_token:</p>
<p>I don&#8217;t know why that works and the other doesn&#8217;t &#8211; perhaps there&#8217;s something lazy going on as it evaluates the &#8216;or&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buchibabu</title>
		<link>http://niallohiggins.com/2008/11/22/facebook-apps-in-python-and-pylons-part-2/comment-page-1/#comment-531</link>
		<dc:creator>Buchibabu</dc:creator>
		<pubDate>Sat, 04 Jul 2009 03:43:18 +0000</pubDate>
		<guid isPermaLink="false">http://niallohiggins.com/?p=178#comment-531</guid>
		<description>Here is the code i used.

from facebook import Facebook
log = logging.getLogger(__name__)

def require_login(f):
    def redirect(fb, url):
        if  not fb.check_session(request) and not auth_token:
            log.info(&quot;doing fbml redirect 302&quot;)
            return &#039;&#039; %(url, )
        else:
            log.info(&quot;sending a 302&quot;)
            response.status_int = 302
            response.headers[&#039;location&#039;] = url
            return &#039;Moved temporarily&#039;
    api_key = &#039;7ef4078c35827840efcb74021862d987&#039;
    secret_key = &#039;4478c27c72b200639026a01166b3e2c1&#039;
    appid = &#039;119751057792&#039;
    auth_token = request.params.get(&#039;auth_token&#039;, None)

    fb = Facebook(api_key, secret_key, auth_token, app_name=&#039;SamyuthaCalendar&#039;,
             callback_path=&#039;/samyuthacalendar/callback&#039;,)

    if request.method == &#039;POST&#039;:
        fb_params = fb.validate_signature(request.POST)
    else:
        fb_params = fb.validate_signature(request.GET)

    if not fb.check_session(request) or not auth_token:
        log.info(&quot;got an unauthenticated session request&quot;)
        return lambda a: redirect(fb, fb.get_login_url())
    return lambda a: f(a, fb=fb)

class MyCalendarController(BaseController):
    @require_login
    def index(self,fb):
        # Return a rendered template
        m = request.params.get(&#039;m&#039;)
        y = request.params.get(&#039;y&#039;)</description>
		<content:encoded><![CDATA[<p>Here is the code i used.</p>
<p>from facebook import Facebook<br />
log = logging.getLogger(__name__)</p>
<p>def require_login(f):<br />
    def redirect(fb, url):<br />
        if  not fb.check_session(request) and not auth_token:<br />
            log.info(&#8220;doing fbml redirect 302&#8243;)<br />
            return &#8221; %(url, )<br />
        else:<br />
            log.info(&#8220;sending a 302&#8243;)<br />
            response.status_int = 302<br />
            response.headers['location'] = url<br />
            return &#8216;Moved temporarily&#8217;<br />
    api_key = &#8216;7ef4078c35827840efcb74021862d987&#8242;<br />
    secret_key = &#8216;4478c27c72b200639026a01166b3e2c1&#8242;<br />
    appid = &#8216;119751057792&#8242;<br />
    auth_token = request.params.get(&#8216;auth_token&#8217;, None)</p>
<p>    fb = Facebook(api_key, secret_key, auth_token, app_name=&#8217;SamyuthaCalendar&#8217;,<br />
             callback_path=&#8217;/samyuthacalendar/callback&#8217;,)</p>
<p>    if request.method == &#8216;POST&#8217;:<br />
        fb_params = fb.validate_signature(request.POST)<br />
    else:<br />
        fb_params = fb.validate_signature(request.GET)</p>
<p>    if not fb.check_session(request) or not auth_token:<br />
        log.info(&#8220;got an unauthenticated session request&#8221;)<br />
        return lambda a: redirect(fb, fb.get_login_url())<br />
    return lambda a: f(a, fb=fb)</p>
<p>class MyCalendarController(BaseController):<br />
    @require_login<br />
    def index(self,fb):<br />
        # Return a rendered template<br />
        m = request.params.get(&#8216;m&#8217;)<br />
        y = request.params.get(&#8216;y&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buchibabu</title>
		<link>http://niallohiggins.com/2008/11/22/facebook-apps-in-python-and-pylons-part-2/comment-page-1/#comment-530</link>
		<dc:creator>Buchibabu</dc:creator>
		<pubDate>Sat, 04 Jul 2009 03:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://niallohiggins.com/?p=178#comment-530</guid>
		<description>Hi,

I have used the exact code you have provided above. But i am getting too many redirections always.

Can you please help me to fix this problem?

Regards,
Buchibabu</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have used the exact code you have provided above. But i am getting too many redirections always.</p>
<p>Can you please help me to fix this problem?</p>
<p>Regards,<br />
Buchibabu</p>
]]></content:encoded>
	</item>
</channel>
</rss>
