
HqKc        1   @   s  d  Z  d d d !Z d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k	 Z	 d d k
 Z
 d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z d d k l Z d d k l Z d d	 k l Z d d
 k l Z l Z d d k l Z d d k l Z d d k  l! Z! d d k" l# Z# l$ Z$ l% Z% l& Z& l' Z' l( Z( d d k) l* Z* d d k+ l+ Z+ d d k, l- Z- d d k. Z. d d k/ l0 Z0 d Z1 y d d k2 l2 Z2 d Z1 Wn d Z1 n Xd d k3 l4 Z4 e i5 d j Z6 e6 oE y d d k7 Z7 Wn e8 j
 o n Xd d k Z e i9 d  Z: n d d Z; d Z< d   Z= d   Z> h d d f d  6d d f d! 6d d" f d# 6d$ d% f d& 6d' d% f d( 6d' d% f d) 6d* d% f d+ 6d d, f d- 6d d, f d. 6d/ d0 f d1 6d2 d0 f d3 6d4 d0 f d5 6d6 d0 f d7 6d8 d0 f d9 6d: d0 f d; 6d< d0 f d= 6d d> f d? 6d@ dA f dB 6Z? dC Z@ dD   ZA dE   ZB h  dF dG 6dH dI 6dJ dK 6dH dL 6dM dN 6dO dP 6dM d: 6dQ d4 6dR dS 6dT dU 6dJ dV 6dW d< 6dT dX 6dY dZ 6dJ d[ 6d\ d] 6d\ d^ 6d\ d/ 6d\ d_ 6dW d` 6dW d$ 6dW d' 6dW d* 6dW d6 6da db 6dM d 6da dc 6dd de 6dQ df 6dQ dg 6dQ dh 6dQ d2 6ZC di ZD x( eC iE   D] \ ZF ZG eD eG eC eF <qWdj ZH dk   ZI dl   ZJ dm   ZK dn   ZL do   ZM dp   ZN dq   ZO dr   ZP h eL d" 6eM d 6eN d% 6eO ds 6eP d, 6ZQ dt   ZR du   ZS dv   ZT dw f  dx     YZU dy ZV h  ZW dz   ZX d{   ZY d|   ZZ d}   Z[ d~   Z\ d   Z] h e[ d 6e[ d 6e\ d% 6e\ ds 6e] d 6e[ d 6Z^ d   Z_ d   Z` d   Za d   Zb d   Zc g  Zd d   Ze e i9 d  if Zg d   Zh d   Zi d e ij ik e il im e in io e ip f d     YZq d e in io e ip f d     YZr d f  d     YZs d eq e it it e iu e iv iw f d     YZx ey ey ey d  Zz e d e{    Z| d S(   s   Local File System products   $Revision: 1.8 $i   iiN(   t	   getObject(   t   ProductDispatcher(   t   NullResource(   t   HTTPResponse(   t   MessageDialogt   HTMLFile(   t   find_binary(   t   Pdata(   t
   encode_str(   t
   _cb_encodet
   _cb_decodet	   CopyErrort   eNoDatat   eInvalidt	   eNotFound(   t	   TimeStamp(   t   DateTime(   t
   StringType(   t   xmlrpci    (   t   StreamingFilei   (   t   ZopePageTemplatet   win32s   (\\\\[^\\]+\\[^\\]+)(.*)i   i   s	   (unknown)c         C   s'   y | |  SWn t  j
 o d SXd S(   t   _get_content_typeN(   NN(   t   KeyErrort   None(   t   extt	   _type_map(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   c   s      c         C   s   | o | |  _  n t |  d  om |  i  d j o] | d j o d St i t i |   } | d  d j o | d  d j o d |  _  q n d S(	   t   _set_content_typet   content_types	   text/htmlNi   s   <html>i   s   <!doctype htmls
   text/plain(   R   t   hasattrt   stringt   lowert   strip(   t   obR   t   data(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   h   s      "s	   text/htmlt   DTMLDocuments   .htmls   .htmt
   DTMLMethods   .dtmls	   image/gift   Images   .gifs
   image/jpegs   .jpgs   .jpegs	   image/pngs   .pngt   PageTemplates   .pts   .zpts   audio/vnd.rn-realaudiot    s   .ras   video/vnd.rn-realvideos   .rvs   application/vnd.rn-realmedias   .rms   image/vnd.rn-realpixs   .rps   text/vnd.rn-realtexts   .rts   application/smils   .smis   application/x-shockwave-flashs   .swfsA   Products.StructuredDocument.StructuredDocument.StructuredDocuments   .stxs   text/xmls"   LocalFS.Factory.XMLDocumentFactorys   .xmls   Error parsing type map: '%s'c         C   s   |  p d Sh  } x |  D] } | o y t  i |  \ } } d } WnX t j
 oL y" t i d | d  \ } } } Wq t j
 o t t |  q Xn X| | f | | <q q W| S(   t   _list2typemapNR'   s   [ 	]+i   (   R   t   splitt
   ValueErrort   ret   _typemap_error(   t   lt   mt   it   et   tt   c(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR(      s       
 " c         C   s   g  } |  i    } | i   xx | D]p } |  | } t |  t d  j o+ | i t i | | d | d f   q# | i t i | | f   q# W| S(   t   _typemap2listi    i   (    (   t   keyst   sortt   typet   appendR   t   join(   R.   R-   R4   t   kt   v(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR3      s    
 
 + s   dir.gift	   directorys
   binary.gift   applications   compressed.gifs   application/mac-binhex40s   application/octet-streams
   layout.gifs   application/pdfs   ps.gifs   application/postscripts	   movie.gifs   dvi.gifs   application/x-dvis   tar.gifs   application/x-gtars   application/x-gzips
   image2.gifs   application/x-tars   tex.gifs   application/x-texs   application/zips
   sound1.gift   audios
   audio/mpegs   audio/x-wavt   images   text.gift   texts
   text/plains   p.gifs   text/x-pythont   videos
   video/mpegs   video/quicktimes   misc_/LocalFS/s   Error parsing icon map: '%s'c         C   sx   |  p d Sh  } x_ |  D]W } | oJ y t  i |  \ } } Wn  t j
 o t t |  n X| | | <q q W| S(   t   _list2iconmapN(   R   R)   R*   t   _iconmap_error(   R-   R.   R/   R9   R:   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRA      s        c         C   sQ   g  } |  i    } | i   x. | D]& } | i t i | |  | f   q# W| S(   t   _iconmap2list(   R4   R5   R7   R   R8   (   R.   R-   R4   R9   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRC      s    
 $c         C   s   d } t i i |  d } t | |  \ } } | d j	 oe t | |  | |  } | d j o t | |  | |  } n | d j o t | |  | |  } q n | d j o t t	 |  |  |  } n | i
 d  d | _ t | | | i t   | S(   t
   _create_obii    t	   LocalFileN(   R   t   ost   patht   splitextR   t   _create_builtin_obt   _create_ob_from_functiont   _create_ob_from_factoryt   _wrap_obt   _create_Filet   seekt   __doc__R   t   readt
   _test_read(   t   idt   fileRG   R   R!   R   R1   R2   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRD      s    	c         C   s   t  i i | i   d |  S(   t   _create_DTMLMethodt   __name__(   t   OFSR$   RP   (   RR   RS   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRT      s    c         C   s   t  i i | i   d |  S(   t   _create_DTMLDocumentRU   (   RV   R#   RP   (   RR   RS   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRW      s    c         C   s   t  i i |  d |  S(   t   _create_ImageR'   (   RV   R%   (   RR   RS   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRX      s    c         C   s4   t  d j o t |  d |  St i i |  d |  S(   RM   i   R'   (   t   ITERATORS_PRESENTR   RV   R%   t   File(   RR   RS   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRM      s    c         C   s   t  |  | d d S(   NR   s	   text/html(   R   (   RR   RS   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _create_ZPT  s    RZ   c         C   s2   y$ t  |  } t | | |  |  SWn n Xd  S(   N(   t   _builtin_createRL   (   R2   RR   RS   RG   t   f(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRI     s
    
 c      
   C   s   y t  i |  d  } |  |  |  | d } }  t | t   t   |  f  } t | |   }  t |  d  i } | i i d j o t	 | | |  |  SWn n Xd  S(   Nt   .i   t
   createSelfRR   RS   (   s   ids   file(
   R   t   rindext
   __import__t   globalst   localst   getattrt   im_funct	   func_codet   co_varnamesRL   (   R2   RR   RS   RG   R/   R.   R]   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRJ     s     c      	   C   sz   yl t  i |  d  } |  |  |  | d } }  t | |   }  |    } t | | |  |  } | | _ | SWn n Xd  S(   NR^   i   (   R   R`   R    RL   t	   __factory(   R2   RR   RS   RG   R/   R.   R]   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRK   "  s    		 t   Wrapperc           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s)   Mix-in class used to save object changes.c         C   s#   t  i |  i  t i } t |  S(   N(   RF   t   statt   _local_patht   ST_MTIMER   (   t   selfR1   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   bobobase_modification_time1  s    c         C   s'   |  i  i d i } d | t |   f S(   Nis"   <%s ObjectWrapper instance at %8X>(   t	   __class__t	   __bases__RU   RR   (   Rm   R2   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   __repr__5  s    N(   RU   t
   __module__RO   R   Rk   Rn   Rq   (    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRi   -  s   	s   def %(name)s %(arglist)s:
    """Wrapper for the %(name)s method."""
    r = apply(self.__class__.__bases__[-1].%(name)s, %(baseargs)s)
    try: _save_ob(self, self._local_path)
    except ValueError: pass
    return r
c         C   sq   y t  |  SWn^ t j
 oR d t |  f d     Y} t | d  t | d  t | d  | t  |  <| SXd  S(   Nt   ObjectWrapperc           B   s   e  Z RS(    (   RU   Rr   (    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRs   F  s    t   manage_editt   manage_uploadt   pt_edit(   t	   _wrappersR   Ri   t   _wrap_method(   R2   Rs   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _get_wrapperC  s     
c   	      B   sp  y e  |  i d |  } Wn e j
 o d  SX| i } e | i i  | i i  } | i p d } g  } g  } xG e	 |  e	 |  j o- | i
 | d  | i
 | d  | d =qu WxK e e	 |   D]7 } | i
 d | | | | f  | i
 | |  q Wd e i | d  d } d e i | d  d } h  } e e   e   | Ue |  | | |  d  S(   Nii    s   %s=%st   (t   ,t   )(    (   Rd   Rp   t   AttributeErrorRe   t   listRf   Rg   t   co_argcountt   func_defaultst   lenR7   t   rangeR   R8   t   _wrapper_methodt   varsRb   t   setattr(	   R2   t   nameR.   R]   t   at   dt   arglistt   baseargsR/   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRx   M  s.      	   c         C   s   |  i  } |  i } t | d  o5 t |  } |  i } | i   }  |  i i |  n t |  } | |  _  | |  _ | |  _ |  S(   Nt   __basicnew__(   Ro   RU   R   Ry   t   __dict__R   t   updateRk   (   R!   RG   R2   t   nR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRL   d  s    						c         C   s8   t  | d  } z | i |  i    Wd  | i   Xd  S(   Nt   w(   t   opent   writeRP   t   close(   R!   RG   R]   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt
   _save_DTMLs  s    c         C   s   t  |  i d  oF |  i i t j o3 t | d  } | i t |  i   | i   nS t |  i  d j o t | d  } n t | d  } | i |  i  | i   d  S(   NRo   t   wbi    R   (	   R   R"   Ro   R   R   R   t   strR   R   (   R!   RG   R]   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt
   _save_Filez  s    &c         C   s   t  i |  d  S(   N(   RF   t   mkdir(   R!   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _save_Folder  s    s   DTML Methods   DTML Documentt   Folders   Page Templatec         C   s<   y" t  |  i } | |  |  d SWn t j
 o n Xd  S(   Ni   (   t   _builtin_savet	   meta_typeR   (   R!   RG   R]   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _save_builtin_ob  s     c         C   s#   y |  i  |  d SWn n Xd  S(   Ni   (   t   saveSelf(   R!   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _save_ob_with_function  s
     c         C   s)   y |  i  i |  |  d SWn n Xd  S(   Ni   (   Rh   t   save(   R!   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _save_ob_with_factory  s
     c         C   sb   t  |  |  } | p t |  |  } n | p t |  |  } n | p t d |  i  n d  S(   Ns   Cannot save files of type '%s'.(   R   R   R   t	   TypeErrorR   (   R!   RG   t   s(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _save_ob  s    c         C   sE   t  i |  t i } t t t i |  d   } t |  |  _ d  S(   Ni   (	   RF   Rj   Rl   t   applyR   t   timet   gmtimet   reprt	   _p_serial(   R!   RG   R1   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _set_timestamp  s    c         C   s:   |  t  i j p! |  t  i j p |  d d j o d Sd S(   Ni    t   _i   (   RF   t   curdirt   pardir(   RR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   valid_id  s    1 s   [^a-zA-Z0-9-_~,. ]c         C   s   t  |   o |    S|  S(   N(   t   callable(   t   attr(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   absattr  s     c         C   s2   |  i  } | i } | t |   | j o d Sd  S(   Ni   (   t   basepathRk   R   (   R2   R!   t   destt   src(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   sanity_check  s    		 t   LocalDirectoryc           B   s  e  Z d  Z d Z d Z e   Z e d e    Z	 e d e    Z
 e d e    Z h d d 6d d	 6h d
 d 6d d	 6h d d 6d d	 6f Z d Z e i   Z e i d d d d  dE d  Z d   Z d   Z d   Z d   Z dE d  Z dE d  Z e d  Z e d  Z dE dE d  Z d d  Z d d  Z d    Z  d!   Z! d"   Z" d#   Z# d$   Z$ d%   Z% d&   Z& d' dE d(  Z' d) d' dE d*  Z( dE d+  Z) dE d,  Z* dE d-  Z+ dE dE d.  Z, dE dE d/  Z- d0   Z. g  dE d1  Z/ dE d2  Z0 dE d d3  Z1 dE d d4  Z2 dE d5  Z3 dE d6  Z4 dE d7  Z5 dE d8  Z6 dE d9  Z7 dE d:  Z8 d;   Z9 d<   Z: d=   Z; d>   Z< d?   Z= d@   Z> e i? dA  dB   Z@ dC   ZA dD   ZB RS(F   s9   Object representing a directory in the local file system.s   Local Directoryi    s	   dtml/mains   dtml/methodBrowses   dtml/methodUploadt   Contentst   labelt   manage_maint   actiont   Viewt
   index_htmlt   Uploadt   manage_uploadForms   misc_/OFSP/Folder_icon.gifs
   FTP accesst   manage_FTPstatt   manage_FTPgett   manage_FTPlistc	   	      C   sZ   | |  _  | |  _ |  _ | |  _ | |  _ |  _ | |  _ | |  _ | |  _ | |  _	 d S(   s   LocalDirectory __init__N(
   RR   R   Rk   t   roott	   tree_viewt   isPrincipiaFolderisht   catalogR   t	   _icon_mapt   file_filter(	   Rm   RR   R   R   R   R   R   R   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   __init__  s    					c         C   s   | i  d d  i   } y+ | d j o t |  | |  i |   SWn n Xy |  i |  SWn n Xy t |  |  SWn t j
 o n Xd S(   s    bobo_traverse t   REQUEST_METHODt   GETt   POSTt   HEADN(   s   GETs   POSTs   HEAD(   t   gett   upperR   t   __of__t   _safe_getObRd   R}   (   Rm   t   REQUESTR   t   method(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   __bobo_traverse__  s    c         C   s.   t  |  t j o |  i |  St d  d  S(   Ns   index must be a string(   R6   R   R   R   (   Rm   R/   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   __getitem__  s     c         C   s4   y |  i  |  SWn d j
 o t |  n Xd  S(   Nt   NotFound(   R   R}   (   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   __getattr__  s      c         C   s   t  i i |  i |  S(   N(   RF   RG   R8   R   (   Rm   RR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _getpath  s    c         C   s<   | d  j o |  i } n |  i |  } t |  | | |  S(   N(   R   R   R   RE   (   Rm   RR   t   specRG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt
   _getfileob  s    c   	      C   s  | d  j o |  i } n y t i |  i  } WnN t t f j
 o< } | d t i j o d t	   i
 d d   q   n X| d  j	 o0zt |  t d  j o t i | d  } n t i   } t i |  i  g  } xL | D]D } t i i |  o d | j p d | j o | i |  q q Wxn | D]f } t i |  } xN | D]F } | d t i j o | d  } n | | j o | i |  qTqTWq8W| } Wd  t i |  Xn t t |  } | i   | S(	   Ni    t	   ForbiddensE   Sorry, you do not have permission to read the requested directory.<p>R'   t    s   */s   *\i(   R   R   RF   t   listdirR   t   OSErrort   IOErrort   errnot   EACCESR   t   _error_htmlR6   R   R)   t   getcwdt   chdirRG   t   isdirR7   t   globt   sept   filterR   R5   (	   Rm   R   t   idst   errR   R-   RR   t   pattt   names(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _ids  sF      -   

c         C   s   |  i  | |  S(   N(   t   _getOb(   Rm   R   t   default(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   ?  s    c         C   s  | t  i t  i f j o t |  n d  } |  i |  } t  i i |  o8 t | | |  i	 p |  |  i
 |  i |  i |  i  } n? t  i i |  o+ t | d  } t | | | |  i  } n | d  j o | t j o t |  n | St | |  |  i | _ | i |   S(   Nt   rb(   RF   R   R   R*   R   R   RG   R   R   R   R   R   R   R   t   isfileR   RD   t   _markerR}   R   t   _p_jarR   (   Rm   RR   R   R!   RG   R]   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   B  s"    c         C   sb   y t  |  i d  } Wn d  } n X| o |  i | d  n |  i |  |  i | |  | S(   Nt   __null_resource__i   (   Rd   t	   aq_parentR   t   _checkIdt   _safe_setOb(   Rm   RR   t   objectt   rolest   usert   put(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt
   _setObjectU  s    
i   c         C   s   |  i  |  d  S(   N(   t   _delOb(   Rm   RR   t   dp(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt
   _delObjecta  s    c         C   s   | p d d  n t  |  o d d |  n | d d j o d d |  n | p7 |  i |  } t i i |  o d d |  q n d  S(   Ns   Bad Requests   No id was specifieds3   The id %s contains characters illegal in filenames.i    R   s5   The id %s  is invalid - it begins with an underscore.s,   The id %s is invalid - it is already in use.(   t   bad_idR   RF   RG   t   exists(   Rm   RR   t	   allow_dupRG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   d  s     c         C   sc   y |  i  | |  WnH t j
 o< } | d t i j o d t   i d d   q_   n Xd  S(   Ni    R   s@   Sorry, you do not have permission to write to this directory.<p>(   t   _setObt   EnvironmentErrorR   R   R   R   (   Rm   RR   R!   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   u  s     c         C   sg   t  | d  p d d  n |  i |  } y t | |  Wn# t j
 o d d | i  n Xd  S(   NR   s   Bad Requests   Unknown object type.s5   Cannot add objects of type '%s' to local directories.(   R   R   R   R   R   (   Rm   RR   R!   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s     c         C   s   |  i  |  } yA t i i |  o d } t i |  n d } t i |  Wn t j
 o } | d t i j oc | d j o$ t i	 |  o d } d | } n d } d | | f } | t
   i | |   q   n Xd  S(   NR;   RS   i    s   Delete Errors    The directory '%s' is not empty.R   sD   Sorry, you do not have permission to delete the requested %s ('%s').(   R   RF   RG   R   t   rmdirt   unlinkR  R   R   R   R   R   (   Rm   RR   RG   R1   R   R0   R.   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s"    c         C   s   |  i  | |  d  S(   N(   R   (   Rm   RR   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _copyOb  s    c         C   s{   | i  } |  i |  } y t i | |  WnH t j
 o< } | d t i j o d t   i d d   qw   n Xd  S(   Ni    R   s@   Sorry, you do not have permission to write to this directory.<p>(	   Rk   R   RF   t   renameR  R   R   R   R   (   Rm   RR   R!   R   R   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _moveOb  s    	 c         C   s   d  S(   N(    (   Rm   R!   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _verifyObjectPaste  s    c         C   s   y t  |  t j o* t | d  } | i |  | i   nZ d } t | d  } | i |  } x( | o  | i |  | i |  } qg W| i   WnH t j
 o< } | d t i j o d t	   i
 d d   q   n Xd  S(   NR   i   i   i    R   s@   Sorry, you do not have permission to write to this directory.<p>i    (   R6   R   R   R   R   RP   R  R   R   R   R   (   Rm   RS   RG   t   outfilet	   blocksizeR"   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   _write_file  s&     t   manage_workspacec      
   C   s
  t  i i |  } t d   |  } t t  i i |  } t  i i |  i |  } t  i i |  o% | o t d d d d d |  Sn~ y t  i	 |  WnH t
 j
 o< } | d t i j o d t   i d d	   q   n X| o t d d
 d d d |  Sd S(   s2   Create a new directory relative to this directory.c         S   s
   |  d j S(   R^   s   ..(   R^   s   ..(    (   t   p(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   <lambda>  s    t   titlet   OKt   messages   The directory already exists.R   i    R   s@   Sorry, you do not have permission to write to this directory.<p>s   Success!s   The directory has been created.N(   RF   RG   R)   R   R   R8   R   R   R   t   makedirsR  R   R   R   R   (   Rm   RG   R   R   t   partst   fullpathR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_createDirectory  s.       R'   c         C   s  t  | d  o | i } n
 | i } | p d | j o | t i | d  d } q d | j o | t i | d  d } q d | j o | t i | d  d } q | } n y |  i | d  Wn( d t d d d	 t i d
 d   n X|  i	 |  } t
 i i |  o |  i | | |  n |  i | |  | oI | d j o | d i |  i   d  qt d d d	 d d
 |  Sn d S(   s}   Upload a file to the local file system. The 'file' parameter
        is a FileUpload instance representing the uploaded file.t   filenamet   /i   s   \t   :s   Upload ErrorR  s
   Invalid IdR  R   R   t   index_fst   RESPONSEsC   /index_fs?portal_status_message=Your%20file%20has%20been%20uploadeds   Success!s   Your file has been uploaded.N(   R   R  R   R   t   rfindR   R   t   syst	   exc_valueR   RF   RG   R   t   manage_overwriteR  t   redirectt   absolute_url(   Rm   RS   RR   R   R   R  RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRu     s:    	
  		 c      
   C   s   | d j o1 t |  d  o! y |  i d  } Wq> q> Xn y | d } Wn d } n X| d j p | i d |   o d t   i d d   n |  i | |  d S(   s   Overwrite a local file.t
   aq_acquireR   t   AUTHENTICATED_USERs   Overwrite local filest   Unauthorizeds4   Sorry, you are not authorized to overwrite files.<p>N(   R   R   R!  t   has_permissionR   R   R  (   Rm   RS   RG   R   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s        
!c   	      C   s  y |  i  |  Wn( d t d d d t i d d   n X|  i |  } |  i |  } y t i | |  Wn t j
 ou } | d t i	 j oU t i
 i |  o
 d } n d	 } d } d
 | | f } | t   i | |   q   n X| d j	 o |  i |  | d d Sd S(   s   Rename a file or subdirectory.s   Rename ErrorR  s
   Invalid IdR  R   R   i    R;   RS   sD   Sorry, you do not have permission to rename the requested %s ('%s').t   update_menui   N(   R   R   R  R  R   RF   R  R  R   R   RG   R   R   R   R   R   (	   Rm   RR   t   new_idR   R]   R1   R   R0   R.   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_renameObject  s.      		  
c   	   	   C   s   t  |  t  d  j o | g } n g  } x9 | D]1 } |  i |  } t |  } | i | i  q3 Wd | f } t |  } | d	 j	 o? | d } | i d | d d | d |  i |  | d d S| S(
   sa   Put a reference to the objects named in ids in the clipboard,
        marked for a cut operation.R'   i   R  t   __lcpRG   s   %st   SCRIPT_NAMEt   cb_dataValidN(	   R6   R   t   FileMonikerR7   R   R	   R   t	   setCookieR   (	   Rm   R   R   t   oblistRR   R!   R.   t   cpt   resp(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_cutObjects/  s     
c   
   	   C   s   t  |  t  d  j o | g } n g  } x9 | D]1 } |  i |  } t |  } | i | i  q3 Wd | f } t |  } | d
 j	 o? | d }	 |	 i d | d d | d |  i |  | d d	 S| S(   sb   Put a reference to the objects named in ids in the clipboard,
        marked for a copy operation.R'   i    R  R(  RG   s   %sR)  R*  i   N(	   R6   R   R+  R7   R   R	   R   R,  R   (
   Rm   R   R   R  R-  RR   R!   R.   R.  R/  (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_copyObjectsA  s     
c   
      C   s:  d } | d j	 o
 | } n& | o | i d  o | d } n | d j o t t  n y t |  } Wn t t  n Xg  } t   } | d } xh | d D]\ } | | _ y | i |  i	 p |   } Wn t t
  n X|  i | |  | i |  q W| d j og x6 | D]. } |  i t | i   }	 |  i |	 |  qW| d j	 o |  i |  | d d d d Sn | d j o xY | D]Q } t | i  }	 t |  |  p t d  n |  i |	  }	 |  i |	 |  qW| d j	 oE | d i d d	 d
 d | d d d |  i |  | d d d d Sn d S(   s   Paste objects from the clipboard into the current directory.
        The cb_copy_data parameter, if specified, should be the result 
        of a previous call to manage_cutObjects or manage_copyObjects.R(  i    i   R%  R*  s(   This object cannot be pasted into itselfR  t   cp_t   deletedRG   s   %sR)  t   expiress   Wed, 31-Dec-97 23:59:59 GMTR'   N(   R   t   has_keyR   R   R
   R   R+  R   t   bindR   R   R  R7   t   _get_idR   RR   R  R   R   R  R,  (
   Rm   t   cb_copy_dataR   R.  R-  R.   t   opR   R!   RR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_pasteObjectsS  s\    
  	
 	    c         C   s&   y t  |  i d  } Wn d SXd S(   s*   Return true if clipboard data seems valid.R(  i    i   (   R
   R   (   Rm   R.  (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR*    s
      c         C   s   t  |  t  d  j o | g } n | p t d d d d d d  Sxa | oY | d } |  i |  } t i i |  p d	 d
 | d  n |  i |  | d =qJ W| d j	 o |  i |  | d d Sd S(   s   Delete files or subdirectories.R'   R  s   No items specifiedR  s   No items were specified!R   R   it
   BadRequests   %s does not existR%  i   N(	   R6   R   R   RF   RG   R   R   R   R   (   Rm   R   R   RR   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_delObjects  s       
c         C   s'   | d j o |  i } n |  i |  S(   s{   Return a list of subobject ids.
        If 'spec' is specified, return only objects whose filename 
        matches 'spec'.N(   R   R   R   (   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   fileIds  s    c      	   C   s  | d j o |  i } n g  } | i } |  i } | o1 xX |  i |  D] } | | | |   qI Wn+ x' |  i |  D] } | | |   qz Wg  } x= | D]5 } d | i d j | i f }	 | i |	 | f  q W| i   g  }
 | D] } |
 | d q ~
 S(   s   Return a list of Local File objects.
        If 'spec' is specified, return only objects whose filename 
        matches 'spec'.s   %s%sR;   i   N(   R   R   R7   R   R   R6   RR   R5   (   Rm   R   t	   propagatet   rR   t   gRR   t   resR:   R   t   _[1]t   x(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt
   fileValues  s&    		     
c         C   s   | d j o |  i } n g  } | i } |  i } | o7 xd |  i |  D] } | | | | |  f  qI Wn1 x- |  i |  D] } | | | |  f  q W| S(   s   Return a list of (id, fileobject) tuples.
        If 'spec' is specified, return only objects whose filename 
        matches 'spec'
        N(   R   R   R7   R   R   (   Rm   R   R>  R?  R   R@  RR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt	   fileItems  s    		  !  c         C   s   |  i  o |  i |  Sd S(   s   Return a list of subobject ids.

        Returns a list of subobject ids of the current object.  If 'spec' is
        specified, returns objects whose meta_type matches 'spec'.
        (    (   R   t
   _objectIds(   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt	   objectIds  s    
c         C   s   |  i  o |  i |  Sd S(   s   Return a list of the actual subobjects.

        Returns a list of actual subobjects of the current object.  If
        'spec' is specified, returns only objects whose meta_type match 'spec'
        (    (   R   t   _objectValues(   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   objectValues  s    
c         C   s   |  i  o |  i |  Sd S(   s   Return a list of (id, subobject) tuples.

        Returns a list of (id, subobject) tuples of the current object.
        If 'spec' is specified, returns only objects whose meta_type match
        'spec'
        (    (   R   t   _objectItems(   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   objectItems  s    
c         C   s   |  i  } |  i   } | d  j	 ox t |  t d  j o | g } n g  } | i } x; | D]3 } | |  } | i | j o | i |  q^ q^ W| S| S(   NR   (   R   R   R   R6   R7   R   (   Rm   R   R@  R   R?  R   RR   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRF    s    		 c         C   s   g  } | i  } |  i } | d  j	 oq t |  t d  j o | g } n xo |  i   D]6 } | |  } | i | j o | | |   qX qX Wn( x$ |  i   D] } | | |   q W| S(   NR   (   R7   R   R   R6   R   R   (   Rm   R   R?  R   R@  RR   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRH    s    		   c         C   s   g  } | i  } |  i } | d  j	 ow t |  t d  j o | g } n x{ |  i   D]< } | |  } | i | j o | | | |  f  qX qX Wn. x* |  i   D] } | | | |  f  q W| S(   NR   (   R7   R   R   R6   R   R   (   Rm   R   R?  R   R@  RR   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRJ  
  s    		 "  c      	   C   sg   g  } yS xL |  i    D]> } |  i |  } y | i o | i |  n Wq q Xq WWn n X| S(   s=   Returns a list of the folder's sub-folders, used by tree tag.(   R   R   R   R7   (   Rm   R?  RR   t   o(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   tpValues  s     
   c         C   s   t  |  i    S(   N(   R   t
   serverPath(   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   tpId%  s    c         C   su   g  } |  } xL t  | d  p Pn | i t | i   t  | d  p Pn | i } q | i   t i | d  S(   sX   Return the full path of the directory object relative to the
        root of the server.RR   R   R  (   R   R7   R   RR   R   t   reverseR   R8   (   Rm   R   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRN  '  s      
c         C   s   |  i  d } |  i  i d d  } | d j	 o t |  t d  j o d | t i |  f } q g  } x( | D]  } | i d t i |   qr W| d t i | d  } n | S(	   s'   Return the URL of the parent directory.t   URL2R   R'   s
   %s?spec=%ss   spec:list=%st   ?t   &N(	   R   R   R   R6   t   urllibt   quoteR7   R   R8   (   Rm   t   urlR   t   queryR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt	   parentURL4  s     c      	   C   s   yt t  i |  i  } x[ | D]S } |  i |  } t i i |  o+ y |  i |  SWqo d j
 o qo Xq q WWn n Xd S(   sY   Return the first default document found in this folder 
        as a Zope object or None.R   N(	   R   R)   t   default_documentR   RF   RG   R   R   R   (   Rm   t   filesRS   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   defaultDocumentB  s       c         C   s#   t  i |  i  t i } t |  S(   N(   RF   Rj   Rk   Rl   R   (   Rm   R1   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRn   Q  s    t   PUT_factoryc   	      C   s  | oI | i  d  p | i  d  o) d d k l } | | | d | } n | d j oO d d	 k l } t |  t d
  j	 o | i   } n | | d | } nf | d  d j o, d d k l } | | d
 | d | } n) d d k l	 } | | d
 | d | } | S(   sB   
        Dispatcher for PUT requests to non-existent IDs.
        s   .pts   .zpti(   R   R   s	   text/htmls   text/xmls
   text/plain(   R#   R'   RU   i   s   image/(   R%   (   RZ   (   s	   text/htmls   text/xmls
   text/plain(
   t   endswitht'   Products.PageTemplates.ZopePageTemplateR   t   OFS.DTMLDocumentR#   R6   RP   t	   OFS.ImageR%   RZ   (	   Rm   R   t   typt   bodyR   R!   R#   R%   RZ   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR\  Z  s    ' c      
   C   s   d } t  |  i    } y; t |  d  o |  i p | i d d |  i f  n Wn n Xxd | D]\ \ } } y t i | i |   } Wn d } n X| d j	 o | | | f f } qd qd Wt i
 |  S(   s   Directory listing for FTPt$   isTopLevelPrincipiaApplicationObjecti    s   ..(    N(   R~   RE  R   Rc  t   insertR   t   marshalt   loadsR   R   t   dumps(   Rm   R   t   outRZ  R9   R:   Rj   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   m  s     ! 
c         C   sM   d } |  i    i   } d } } t i | d d d | | d | | | f
  S(   s!   Psuedo stat used for FTP listingsi @  i  t   Zopei    i   iA  (   Rn   t   timeTimeRe  Rg  (   Rm   R   t   modet   mtimet   ownert   group(    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s    
N(C   RU   Rr   RO   R   R   R   t   manage_addProductR   Rb   R   R   R   t   manage_optionst   icont   AccessControlt   ClassSecurityInfot   securityt   declareProtectedR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R   R  R  R  R  R  Ru   R  R'  R0  R1  R:  R*  R<  R=  RD  RE  RG  RI  RK  RF  RH  RJ  RM  RO  RN  RX  R[  Rn   t   declarePrivateR\  R   R   (    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     sx   					"	
	
					-5	

								RE   c           B   s   e  Z d  Z d Z e i   Z e i d d d d d d  d   Z d	 d
  Z	 d   Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e Z d   Z e Z d   Z RS(   s4   Object representing a file in the local file system.s
   Local Files
   FTP accessR   R   R   t   PUTt   manage_FTPputc         C   s   | |  _  | |  _ | |  _ |  i   |  _ |  i |  |  _ |  i   |  _ |  i	   |  _
 |  i   |  _ |  i   |  _ |  i   |  _ |  i   |  _ d S(   s   LocalFile __init__N(   t   parentRR   RG   t   _getTypeR6   t   _getURLRV  t   _getPlainURLt	   plain_urlt   _getIconRq  t   _getSizet   sizet   _getTimeRl  t   _getDisplaySizet   display_sizet   _getDisplayTimet   display_mtime(   Rm   Ry  RR   RG   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s    			R'   c         C   s   |  i  d j o | St i i | |  } |  i i } t  |  t  d  j o t i | d  } n xM | D]E } t i i |  i |  } t i i |  o t i i | |  Sql Wt i i | |  S(   s/   Return true if is Directory and has default docR;   R   (	   R6   RF   RG   R8   Ry  RY  R   R)   R   (   Rm   t   targetR   t
   targetpatht   default_documentsRS   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   getDefaultDocumentPath  s     c         C   s   |  i  i |  i  S(   s2   Return a Zope object representing this local file.(   Ry  R   RR   (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR      s    c         C   s   |  i  S(   s   Return the size of the file.(   R  (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   get_size  s    c         C   s   |  i  S(   Rn   (   Rl  (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRn     s    c         C   s   t  i |  i  } |  i d j o | d j	 o| t |  t d  j o | d t  i |  Sg  } x( | D]  } | i d t  i |   qk W| d t i | d  Sn | S(   R{  R;   R'   s   ?spec=s   spec:list=%sRR  RS  N(   RT  RU  RR   R6   R   R7   R   R8   (   Rm   R   RV  RW  R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR{    s     c         C   s   t  i |  i  S(   R|  (   RT  RU  RR   (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR|    s    c         C   s   |  i  } |  i } t i i |  o d St i i |  d } t | |  i i  \ } } | o | SyK t | d  i	 t
  } t i i | | |  } t | | |  | i SWn t j
 o d SXd S(   s"   Return the content type of a file.R;   iR   s   application/octet-streamN(   RR   RG   RF   R   RH   R   Ry  R   R   RP   RQ   RV   R%   RZ   R   R   R  (   Rm   R   RG   R   R1   R2   R"   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRz    s    		  c      	   C   s   t  i |  i  } |  i i } y | | SWn t j
 o n X| t  i | d   } y | | SWn t j
 o n Xt d S(   s;   Return the path of the icon associated with this file type.R  s   generic.gif(   R   R   R6   Ry  R   R   t   findt
   _icon_base(   Rm   R   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR~    s        c         C   sH   |  i  } t i  i |  o d Sy t i |  t i SWn d SXd S(   sv   Return the size of the specified file or -1 if an error occurs.
        Return None if the path refers to a directory.iN(   RG   RF   R   R   Rj   t   ST_SIZE(   Rm   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s    	   c         C   s   |  i  } | d j o d	 S| d j o t Sd } | | j o6 | | } | | j o | | } d | Sd | Sn	 d | Sd S(
   s=   Return the size of a file or directory formatted for display.t   -i   ig      @s   %.1f MBs   %.1f kBs   %d bytesNs   -----(   R  R   t   _unknown(   Rm   R  R9   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s    	  

	c         C   s/   y! t  t i |  i  t i  SWn n Xd S(   sX   Return the last modified time of a file or directory
        or None if an error occurs.N(   R   RF   Rj   RG   Rl   (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s     ! c         C   s5   |  i  } | d j o t Sd | i   | i   f S(   sT   Return the last modified time of a file or directory formatted 
        for display.s   %s %sN(   Rl  R   R  t   Timet   Date(   Rm   R1   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s    	 c         C   sZ   |  i  | |  |  i | | d d |  i | i d d   |  i   | i d  | S(   s    Handle HTTP PUT requests t   refreshi   t   BODYR'   i   (   t	   dav__initt   dav__simpleifhandlerR   R   t   ZCacheable_invalidatet	   setStatus(   Rm   R   R  (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRw    s    
c         C   s#   |  i  i i d |  i  |  i   S(   s   Get source for FTP downloads   Content-Type(   R   R  t	   setHeaderR   RP   (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s    c         C   sy   |  i    } d	 } |  i d j o d } d
 } n |  i   i   } d } } t i | d d d | | | | | | f
  S(   s!   Psuedo stat used for FTP listingsi   i  R;   i    i @  i  Ri  i   i  iA  (   R  R6   Rn   Rj  Re  Rg  (   Rm   R   R  Rk  Rl  Rm  Rn  (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   #  s    

(   RU   Rr   RO   R   Rr  Rs  Rt  Ru  R   R  R    R  Rn   R{  R|  Rz  R~  R  R  R  R  Rw  Rx  R   t   getSizeR   (    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRE     s,   															R+  c           B   s#   e  Z d  Z d d  Z d   Z RS(   s>   A file moniker is a reference to an object in the file system.c         C   s~   | d j o d Sg  |  _ xO t | d  p Pn | i d j o Pn |  i i t | i   | i } q |  i i   d S(   s   FileMoniker __init__NRR   s   Local File System(	   R   R   R   R   R7   R   RR   R   RP  (   Rm   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   3  s     	c         C   s-   | } x  |  i  D] } | i |  } q W| S(   s,   Return the file object named by this moniker(   R   R   (   Rm   R   R!   RR   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR6  @  s
    
 N(   RU   Rr   RO   R   R   R6  (    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR+  /  s   t   LocalFSc           B   s  e  Z d  Z d Z h d d 6d d 6dL d 6h d	 d 6d
 d 6dM d 6h d d 6d d 6dN d 6h d d 6d d 6dO d 6h d d 6d d 6dP d 6f Z d	 dQ f d dR f d dS f d dT f d dU f d dV f d! dW f d# dX f d* dY f f	 Z h d, d- 6d. d/ 6d0 d1 6h d2 d- 6d. d/ 6d0 d1 6f Z e o> e h d3 d- 6d. d/ 6d0 d1 6h d4 d- 6d. d/ 6d0 d1 6f Z n e h d5 d- 6d. d/ 6d0 d1 6h d6 d- 6d7 d/ 6d0 d1 6h d8 d- 6d7 d/ 6d0 d1 6h d9 d- 6d: d/ 6d0 d1 6h d; d- 6d: d/ 6d0 d1 6h d< d- 6d. d/ 6d0 d1 6f Z d= Z d
 Z	 Z
 d> Z d> Z d? Z d> Z dZ Z d
 Z e Z e Z e e  Z e e  Z dZ Z d@   Z dZ dA  Z dB   Z dZ dC  Z dD   Z dE   Z  dF   Z! dZ dG  Z" dZ dH  Z# e$ dI  Z% dJ   Z& dK   Z' RS([   sE   Object that creates Zope objects from files in the local file system.s   Local File SystemR   R   R   R   R  s   FileSystem_Contents.stxt   helpR   R'   s   FileSystem_View.stxt
   Propertiest   manage_propertiesForms   FileSystem_Properties.stxt   Securityt   manage_accesss   FileSystem_Security.stxR   R   s   FileSystem_Upload.stxs   View Directory IndexR   s   View management screenst   manages#   Change Local File System propertiest   manage_changePropertiess   Access contents informationR=  RD  RE  s   Upload local filesRu   s   Overwrite local filesR  s   Manage local filesR0  R1  R:  t   manage_renameFormR'  R  s   Delete local filesR<  R  RR   R   R6   R   Rk  R   t   usernamet   passwordRY  t   type_mapt   linest   icon_mapR   t   booleanR   R   s   index.html default.htmli    i   c      
   C   s   t  i |  | | |  |  i |  i |  i |  i |  i 	 | |  _ | |  _ |  _	 t
 oh | |  _ | |  _ t i |  i  } | d j	 o* |  i o  | i d  |  _ |  i   q d |  _ n d S(   s   LocalDirectory __init__i   R'   N(   R   R   R   R   R   R   R   R  R   Rk   t   _iswin32R  t	   _passwordt   unc_exprt   matchR   Rn  t   _sharet   _connect(   Rm   RR   R  R   R  R  R.   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s    			c         C   s   t  S(   s,   Return if more performant StreamingFile used(   RY   (   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   IteratorsPresent  s    c   	      C   s  |  i  } |  i } |  i } t o |  i } |  i } n t i i i |  |  t	 i
 |  i  d j o d |  _ n |  i d j o d |  _ n |  i  | j o t |  i   |  _ n |  i | j o t |  i  |  _ n t o |  i | j p |  i | j ow | |  _ |  i o |  i   n t i |  i  } | d j	 o* |  i o  | i d  |  _ |  i   q{d |  _ n d |  _ n d |  _ d } |  i |  | d | d d S(   s!  Edit object properties via the web.
        The purpose of this method is to change all property values,
        even those not listed in REQUEST; otherwise checkboxes that
        get turned off will be ignored.  Use manage_changeProperties()
        instead for most situations.
        R'   R   i   s   Saved changes.t   manage_tabs_messageR%  N(   R  R  R   R  R  R  RV   t   PropertyManagert   manage_editPropertiesR   R    R   R(   R   RA   R   R  t
   _connectedt   _disconnectR  R  R   Rn  R  R  R   R  (	   Rm   R   R  R  R   R  R  R.   R  (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s:    				 	
	c         K   sC  |  i  } |  i } t o |  i } |  i } n t t i i i |  | f |  |  i  | j o t	 |  i   |  _
 n |  i | j o t |  i  |  _ n t o |  i | j p |  i | j on |  i o |  i   n t i |  i  } | d j	 o* |  i o  | i d  |  _ |  i   q/d |  _ q3n |  i |  _ d S(   s   Change existing object properties.

        Change object properties by passing either a mapping object
        of name:value pairs {'foo':6} or passing name=value parameters
        i   R'   N(   R  R  R  R  R  R   RV   R  R  R(   R   RA   R   R  R  R  R  R   R   Rn  R  R  R   R   (   Rm   R   t   kwR  R  R  R  R.   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s*    			 
c         C   s@   t  i d d |  i d |  i p d |  i p d  d |  _ d S(   R  i   N(   t	   win32wnett   WNetAddConnection2R   R  R  R  R  (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s    c         C   s#   t  i |  i d d  d |  _ d S(   R  i    N(   R  t   WNetCancelConnection2R  R  (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s    c         C   s'   |  i  o |  i o |  i   n d S(   t   _check_connectedN(   R  R  R  (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR    s    c         C   s   |  i    t i |  |  S(   R   (   R  R   R   (   Rm   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR      s    
c         C   s   |  i    t i |  | |  S(   R   (   R  R   R   (   Rm   RR   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR     s    
c         C   s   |  i    t i |  | |  S(   R   (   R  R   R   (   Rm   RR   R   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR   
  s    
c         C   s   t  i i |   S(   Rn   (   t   Persistencet
   PersistentRn   (   Rm   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyRn     s    c      	   C   s   yt t  i |  i  } x[ | D]S } |  i |  } t i i |  o+ y |  i |  SWqo d j
 o qo Xq q WWn n Xd S(   s/   Return true if is Directory and has default docR   N(	   R   R)   RY  R   RF   RG   R   R   R   (   Rm   RZ  RS   RG   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   hasDefaultDocument  s       (   s   LocalFSs   FileSystem_Contents.stx(   s   LocalFSs   FileSystem_View.stx(   s   LocalFSs   FileSystem_Properties.stx(   s   LocalFSs   FileSystem_Security.stx(   s   LocalFSs   FileSystem_Upload.stx(   R'   (   s
   index_html(   s   manages   manage_main(   s   manage_propertiesForms   manage_changeProperties(   s   fileIdss
   fileValuess	   fileItems(   s   manage_uploadForms   manage_upload(   s   manage_overwrite(   s   manage_cutObjectss   manage_copyObjectss   manage_pasteObjectss   manage_renameForms   manage_renameObjects   manage_createDirectory(   s   manage_delObjectsN((   RU   Rr   RO   R   Rp  t   __ac_permissions__t   _propertiesR  RY  R  R  R  R   R   R   R   R   R  t   _typesR   t   _iconsR   R3   R  RC   R  R   R   R  R  R  R  R  R  R   R   R   R   Rn   R  (    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyR  G  s   			   #
		(				c         C   sJ   t  | | | | |  } |  i | |  | d j	 o |  i |  |  Sd S(   sb  Add a local file system object to a folder
  
    In addition to the standard Zope object-creation arguments,
    'id' and 'title', the following arguments are defined:

        basepath -- The base path of the local files.
        username -- Username for a network share (win32 only).
        password -- Password for a network share (win32 only).
    N(   R  R   R   R   (   Rm   RR   R  R   R  R  R   R!   (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   manage_addLocalFS"  s    s   dtml/methodAdd(}   RO   t   __version__R  RF   R   R+   Rj   RT  R   R   R   t   tempfilet   Appt   Globalst   AcquisitionR  RV   Rr  t   App.ExtensionsR    t   App.FactoryDispatcherR   t   webdav.NullResourceR   t   ZPublisher.HTTPResponseR   R   R   t   zope.contenttypeR   R`  R   t   TreeDisplay.TreeTagR   t   OFS.CopySupportR	   R
   R   R   R   R   t   ZODB.TimeStampR   R   t   typesR   Re  t
   ZPublisherR   RY   R   R^  R   t   platformR  R  t   ImportErrort   compileR  RQ   R  R   R   R  R,   R(   R3   R  R  t   itemsR9   R:   RB   RA   RC   RD   RT   RW   RX   RM   R[   R\   RI   RJ   RK   Ri   R   Rw   Ry   Rx   RL   R   R   R   R   R   R   R   R   R   R   R   t   searchR   R   R   t   CopySupportt   CopyContainert
   Managementt
   Navigationt
   SimpleItemt   Itemt   ImplicitR   RE   R+  R  R  t   Rolet   RoleManagerR  R   R  Rb   t   manage_addLocalFSForm(    (    (    s%   /srv/Zope/Products/LocalFS/LocalFS.pyt   <module>(   s@  x<.

  
		

		
 									
				
					
												  		