to avoid modifying t2.py I redefined the instance method externally
like this:
def login(self,next='index',onlogin=None):
request,response,session,cache,T,db=self._globals()
form=SQLFORM(db.t2_person,fields=['name','password'],\
hidden=dict(_destination=request.vars._destination),
_class='t2-login')
if FORM.accepts(form,request.vars,session):
rows=db(db.t2_person.name==form.vars.name)\
(db.t2_person.password==form.vars.password)\
(db.t2_person.registration_key=='').select()
if rows:
session.t2.person_id=rows[0].id
session.t2.person_name=rows[0].name
session.t2.person_email=rows[0].email
session.flash=self.messages.logged_in
if onlogin: onlogin(rows[0])
if request.vars._destination:
redirect(request.vars._destination)
self.redirect(next)
else:
session.flash=self.messages.invalid_login
self.redirect()
return form
instancemethod = type(T2.login)
t2.login = instancemethod(login, t2, T2)
On Nov 17, 9:58 am, Baron <[EMAIL PROTECTED]> wrote:
> hello,
>
> I wasn't able to run your example because of tabbing issues, but from
> examining it I see you added the user_role field. But the login and
> register forms still seem to require an email - is that right?
> How do you intend to deal with updates to t2.py? Stay with your edited
> version, or remake these edits after each update?
>
> Richard
>
> On Nov 17, 4:16 am, tommy <[EMAIL PROTECTED]> wrote:
>
> > I had same issue, I changed the t2.py and it worked out. Here is my
> > code. I added one field in the personal table.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---