Exemplo n.º 1
0
    def get_user(self):
        user = users.get_current_user()
        if user: 
            return User(user)

        guest_id = gaeutil.get_cookie(self.request, "guest_id")
        if not guest_id:
            import datetime, hashlib
            guest_id = hashlib.sha1("%s %s" % (
                datetime.datetime.now().isoformat(),
                self.request.remote_addr
            )).hexdigest()
            gaeutil.set_cookie(self.response, "guest_id", guest_id)

        return GuestUser(guest_id)