Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8047415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:05:24+00:00 2026-06-05T06:05:24+00:00

What i am trying to achieve is getting the user object from the webapp2.cached

  • 0

What i am trying to achieve is getting the user object from the webapp2.cached property.
i have a method defined in my request handler which gives me the current user.

@webapp2.cached_property
  def current_user(self):
  user_dict = self.auth.get_user_by_session()
  return self.auth.store.user_model.get_by_id(user_dict['user_id'])

I want to get the User Object because it is a UserProperty() of one of my models which is as follows:

class CountryImage(db.Model):
  image = db.BlobProperty()
  user = db.UserProperty()
  country = db.ReferenceProperty(Country)
  approved = db.BooleanProperty(default=False)

Now when the upload form is posted, everything works fine except for the “user” which shows as “None” in the datastore.

The possible reason i found while i was playing with it in the interactive console was that
the method current_user passes a web cached property and not the actual user object.

For Example:

< webapp2.cached_property object at 0xb46aee8c > 

Now my question is what would be the best possible way of retrieving the user object ? Thanks in advance for all your help.

Amyth

PS: EDIT:

following is the code where i am trying to store the image in the datastore:

NewImg = models.CountryImage()
NewImg.image = self.request.get('image')
NewImg.user = self.current_user
NewImg.country = models.Country.all().filter("url_name =", country).get()
continue_url = self.request.url
NewImg.put()

PS:

Just to add i have also tried using “users.get_current_user()” method which also returns “None”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:05:26+00:00Added an answer on June 5, 2026 at 6:05 am

    Thanks for your responses, however i have soved this already. In case you are using User model from webapp2_extras (which is an extension to User model from appengine.api.users) you can get the user as follows

    from google.appengine.api import users
    from webapp2_extras.appengine.auth.models import User
    
    user = users.User(User.get_by_auth_id(self.current_user.auth_ids[0]).name)
    

    or

    user = users.User(User.get_by_auth_id(self.current_user.auth_ids[0]).email)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trying to achieve a url rewrite which can be fairly simple but
I am trying to setup a simple database in which I have a user
Trying to achieve any moving effect while appending an element from one to another
im trying to achieve something but i dont really know how I have set
I'm trying to achieve something that seems quite simple but I have hard time
Im trying to achieve an output like this {status:ok,0:{id:11,title:digg,url:http://www.digg.com}} but instead i am getting
I am trying to achieve lookup method injection using a simple example. But, seems
What I am trying to achieve is the following: I want to have numerous
I'm trying to figure out how and which is best for storing and getting
I'm trying to figure out why this is happening. I'll have the user be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.