python - create permenant unique links based on a user ID -
possible duplicate:
create unique profile page each user python
i using google appengine python , jinja2 , trying give each user in app unique url profile page can visited without logging in. here code far:
class profilepage(webapp2.requesthandler): def get(self, profile_id): user = user.get_by_id(profile_id) #profile_id = unique field if user: #get posts user , render.... theid = user.theid personalposts = db.gqlquery("select * post theid =:1 order created desc limit 30", theid) else: personalposts = none global visits logout = users.create_logout_url(self.request.uri) currentuser = users.get_current_user() self.render('profile.html', user = currentuser, visits = visits, logout=logout, personalposts=personalposts) app = webapp2.wsgiapplication([('/', mainpage), ('/profile/([0-9]+)', profilepage),])
when try , test it gives me 404 error. suppose if code right might using wrong testing url. example if openid id: how can test out tried entering www.url.com/profile/https://www.google.com/accounts/o8/id?id=aitoawliloskgnwu5rutirtxug1l8rale45g-56 id="this part" put have:
url = www.url.com/profile/aitoawliloskgnwu5rutirtxug1l8rale45g-56
that's tried , didn't quite work. in advance help!
try regular expression:
r'^/profile/\w*?-(\d+)$'
though must tell bad idea!
Comments
Post a Comment