0
我試圖設置一個電子郵件確認,其中的鏈接(以下)發送給收件人的電子郵件地址。他們點擊鏈接進入一個將採用'post_id'的流程,並將其與來自與參數'i'相關聯的用戶記錄中的鍵進行比較。針對url參數的數據庫密鑰測試失敗(Python)
如果它們相等,則連接url有效。我只是無法讓測試工作。
鏈路= http://letshudder.appspot.com/email/confirmation/5662278724616192?i=MichaelClay
代碼
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
。 。 。
調試輸出:
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
我在谷歌應用引擎上運行的Python 2.7。有任何想法嗎?