2011-06-10 50 views

回答

0

電子郵件()

Returns the email address of the user. If you use OpenID, you should not rely on this email address to be correct. Applications should use nickname for displayable names. 

沒有內置的方法來做到這一點。但是你可以做這樣的事情

from google.appengine.api import users 
user =user=users.get_current_user() 

email = user.email() 
username = str(email).split('@')[0] 
+0

記住,電子郵件地址的用戶部分在技術上可以包含一個「@」符號(雖然我從來沒有見過一個在野外)。您應該使用rsplit來查找_last_ @符號左側的所有內容。 – 2011-06-11 07:56:47

1

從谷歌應用服務引擎的代碼:

暱稱是人類可讀的字符串它唯一地標識一個谷歌 用戶,類似於用戶名。這將是一些用戶的電子郵件地址,但不是全部。

所以它可能是用戶名或電子郵件取決於帳戶。