示例#1
0
文件: rpcserver.py 项目: timypcr/viri
    def rm(self, cert, file_id):
        """Removes a file given its id"""
        import logging
        from libviri.objects import File

        if File.exists(self.db, file_id):
            logging.info('File {} removed'.format(file_id))
            File.delete(self.db, {'file_id': file_id})
            return (SUCCESS, 'File successfully removed')
        else:
            return (ERROR, 'File not found')
示例#2
0
    def rm(self, cert, file_id):
        """Removes a file given its id"""
        import logging
        from libviri.objects import File

        if File.exists(self.db, file_id):
            logging.info('File {} removed'.format(file_id))
            File.delete(self.db, {'file_id': file_id})
            return (SUCCESS, 'File successfully removed')
        else:
            return (ERROR, 'File not found')
示例#3
0
文件: rpcserver.py 项目: timypcr/viri
    def mv(self, cert, file_id, new_file_name):
        """Renames file with the given id"""
        import logging
        from libviri.objects import File

        if File.exists(self.db, file_id):
            logging.info('File {} renamed to {}'.format(
                file_id, new_file_name))
            File.update(self.db, {'file_name': new_file_name},
                        {'file_id': file_id})
            return (SUCCESS, 'File successfully renamed')
        else:
            return (ERROR, 'File not found')
示例#4
0
    def mv(self, cert, file_id, new_file_name):
        """Renames file with the given id"""
        import logging
        from libviri.objects import File

        if File.exists(self.db, file_id):
            logging.info('File {} renamed to {}'.format(file_id, new_file_name))
            File.update(self.db,
                {'file_name': new_file_name},
                {'file_id': file_id})
            return (SUCCESS, 'File successfully renamed')
        else:
            return (ERROR, 'File not found')
示例#5
0
文件: rpcserver.py 项目: timypcr/viri
    def exists(self, cert, file_id):
        """Returns True if a file with the given id exists."""
        from libviri.objects import File

        return (SUCCESS, File.exists(self.db, file_id))
示例#6
0
    def exists(self, cert, file_id):
        """Returns True if a file with the given id exists."""
        from libviri.objects import File

        return (SUCCESS, File.exists(self.db, file_id))