yes, I think you are correct - since "username" is not in the default table definition,
table access should be in a try / except, with some reasonable behavior... there are at least 3 places this exists... What woiuld be reasonable? if username doesn't exist in your tables, try 'email' next, and generate a silent ticket, or just fail the user? On Thu, Aug 6, 2009 at 8:38 PM, Yarko Tymciurak <yark...@gmail.com> wrote: > I see - so you would want an exception to be raised? What do you propose? > > > On Thu, Aug 6, 2009 at 8:26 PM, Bottiger <bottig...@gmail.com> wrote: > >> >> The function takes a dictionary where if the username key is defined, >> then it assumes that your database has a "username" column which is >> incorrect behavior. >> >> On Aug 6, 6:16 pm, Yarko Tymciurak <yark...@gmail.com> wrote: >> > On Thu, Aug 6, 2009 at 8:09 PM, Bottiger <bottig...@gmail.com> wrote: >> > >> > > I am using the latest version. >> > >> > By "latest version" do you mean revision 1062 from Launchpad, or do you >> > mean >> > >> > >> > >> > > I know there is a check, but the check is useless. If you specify a >> > > username in the dictionary that comes with the argument, then it will >> > > automatically assume that your auth_users table has a username column, >> > > which isn't the case. >> > >> > You you define the auth_users table, then you can define this additional >> > field; >> > if not, it uses the email field. >> > This is how it is designed. >> > >> > Am I missing something? >> > >> > >> > >> > > On Aug 6, 5:58 pm, Yarko Tymciurak <yark...@gmail.com> wrote: >> > > > Which version of web2py are you looking at? >> > >> > > > First - in the most current version, I think you are talking about >> line >> > > 653, >> > > > in >> > > > get_or_create_user(); >> > >> > > > You will note at the beginning of that function: >> > >> > > > if 'username' in keys: >> > > > username = 'username' >> > > > elif 'email' in keys: >> > > > username = 'email' >> > > > else: >> > > > raise SyntaxError, "user must have username or email" >> > >> > > > (there are 2 other places with lines like this, and they do similar >> > > checks; >> > > > so you can define a username in your auth, or by default it uses >> email). >> > >> > > > You might want to get a look at: >> > >http://bazaar.launchpad.net/~mdipierro/web2py/devel/annotate/head%3A/<http://bazaar.launchpad.net/%7Emdipierro/web2py/devel/annotate/head%3A/> >> .<http://bazaar.launchpad.net/%7Emdipierro/web2py/devel/annotate/head%3A/ >> .> >> > > .. >> > >> > > > BEWARE: if you get the latest revision from launchpad, there is a >> bug in >> > > > template.py - which I'm waiting for Massimo to apply the patch >> for... >> > > You >> > > > can remove the ".read()" portion of line 120 yourself in the >> meantime, >> > > that >> > > > is in parse_template(): >> > >> > > > try: >> > > > fp = open(t, 'rb').read() >> > > > parent = fp.read() >> > > > fp.close() >> > >> > > > should read: >> > >> > > > try: >> > > > fp = open(t, 'rb') >> > > > parent = fp.read() >> > > > fp.close() >> > >> > > > - Yarko >> > >> > > > On Thu, Aug 6, 2009 at 7:29 PM, Bottiger <bottig...@gmail.com> >> wrote: >> > >> > > > > I am trying to incorporate OpenID into Auth. >> > >> > > > > In my attempt to implement a CAS style plugin into auth, I >> stumbled >> > > > > upon a bizzare error. >> > >> > > > > On line 628 of gluon.tools, there is the following line: >> > >> > > > > "users = self.db(table_user[username] == keys[username]).select()" >> > >> > > > > username is defined to be "username" if you have a username and >> > > > > "email" if you have email specified. However, when I looked at the >> > > > > auth_user table, there is no "username" column. >> > >> > > > > The closest thing to a username column is first_name or last_name, >> but >> > > > > obviously this isn't the same thing. >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---