##############################################################################
#
# Copyright (c) 2002 Ingeniweb SARL
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################

"""
"""
from global_symbols import *

import os
import sys
import string
import CompressedAttachment
import AttachmentHandler

if sys.platform == "win32":
    program = None
else:
    program = "tar"


class TarGzAttachment(CompressedAttachment.CompressedAttachment):
    """
    Tar / compressed file abstraction
    """
    converter_type = "TarGz"
    content_types = (
        'application/x-tar',
        'application/x-gtar',
        'application/tgz',
        )

    index_path = program
    index_arguments = r'-tzvf %s'
    index_encoding = ('iso-8859-15', 'utf8')

    preview_path = program
    preview_arguments = r'-tzvf %s'
    preview_encoding = ('iso-8859-15', 'utf8')
    preview_format = 'pre'
    


AttachmentHandler.registerHandler(TarGzAttachment)
