Accessing stored details of User! Not able to find how to do it!

23 prikaza
Preskoči na prvu nepročitanu poruku

Pawan Gupta

nepročitano,
8. tra 2014. 16:28:5808. 04. 2014.
u web...@googlegroups.com
Hi, I am a beginner to webapp2 and I'm trying to use the Users module of webapp2_extras. I have a very basic doubt, how to access information stored in a user. I thought something like user.email should work but it says  AttributeError: 'dict' object has no attribute 'email'

I am creating a user signup module:

class SignupForm(Form):
email = TextField('Email',
[validators.Required(),
validators.Email()])
password = PasswordField('Password',
[validators.Required(),
validators.EqualTo('password_confirm',
message="Passwords must match.")])
password_confirm = PasswordField('Confirm Password',
[validators.Required()])


And creating a user like this:

success, info = self.auth.store.user_model.create_user(
"auth:" + form.email.data,
unique_properties=['email', 'id'],
email= form.email.data,
id= id_value,
password_raw= form.password.data)


I want to be able to access the email of the user stored. A very basic thing but I haven't been able to find any solution!

I tried printing the user after getting it by self.auth.get_user_by_password, but I get the following and it doesn't have the email field:

{'token_ts': 1396988734, 'cache_ts': 1396988734, 'remember': 0, 'user_id': 5838406743490560L, 'token': u'Qjg8W6IX2Ujjrbxi0u4gv4'}



I know it's a very basic doubt but your help will get me started on it! Thanks a lot! :)





Odgovori svima
Odgovori autoru
Proslijedi
0 novih poruka