def post(self, name="Chrome"):
        self.response.headers.add_header("Access-Control-Allow-Origin", "*")
        user = auth.getCurrentUser()
        device = None
        if user:
            try:
                user_data = models.getUser(user)
            except models.UserDoesNotExistError:
                user_data = models.UserData(user=user).save()
            try:
                device = models.getDevice("%s/%s" % (user.email(), name))
            except:
                device = models.DeviceData(user=user_data, name=name).save()
            last_links = models.getUnreadLinks(device)
            channel = channels.Channel(device.address, False)
            for link in last_links:
                channel.queueLink(link)
            channel.send()
            stats.record("user_connected",
                    simplejson.dumps({"user": user.email()}))
            self.response.out.write(device.address)
dataset/ETHPy150Open 2cloud/AppEngine/devlinks.py/ConnectedPage.post/original