Facebookをweb2pyで
URL:http://web2py.com/books/default/chapter/31/8→「Integration with OpenID, Facebook, etc.」が良さ気。
「Janrain.com」
→ここで何か登録の必要が??
web2py ログインしているか?
controllerのアクション内で「auth.is_logged_in()」のTrue/Falseで判定OK.・コントローラ
def index(): log = 'not logged in' if auth.is_logged_in(): log = 'logged in' return dict(button=button, log=log)
・ビュー
{{extend 'layout.html'}} {{=log}}
is_logged_inの「()」を忘れるとだめ。必ずTrueになるよ。
web2py 「views\layout.html」の見方
・ヘッダというかそれより上にあるTOP部分の見方<div class="topbar"> <div class="container"> <div class="sixteen columns"> <div id="navbar">{{='auth' in globals() and auth.navbar(separators=(' ',' | ',''))}}</div> {{is_mobile=request.user_agent().is_mobile}} <div id="menu">{{=MENU(response.menu, _class='mobile-menu' if is_mobile else 'sf-menu',mobile=is_mobile)}} </div> </div> </div> </div><!-- topbar -->
・navbar
ログインとかの部分
Welcome 名前 Logout | Profile | Password
・menu
indexの表示
web2pyでリネーム
フォルダ名変えるだけみたい。renameコマンドがWindowsで効いた。
cd web2py\applications rename old_name new_name
→old_name から new_name へ
Pythonのスコープについて
2.7でインタラクティブシェルにて。>>> if True: ... a=1 ... >>> a 1 >>> for x in range(1, 3): ... x = 1 ... >>> x 1
if文内でもfor文内でもスコープが外に出る。
気持ちわるい・・・・
Rubyのスコープについて
Ruby1.9.2にてirb(main):016:0> if true irb(main):017:1> a=2 irb(main):018:1> end => 2 irb(main):019:0> a => 2 irb(main):020:0> for i in [1..3] irb(main):021:1> x=1 irb(main):022:1> end => [1..3] irb(main):023:0> x => 1 irb(main):024:0>
Rubyもだ。