mò
d{£>c           @   sp   d  Z  d d d !Z d d d !Z d d d !Z d k Z d k Z d k Z d k Z d k Z d   Z	 d	   Z
 d S(
   sÌ   
$RCSfile: FileUtils.py,v $

File handling routines called from multiple modules are collected
here to avoid duplication.

Author: <a href="mailto:cstrong@arielpartners.com">Craeg Strong</a>
Release: 1.2
s	   $Name:  $i   iŝ˙˙˙s   $Date: 2003/04/21 00:56:27 $s   $Revision: 1.6 $i
   Nc         C   s  t  |   t i j o t |  d  } d } n d } |  } t  |  t i j o t | d  } d } n d } | } zn d d >} | i |  } | i |  x4 t |  | j o  | i |  } | i |  q˘ W| i d  Wd | o | i   n | o | i   n Xd S(   sÔ   

    Read binary data from infile and write it to outfile. infile and
    outfile my be strings, in which case a file with that name is
    opened, or filehandles, in which case they are accessed directly.

    t   rbi   i    t   wbi   i   N(   t   typet   infilet   typest
   StringTypet   opent   instreamt   close_int   outfilet	   outstreamt	   close_outt	   blocksizet   readt   blockt   writet   lent   seekt   close(   R   R	   R   R   R
   R   R   R   (    (    tE   /home2/kennisonb/webapps/zope/Zope/Products/ExternalFile/FileUtils.pyt	   copy_file   s2     


    c         C   s5   |  o t |  |  n t | d  } | i   d S(   sn  
    
    Creates a physical file on the filesystem at target_filepath.  If
    contents_file is not None, it points to a file whose contents will
    be copied into the target file.  Otherwise, a zero length file
    will be created.  This method will raise an exception if there are
    any problems writing to the target file (or reading
    contents_file).

    R   N(   t   contents_fileR   t   target_filepathR   t	   touchfileR   (   R   R   R   (    (    R   t   create_file3   s
    
 (   t   __doc__t
   __cvstag__t   __date__t   __version__t   ost   os.patht   stringR   t   urllibR   R   (	   R   R   R   R    R   R   R   R   R   (    (    R   t   ?	   s   -	!