I am trying to setup an email confirmation where a link (below) is sent the email address of a recipient. They click on the link to get to a process that will take the 'post_id' and compare it to the key from the User record associated with the parameter 'i'.
If they are equal the connection url is valid. I just can't get the test to work.
link = http://letshudder.appspot.com/email/confirmation/5662278724616192?i=MichaelClay
Code
def get(self, post_id):
logging.debug("In email confirmation for userid %s" % post_id)
linkid = self.request.GET.get("i")
uid = User.by_id_name(linkid)
logging.debug("The uid of the inviter is %s" % uid)
logging.debug("with a length of %s" % len(str(uid)))
logging.debug("This should match the id value from the link: %s" % post_id)
logging.debug("with a length of %s" % len(str(post_id)))
if uid >= post_id:
logging.debug("UID wins")
if post_id >= uid:
logging.debug("post_id wins")
if uid != post_id:
logging.debug("UID and LINKID did not match")
self.redirect('/invalid_url')
return
. . .
Debug output:
D 2013-08-29 19:18:28.871 In email confirmation for userid 5662278724616192
I 2013-08-29 19:18:28.887 the userid is: MichaelClay
D 2013-08-29 19:18:28.887 The uid of the inviter is 5662278724616192
D 2013-08-29 19:18:28.887 with a length of 16
D 2013-08-29 19:18:28.887 This should match the id value from the link: 5662278724616192
D 2013-08-29 19:18:28.887 with a length of 16
D 2013-08-29 19:18:28.887 post_id wins
I am running Python 2.7 on Google Apps Engine. Any ideas?