Пример #1
0
    def delete(self):
        """Delete specific snapshot"""
        if not users.is_current_user_admin():
            self.error(403)

        snapshot_id = self.request.path.split('/')[-1]
        metadata = SnapshotMetadata.get_by_id(int(snapshot_id))
        content = SnapshotContent.all().filter('metadata =', metadata).get()

        if metadata:
            content.delete()
            metadata.delete()
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success');
        else:
            self.error(404)
Пример #2
0
    def delete(self):
        """Delete specific snapshot"""
        if not users.is_current_user_admin():
            self.error(403)

        snapshot_id = self.request.path.split('/')[-1]
        metadata = SnapshotMetadata.get_by_id(int(snapshot_id))
        content = SnapshotContent.all().filter('metadata =', metadata).get()

        if metadata:
            content.delete()
            metadata.delete()
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success')
        else:
            self.error(404)
Пример #3
0
    def put(self):
        """Mark a specific snapshot as active"""
        if not users.is_current_user_admin():
            self.error(403)

        snapshot_id = self.request.path.split('/')[-1]
        metadata = SnapshotMetadata.get_by_id(int(snapshot_id))

        if metadata is None:
            self.error(404)
        else:
            current = SnapshotMetadata().all().filter('active =', True).get()
            if current:
                current.active = False
                current.save()
            metadata.active = True
            metadata.save()

            init_cached_translations()

            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success');
Пример #4
0
    def put(self):
        """Mark a specific snapshot as active"""
        if not users.is_current_user_admin():
            self.error(403)

        snapshot_id = self.request.path.split('/')[-1]
        metadata = SnapshotMetadata.get_by_id(int(snapshot_id))

        if metadata is None:
            self.error(404)
        else:
            current = SnapshotMetadata().all().filter('active =', True).get()
            if current:
                current.active = False
                current.save()
            metadata.active = True
            metadata.save()

            init_cached_translations()

            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success')