def get(self, uuid): invite = InviteCode.gql("WHERE uuid=:1", uuid).get() if invite == None: logging.error("invite not found: " + uuid) self.error(500) return if self.currentuser == None: self.currentuser = UserInfo(user=users.get_current_user()) self.currentuser.put() relationship = GroupUserInfo.gql("WHERE user=:1 AND group=:2", self.currentuser, invite.group).get() if relationship == None: relationship = GroupUserInfo(user=self.currentuser, group=invite.group, groupname=invite.group.shortname) relationship.put() invite.delete() if is_empty(self.currentuser.nickname): self.render('edit_profile') return self.redirect('/' + invite.group.shortname)
def post(self): userinfo = self.currentuser if userinfo == None: userinfo = UserInfo() userinfo.nickname = cgi.escape(self.request.get('nickname')) if is_empty(userinfo.nickname): self.render_edit("nickname can't be empty") return email = cgi.escape(self.request.get('email')) avatar = self.request.get('avatar') first_login = self.request.get('first_login') if avatar != '': avatar = images.resize(avatar, 128) userinfo.avatar = db.Blob(avatar) if email == '': email = 'none' userinfo.email = email if first_login != '': userinfo.lastposted = date.today() userinfo.lastvoted = userinfo.lastposted userinfo.put() self.redirect('/')