I open a ticket http://code.google.com/p/web2py/issues/detail?id=1260
On Tuesday, January 8, 2013 1:23:45 PM UTC-6, Massimo Di Pierro wrote: > > Perhaps I misunderstand the workflow. The solution cannot be to change an > Auth function to handle a specific custom field. > > The proper signature for the function is > > get_or_create_user(self, keys, update_fields=['email']) > > so if you want to pass employee_id to keys and expect it to update the > record in case it is found you need to pass > > get_or_create_user(self, keys, update_fields=['email', 'employee_id']) > > There are two options here: > 1) allow some auth.settings.update_fields to be specified so the function > is called with right parameters > 2) change it so that update_fields defaults to keys.keys() > > 2) would solve the problem automatically but it may break something. Not > sure. > > Please open a ticket: http://code.google.com/p/web2py/issues/list > but let's discuss it some more. > > Massimo > > > > > On Tuesday, 8 January 2013 12:09:09 UTC-6, Ignacio Ocampo wrote: >> >> Yes, >> >> I only uses: >> >> auth.settings.login_form=MyAuth( >> param1="value1", >> param2="value" >> ) >> >> It's all, I never call and writes/update in the auth_user anywhere. >> >> In gluon/tools.py login function, web2py check if they would use their >> login form or from a central source (line 1955) >> >> At line 2068 web2py determined that central authentication would be used. >> >> At line 2075 web2py call: user = >> self.get_or_create_user(table_user._filter_fields(cas_user)) >> >> At line 1724, within get_or_create_user function, after that web2py >> determine that the user exists: >> >> *update_keys = dict(registration_id=keys['registration_id']) #here is >> the BUG* >> >> I solved it with: >> >> *update_keys = dict(registration_id=keys['registration_id'], >> employee_id=keys['employee_id'])* >> >> So, I think that we need to update the gluon/tools.py file, to improve >> the update of external fields. >> >> On Tuesday, January 8, 2013 11:43:44 AM UTC-6, Anthony wrote: >>> >>> On Tuesday, January 8, 2013 12:08:34 PM UTC-5, Ignacio Ocampo wrote: >>> >>>> I only return a dict in the get_user, web2py does all the work. >>>> >>>> web2py call the get_user method, and web2py update the auth_user table >>>> with the dict values. >>>> >>> >>> >>> Yes, but where are you telling web2py to update the auth_user table? Can >>> you show the code? >>> >>> Anthony >>> >> On Tuesday, January 8, 2013 1:23:45 PM UTC-6, Massimo Di Pierro wrote: > > Perhaps I misunderstand the workflow. The solution cannot be to change an > Auth function to handle a specific custom field. > > The proper signature for the function is > > get_or_create_user(self, keys, update_fields=['email']) > > so if you want to pass employee_id to keys and expect it to update the > record in case it is found you need to pass > > get_or_create_user(self, keys, update_fields=['email', 'employee_id']) > > There are two options here: > 1) allow some auth.settings.update_fields to be specified so the function > is called with right parameters > 2) change it so that update_fields defaults to keys.keys() > > 2) would solve the problem automatically but it may break something. Not > sure. > > Please open a ticket: http://code.google.com/p/web2py/issues/list > but let's discuss it some more. > > Massimo > > > > > On Tuesday, 8 January 2013 12:09:09 UTC-6, Ignacio Ocampo wrote: >> >> Yes, >> >> I only uses: >> >> auth.settings.login_form=MyAuth( >> param1="value1", >> param2="value" >> ) >> >> It's all, I never call and writes/update in the auth_user anywhere. >> >> In gluon/tools.py login function, web2py check if they would use their >> login form or from a central source (line 1955) >> >> At line 2068 web2py determined that central authentication would be used. >> >> At line 2075 web2py call: user = >> self.get_or_create_user(table_user._filter_fields(cas_user)) >> >> At line 1724, within get_or_create_user function, after that web2py >> determine that the user exists: >> >> *update_keys = dict(registration_id=keys['registration_id']) #here is >> the BUG* >> >> I solved it with: >> >> *update_keys = dict(registration_id=keys['registration_id'], >> employee_id=keys['employee_id'])* >> >> So, I think that we need to update the gluon/tools.py file, to improve >> the update of external fields. >> >> On Tuesday, January 8, 2013 11:43:44 AM UTC-6, Anthony wrote: >>> >>> On Tuesday, January 8, 2013 12:08:34 PM UTC-5, Ignacio Ocampo wrote: >>> >>>> I only return a dict in the get_user, web2py does all the work. >>>> >>>> web2py call the get_user method, and web2py update the auth_user table >>>> with the dict values. >>>> >>> >>> >>> Yes, but where are you telling web2py to update the auth_user table? Can >>> you show the code? >>> >>> Anthony >>> >> On Tuesday, January 8, 2013 1:23:45 PM UTC-6, Massimo Di Pierro wrote: > > Perhaps I misunderstand the workflow. The solution cannot be to change an > Auth function to handle a specific custom field. > > The proper signature for the function is > > get_or_create_user(self, keys, update_fields=['email']) > > so if you want to pass employee_id to keys and expect it to update the > record in case it is found you need to pass > > get_or_create_user(self, keys, update_fields=['email', 'employee_id']) > > There are two options here: > 1) allow some auth.settings.update_fields to be specified so the function > is called with right parameters > 2) change it so that update_fields defaults to keys.keys() > > 2) would solve the problem automatically but it may break something. Not > sure. > > Please open a ticket: http://code.google.com/p/web2py/issues/list > but let's discuss it some more. > > Massimo > > > > > On Tuesday, 8 January 2013 12:09:09 UTC-6, Ignacio Ocampo wrote: >> >> Yes, >> >> I only uses: >> >> auth.settings.login_form=MyAuth( >> param1="value1", >> param2="value" >> ) >> >> It's all, I never call and writes/update in the auth_user anywhere. >> >> In gluon/tools.py login function, web2py check if they would use their >> login form or from a central source (line 1955) >> >> At line 2068 web2py determined that central authentication would be used. >> >> At line 2075 web2py call: user = >> self.get_or_create_user(table_user._filter_fields(cas_user)) >> >> At line 1724, within get_or_create_user function, after that web2py >> determine that the user exists: >> >> *update_keys = dict(registration_id=keys['registration_id']) #here is >> the BUG* >> >> I solved it with: >> >> *update_keys = dict(registration_id=keys['registration_id'], >> employee_id=keys['employee_id'])* >> >> So, I think that we need to update the gluon/tools.py file, to improve >> the update of external fields. >> >> On Tuesday, January 8, 2013 11:43:44 AM UTC-6, Anthony wrote: >>> >>> On Tuesday, January 8, 2013 12:08:34 PM UTC-5, Ignacio Ocampo wrote: >>> >>>> I only return a dict in the get_user, web2py does all the work. >>>> >>>> web2py call the get_user method, and web2py update the auth_user table >>>> with the dict values. >>>> >>> >>> >>> Yes, but where are you telling web2py to update the auth_user table? Can >>> you show the code? >>> >>> Anthony >>> >> On Tuesday, January 8, 2013 1:23:45 PM UTC-6, Massimo Di Pierro wrote: > > Perhaps I misunderstand the workflow. The solution cannot be to change an > Auth function to handle a specific custom field. > > The proper signature for the function is > > get_or_create_user(self, keys, update_fields=['email']) > > so if you want to pass employee_id to keys and expect it to update the > record in case it is found you need to pass > > get_or_create_user(self, keys, update_fields=['email', 'employee_id']) > > There are two options here: > 1) allow some auth.settings.update_fields to be specified so the function > is called with right parameters > 2) change it so that update_fields defaults to keys.keys() > > 2) would solve the problem automatically but it may break something. Not > sure. > > Please open a ticket: http://code.google.com/p/web2py/issues/list > but let's discuss it some more. > > Massimo > > > > > On Tuesday, 8 January 2013 12:09:09 UTC-6, Ignacio Ocampo wrote: >> >> Yes, >> >> I only uses: >> >> auth.settings.login_form=MyAuth( >> param1="value1", >> param2="value" >> ) >> >> It's all, I never call and writes/update in the auth_user anywhere. >> >> In gluon/tools.py login function, web2py check if they would use their >> login form or from a central source (line 1955) >> >> At line 2068 web2py determined that central authentication would be used. >> >> At line 2075 web2py call: user = >> self.get_or_create_user(table_user._filter_fields(cas_user)) >> >> At line 1724, within get_or_create_user function, after that web2py >> determine that the user exists: >> >> *update_keys = dict(registration_id=keys['registration_id']) #here is >> the BUG* >> >> I solved it with: >> >> *update_keys = dict(registration_id=keys['registration_id'], >> employee_id=keys['employee_id'])* >> >> So, I think that we need to update the gluon/tools.py file, to improve >> the update of external fields. >> >> On Tuesday, January 8, 2013 11:43:44 AM UTC-6, Anthony wrote: >>> >>> On Tuesday, January 8, 2013 12:08:34 PM UTC-5, Ignacio Ocampo wrote: >>> >>>> I only return a dict in the get_user, web2py does all the work. >>>> >>>> web2py call the get_user method, and web2py update the auth_user table >>>> with the dict values. >>>> >>> >>> >>> Yes, but where are you telling web2py to update the auth_user table? Can >>> you show the code? >>> >>> Anthony >>> >> On Tuesday, January 8, 2013 1:23:45 PM UTC-6, Massimo Di Pierro wrote: > > Perhaps I misunderstand the workflow. The solution cannot be to change an > Auth function to handle a specific custom field. > > The proper signature for the function is > > get_or_create_user(self, keys, update_fields=['email']) > > so if you want to pass employee_id to keys and expect it to update the > record in case it is found you need to pass > > get_or_create_user(self, keys, update_fields=['email', 'employee_id']) > > There are two options here: > 1) allow some auth.settings.update_fields to be specified so the function > is called with right parameters > 2) change it so that update_fields defaults to keys.keys() > > 2) would solve the problem automatically but it may break something. Not > sure. > > Please open a ticket: http://code.google.com/p/web2py/issues/list > but let's discuss it some more. > > Massimo > > > > > On Tuesday, 8 January 2013 12:09:09 UTC-6, Ignacio Ocampo wrote: >> >> Yes, >> >> I only uses: >> >> auth.settings.login_form=MyAuth( >> param1="value1", >> param2="value" >> ) >> >> It's all, I never call and writes/update in the auth_user anywhere. >> >> In gluon/tools.py login function, web2py check if they would use their >> login form or from a central source (line 1955) >> >> At line 2068 web2py determined that central authentication would be used. >> >> At line 2075 web2py call: user = >> self.get_or_create_user(table_user._filter_fields(cas_user)) >> >> At line 1724, within get_or_create_user function, after that web2py >> determine that the user exists: >> >> *update_keys = dict(registration_id=keys['registration_id']) #here is >> the BUG* >> >> I solved it with: >> >> *update_keys = dict(registration_id=keys['registration_id'], >> employee_id=keys['employee_id'])* >> >> So, I think that we need to update the gluon/tools.py file, to improve >> the update of external fields. >> >> On Tuesday, January 8, 2013 11:43:44 AM UTC-6, Anthony wrote: >>> >>> On Tuesday, January 8, 2013 12:08:34 PM UTC-5, Ignacio Ocampo wrote: >>> >>>> I only return a dict in the get_user, web2py does all the work. >>>> >>>> web2py call the get_user method, and web2py update the auth_user table >>>> with the dict values. >>>> >>> >>> >>> Yes, but where are you telling web2py to update the auth_user table? Can >>> you show the code? >>> >>> Anthony >>> >> --