Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
On Sat, Dec 29, 2012 at 3:45 PM, Massimo Di Pierro wrote: > We can fix this but can't you just leave the first_name and last_name > fields alone, as suggested in the book, but make them invisible? > readable=False, writable=False. And just change the field used in the navbar > as in the example? That's what I've been doing so far (just 'first_name' was needed). But if at all possible I would like as few fields as possible per table. I also wanted to set the primary key of that table to 'email', but it looks like you have to have the 'id' field no matter what. > On Friday, 28 December 2012 21:12:01 UTC-6, Alec Taylor wrote: >> >> Thanks, but that still isn't working for me. >> >> Interesting parts of the traceback: >> >> ('Row' object has no attribute >> 'first_name') >> >>web2py\gluon\dal.py in __getitem__ at line 6453 code arguments >> variables >> Function argument list >> >> (self=> 'name': '', 'email': 'alect...@gmail.com'}>, key='first_name') >> >> Maybe there's some way to change the 'key' there? >> >> On Sat, Dec 29, 2012 at 7:03 AM, Massimo Di Pierro >> wrote: >> > {{=auth.navbar(user_identifier='%(email)s')}} > > -- > > > --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
We can fix this but can't you just leave the first_name and last_name fields alone, as suggested in the book, but make them invisible? readable=False, writable=False. And just change the field used in the navbar as in the example? On Friday, 28 December 2012 21:12:01 UTC-6, Alec Taylor wrote: > > Thanks, but that still isn't working for me. > > Interesting parts of the traceback: > > ('Row' object has no attribute > 'first_name') > >web2py\gluon\dal.py in __getitem__ at line 6453 code arguments > variables > Function argument list > > (self= 'name': '', 'email': 'alect...@gmail.com '}>, > key='first_name') > > Maybe there's some way to change the 'key' there? > > On Sat, Dec 29, 2012 at 7:03 AM, Massimo Di Pierro > > wrote: > > {{=auth.navbar(user_identifier='%(email)s')}} > --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
Thanks, but that still isn't working for me. Interesting parts of the traceback: ('Row' object has no attribute 'first_name') web2py\gluon\dal.py in __getitem__ at line 6453 code arguments variables Function argument list (self=, key='first_name') Maybe there's some way to change the 'key' there? On Sat, Dec 29, 2012 at 7:03 AM, Massimo Di Pierro wrote: > {{=auth.navbar(user_identifier='%(email)s')}} --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
{{=auth.navbar(user_identifier='%(email)s')}} This defaults to user_identifier='%(first_name)s' but you do not have a first name. On Friday, 28 December 2012 01:10:34 UTC-6, Alec Taylor wrote: > > Thanks, but that also isn't working: ` 'exceptions.AttributeError'> 'Row' object has no attribute > 'first_name'` > > But I do get a different traceback, i.e., here: > > web2py\gluon\tools.py", line 1285, in navbar > user_identifier = user_identifier % self.user > > On Fri, Dec 28, 2012 at 5:41 PM, Bruno Rocha > > > wrote: > > > > For the record: > > > > There is a problem on this line > > https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1415 > > > > If you use auth.signature it will raise an error do I propose to change > it > > to: > > > > return '%s %s' % (user.get("first_name", "email"), user.get("last_name", > > "")) > > > > or some other check. > > > > -- > > > > > > > --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
Thanks, but that also isn't working: ` 'Row' object has no attribute 'first_name'` But I do get a different traceback, i.e., here: web2py\gluon\tools.py", line 1285, in navbar user_identifier = user_identifier % self.user On Fri, Dec 28, 2012 at 5:41 PM, Bruno Rocha wrote: > > For the record: > > There is a problem on this line > https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1415 > > If you use auth.signature it will raise an error do I propose to change it > to: > > return '%s %s' % (user.get("first_name", "email"), user.get("last_name", > "")) > > or some other check. > > -- > > > --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
For the record: There is a problem on this line https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1415 If you use auth.signature it will raise an error do I propose to change it to: return '%s %s' % (user.get("first_name", "email"), user.get("last_name", "")) or some other check. --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
I think your problem is in navbar() navbar function uses a parameter user_identifier which is DEFAULT to %(first_name)s but you can change it. go to your layout.html and replace auth.navbar(mode="dropdown") with auth.navbar(mode="dropdown", *user_identifier="%(name)s"*) --
Re: [web2py] Replaced `auth_user` fields 'first_name' and 'last_name' with 'name'; now getting errors
Please provide a full ticket traceback for us to see where exactly it is happening. On Fri, Dec 28, 2012 at 4:21 AM, Alec Taylor wrote: > Replaced auth_user fields 'first_name' and 'last_name' with 'name'; > now I am getting errors. > > My reasoning for using a single 'name' field is to shorten the time it > takes for new users to sign up. > > They are able to add more to their profile after this, but the concept > with my website is people will signup on "impulse" thus its signup > forms need to contain as few fields as possible. > > I have done a grep of my entire app and 'first_name' is not mentioned > anywhere; except in my errors directory! > > It seems that `gluon\tools.py` has hard-coded for you to use the > 'first_name' with 'last_name' convention. > > Can we make this a parameter instead? > > Or is there another way I can get around this? > > Thanks for all suggestions, > > Alec Taylor > > BTW: The error is: ` 'Row' object > has no attribute 'first_name'` > > -- > > > > --