Lisandro,
the ratio of users without email is so low that i would just block the
user telling them that they must grant email permissions to use your
site. detect that there was no email returned from facebook and send a
response to the browser that prompts the user to try again and add the
email permission.
in the event that this is the login of an existing user, your database
will already have an email and maybe you prompt them to verify that the
saved email is still correct.
good luck!
cfh
>>>>> escribi�:
>>>>>>> File "/var/www/vendosimple/gluon/**restricted.py", line 212, in restricted
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> exec ccode in environment
>>>>>>> File "/var/www/vendosimple/**applications/init/controllers/**default.py", line 645, in <module>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> File "/var/www/vendosimple/gluon/**globals.py", line 194, in <lambda>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> self._caller = lambda f: f()
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> File "/var/www/vendosimple/**applications/init/controllers/**default.py", line 380, in user
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> form = auth()
>>>>>>> File "/var/www/vendosimple/gluon/**tools.py", line 1250, in __call__
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> return getattr(self, args[0])()
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> File "/var/www/vendosimple/gluon/**tools.py", line 2128, in login
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> cas_user = cas.get_user()
>>>>>>> File "applications/init/modules/**globales.py", line 41, in get_user
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> username=user['id'], registration_id=user['id'], email=user['email'])
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> KeyError: 'email'
>>>>>>>
>>>>>>>
>>>>>>> Any ideas?
>>>>>>>
>>>>>>>
>>>>>>> El martes, 7 de junio de 2011 01:00:33 UTC-3, Massimo Di Pierro
>>>>>>> escribi�:
>>>>>>>> **disabled:
>>>>>>>>> bar.insert(-1, ' | ')
>>>>>>>>> bar.insert(-1, password)
>>>>>>>>>
>>>>>>>>> and in my controller:
>>>>>>>>>
>>>>>>>>> def user():
>>>>>>>>> if auth.user_id:
>>>>>>>>> if request.args[0] == 'logout':
>>>>>>>>> session.login_method_used=None
>>>>>>>>> else:
>>>>>>>>> if request.args[0] == 'login':
>>>>>>>>> session.login_method_used=None
>>>>>>>>> elif request.args[0] == 'login_fb':
>>>>>>>>> session.login_method_used="**facebook"
>>>>>>>>> request.args[0]='login'
>>>>>>>>>
>>>>>>>>> if session.login_method_used=="**facebook":
>>>>>>>>> auth.settings.login_form=**FaceBookAccount(globals())
>>>>>>>>>
>>>>>>>>> return dict(form=auth())
>>>>>>>>>
>>>>>>>>> On Mon, Jun 6, 2011 at 11:16 PM, Massimo Di Pierro <
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
massimo.dipie...@gmail.com> wrote:
>>>>>>>>>> if there is agreement on one, please send me a patch.
>>>>>>>>>
>>>>>>>>>> On Jun 6, 4:31 pm, "Sebastian E. Ovide" <
>>>>>>>>
sebastian.ov...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>> Hi Mic,
>>>>>>>>>
>>>>>>>>>>> thanks for that.
>>>>>>>>>
>>>>>>>>>>> actually I've debugged web2py and figure it out for myself.
>>>>>>>> There are two
>>>>>>>>>>> easy ways to fix it (I've tried to add them to the book, but
>>>>>>>> my account
>>>>>>>>>>> doesn't allow me to edit it)
>>>>>>>>>
>>>>>>>>>>> 1) set username=False in auth.define_tables()
>>>>>>>>>>> 2) add email = user['username']+"@facebook.**com<
http://facebook.com>"
>>>>>>>> in the return of def
>>>>>>>>>>> get_user
>>>>>>>>>
>>>>>>>>>>> On Mon, Jun 6, 2011 at 10:02 PM, Michele Comitini <
>>>>>>>>>
>>>>>>>>>>>
michele.comit...@gmail.com> wrote:
>>>>>>>>>>>> Hi Sebastian,
>>>>>>>>>
>>>>>>>>>>>> copy from this example:
>>>>>>>>>
>>>>>>>>>>>>
http://code.google.com/r/**michelecomitini-**
>>>>>>>> facebookaccess/source/browse<
http://code.google.com/r/michelecomitini-facebookaccess/source/browse>.
>>>>>>>>
>>>>>>>>>> ..
>>>>>>>>>
>>>>>>>>>>>> <
>>>>>>>>>>
http://code.google.com/r/**michelecomitini-**
>>>>>>>> facebookaccess/source/browse<
http://code.google.com/r/michelecomitini-facebookaccess/source/browse>..
>>>>>>>>
>>>>>>>>>> .>and
>>>>>>>>>>>> let me know
>>>>>>>>>
>>>>>>>>>>>> mic
>>>>>>>>>
>>>>>>>>>>>> 2011/6/6 Sebastian E. Ovide <
sebastian.ov...@gmail.com>
>>>>>>>>>
>>>>>>>>>>>> Hi All,
>>>>>>>>>
>>>>>>>>>>>>> just wondering if the section "OAuth2.0 and Facebook" of
>>>>>>>> the book is
>>>>>>>>>> up to
>>>>>>>>>>>>> date?
>>>>>>>>>
>>>>>>>>>>>>> I following it's instructions but I'm getting an "Internal
>>>>>>>> error"
>>>>>>>>>
>>>>>>>>>>>>> to reproduce
>>>>>>>>>
>>>>>>>>>>>>> 1) get last web2py 1.196.3
>>>>>>>>>>>>> 2) follow the instructions from the book
>>>>>>>>>>>>> 2.a) get facebook and place it in modules
>>>>>>>>>>>>> 2.b) copy the code from the book
>>>>>>>>>>>>> 2.c) replace "from facebook import GraphAPI" with "facebook
>>>>>>>> =
>>>>>>>>>>>>> local_import('facebook')"
>>>>>>>>>>>>> 2.d) replace facebook. to GraphAPIError and GraphAPI
>>>>>>>>>>>>> 2.e) replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with
>>>>>>>> real data
>>>>>>>>>>>>> 3) set your app URL tohttp://localhost:8000/**welcome/
>>>>>>>>>
>>>>>>>>>>>>> Is something missing ?
>>>>>>>>>
>>>>>>>>>>>>> When I click login, it redirect me to facebook, where I can
>>>>>>>> login, and
>>>>>>>>>>>>> then it redirects me tohttp://localhost:8000/**welcome/
>>>>>>>>>
>>>>>>>>>>>>> At that point I get an error:
>>>>>>>>>
>>>>>>>>>>>>> TRACEBACK
>>>>>>>>>
>>>>>>>>>>>>> 1.
>>>>>>>>>>>>> 2.
>>>>>>>>>>>>> 3.
>>>>>>>>>>>>> 4.
>>>>>>>>>>>>> 5.
>>>>>>>>>>>>> 6.
>>>>>>>>>>>>> 7.
>>>>>>>>>>>>> 8.
>>>>>>>>>>>>> 9.
>>>>>>>>>>>>> 10.
>>>>>>>>>>>>> 11.
>>>>>>>>>>>>> 12.
>>>>>>>>>>>>> 13.
>>>>>>>>>>>>> 14.
>>>>>>>>>>>>> 15.
>>>>>>>>>>>>> 16.
>>>>>>>>>
>>>>>>>>>>>>> Traceback (most recent call last):
>>>>>>>>>
>>>>>>>>>>>>> File "/home/sebas/Downloads/web2py/**gluon/restricted.py",
>>>>>>>> line 184,
>>>>>>>>>> in restricted
>>>>>>>>>
>>>>>>>>>>>>> exec ccode in environment
>>>>>>>>>
>>>>>>>>>>>>> File
>>>>>>>>>> "/home/sebas/Downloads/web2py/**applications/welcome/**controllers/default.py"
>>>>>>>> <
>>>>>>>>>>
http://localhost:8000/admin/**default/edit/welcome/**
>>>>>>>> controllers/default.py<
http://localhost:8000/admin/default/edit/welcome/controllers/default.py>>,
>>>>>>>>
>>>>>>>>>> line 71, in <module>
>>>>>>>>>
>>>>>>>>>>>>> File "/home/sebas/Downloads/web2py/**gluon/globals.py",
>>>>>>>> line 137, in
>>>>>>>>>> <lambda>
>>>>>>>>>
>>>>>>>>>>>>> / self._caller = lambda f: f()
>>>>>>>>>
>>>>>>>>>>>>> File
>>>>>>>>>> "/home/sebas/Downloads/web2py/**applications/welcome/**controllers/default.py"
>>>>>>>> <
>>>>>>>>>>
http://localhost:8000/admin/**default/edit/welcome/**
>>>>>>>> controllers/default.py<
http://localhost:8000/admin/default/edit/welcome/controllers/default.py>>,
>>>>>>>>
>>>>>>>>>> line 33, in user
>>>>>>>>>
>>>>>>>>>>>>> return dict(form=auth())
>>>>>>>>>
>>>>>>>>>>>>> File "/home/sebas/Downloads/web2py/**gluon/tools.py",
>>>>>>>> line 1070, in
>>>>>>>>>> __call__
>>>>>>>>>
>>>>>>>>>>>>> return getattr(self,args[0])()
>>>>>>>>>
>>>>>>>>>>>>> File "/home/sebas/Downloads/web2py/**gluon/tools.py",
>>>>>>>> line 1626, in
>>>>>>>>>> login
>>>>>>>>>
>>>>>>>>>>>>> user =
>>>>>>>>>> self.get_or_create_user(table_**user._filter_fields(cas_user))
>>>>>>>>>
>>>>>>>>>>>>> File "/home/sebas/Downloads/web2py/**gluon/tools.py",
>>>>>>>> line 1360, in
>>>>>>>>>> get_or_create_user
>>>>>>>>>
>>>>>>>>>>>>> user = self.db(table_user[username] ==
>>>>>>>>>> keys[username]).select().**first()