def get(self):
        user = auth.getCurrentUser()
        name = "Web"
        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 models.DeviceDoesNotExistError:
                device = models.DeviceData(user=user_data, name=name).save()
            over_quota = False
            try:
                channel = channels.Channel(device.address,
                        override_quota=user_data.immune())
                channel_token = channel.token
            except channels.OverQuotaError:
                over_quota = True
                channel_token = 'overquota'
            template_values = {
                'channel_id': channel_token,
                'device': device.address,
                'device_name': device.name,
                'devices': user_data.getDevices(),
                'over_quota': over_quota
            }
            path = os.path.join(os.path.dirname(__file__),
                'devlinks_index.html')
            self.response.out.write(template.render(path, template_values))
        else:
            self.redirect(users.create_login_url(self.request.uri))
dataset/ETHPy150Open 2cloud/AppEngine/devlinks.py/MainPage.get/original