File:  [Repository] / ExtFile / Attic / ExtFile.pyc
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Jan 24 16:53:50 2007 UTC (17 years, 5 months ago) by dwinter
Branches: MAIN
CVS tags: HEAD
Initial revision

m
Ec	@sdZdZdZdklZdklZdklZdkl	Z	dk
lZlZl
Z
lZdklZlZd	klZd
klZdklZdklZd
klZdklZdkZdkZdkZdkZdk Z dk!Z!dk"l#Z#l$Z$dk%l&Z&dk'l(Z(dk)l*Z*dk+l+Z+dZ,dZ-dk.TdZ/y
dk0Z0Wne1j
o
dZ2nXdZ2ydk3l4Z4WnGe1j
o;ydk5l4Z4Wn e1j
odk6l4Z4nXnXydk7l8Z8Wne1j
o
dZ8nXydk9l:Z:Wne1j
o
e;Z:nXei<Z=ei>Z?dZ@dZAdkBZBeBiCd ZDdkETed!eFZGd"d"d"d"d"dde;d#ZHdeeee	fd$YZIe
eId%ZJd&ZKeiLeJeKZMd'ZNd(kOlPZPd)kQlRZRe;d*ZSdkTZTd+eUfd,YZVd-fd.YZWe:e;j	od/fd0YZXndS(1s ExtFile product module sExtFile product module.
    The ExtFile-Product works like the Zope File-product, but stores 
    the uploaded file externally in a repository-direcory.s1.5.4(sCatalogAware(s
SimpleItem(sPropertyManager(s	Cacheable(sHTMLFiles
MessageDialogsInitializeClassspackage_home(sClassSecurityInfosgetSecurityManager(sPermissions(s
aq_acquire(sguess_extension(sResourceLockedError(srfc1123_date(sDateTimeN(sjoinsisfile(s
TemporaryFile(sTM(sWriteLockInterface(sIExtFiletExtFilei(t*cCst||dS(tloggingN(tinfottxtttxt2(RtmethodR((t//usr/local/testzope/Products/ExtFile/ExtFile.pytLOGOsi(sguess_content_type(sRedirecttRedirect(sIStreamIteratorsChange ExtFile/ExtImagesDownload ExtFile/ExtImages(^(copy[0-9]*_of_)+)sdtml/extFileAddtc	
Cs|o}t|dd	d	j	od|i}|tti|dti|dti|dd}|p|}t	|}nt
|||||}	|i||	|djo|i|i||n|d	j	o|i||ddSn|S(
s Add an ExtFile to a folder. tfilenamet/s\t:iR
tupdate_menuiN(tidtgetattrtfiletNoneRtmaxtstringtrfindttitletnormalize_idRtdescrtpermission_checktredirect_default_viewttempExtFiletselft
_setObjectt_getObtmanage_file_uploadtcontent_typetREQUESTtmanage_main(
RRRRRR RRR!R((Rtmanage_addExtFileps!	


cBstZdZeefZhdd<dd<dd<hdd<dd<dd<hdd	<dd<dd<hdd
<dd<dd<hdd<dd<dd<fZd
Zd
Zhdd<dd<hdd<dd<hdd<dd<fe	i
ei
dei
Z
e
ZdZeZeiedepeiednhdhdd<<dhdd<dd <dd<d!d"<<d#hd$d%<d&d'<d(d'<d)d*<d+d,<d-d.<dd<<d/hdd<<d0hdd<<dd<Zddd
d
d1Zd2Zd3Zd4Zd5Zeied6d
d
eeed7Zeied8d9Zeied:dd;Z eied<d=Z!eied>d?Z"eied@dAZ#eiedBdCZ$eiedDdEZ%eiedFdGZ&eiedHdIZ'eiedJdKZ(eiedLdMZ)eiedNdOZ*eiedPd
d
dQZ+eiedRdSZ,eie-dTdUZ.eiedVdWZ/eie-de0dXe1Z2eie3dYddedZZ4eie-de0d[e1Z5eie3d\dded]Z6eie3d^dded_Z7eie3d`edaZ8eie3dbdcZ9eidddeeidddfeidddgdhZ:ediZ;edjZ<dkZ=dlZ>dmZ?dnZ@doZAdpZBdqZCeeddrZDeeddsZEd
d
dtZFd
d
duZGedvZHdwZIdxZJeiKdyedzZLeiKd{d|ZMeiKd}d~ZNeiKddZOeiKddZPdZQdZRdZSdZTdZUdZVRS(s The ExtFile-Product works like the Zope File-product, but stores 
        the uploaded file externally in a repository-direcory. RRttypeRtmodetwRttextR tuse_download_permission_checktbooleanRitlabeltEdittactionR"tViewR
tUploadtmanage_uploadFormiRtManagert_dummytimagetdefaultsdefault.gifthtmlshtml.giftxmlsxml.giftpythonspy.giftapplicationtpdfspdf.giftzipszip.gifttartmswordsdoc.giftexcelsxls.gift
powerpointsppt.giftvideotaudiocCsL||_||_||_||_||_t|_g|_d|_	dS(s& Initialize a new instance of ExtFile R
N(
RRRRRR(Rt__version__RR (RRRRRR((Rt__init__s							cCs
|iS(N(Rt
index_html(R((Rt__str__scCsdS(Ni((R((Rt__len__scCs
|idd}|dj	oti|dd}ytt|i}Wn
d}nX|dj	o|iot|i}n
td}|djo]||joPt
|i}|iid||iid|i|iiddSqq	ndS(	s HTTP If-Modified-Since header handling: return True if
            we can handle this request by returning a 304 response.
        sIf-Modified-Sincet;is
Last-ModifiedsContent-Typei0iN(R!t
get_headerRtheaderRtsplittlongtDateTimettimeTimet	mod_sinceRt_p_mtimetlast_modtrfc1123_datetRESPONSEt	setHeaderR t	setStatus(RR!RNRLRG((Rt"_if_modified_since_request_handlers$



cCsh|ioZ|ioI|oA|id|}||ijo|i	i
|dSq`qdndS(s redirect_default_view property handling: return True if
            we can handle this request by returning a 302 response.
            Patch provided by Oliver Bleutgen.
        tpreviewiN(RRtstatic_modeticont_static_urlRTt
static_urltabsolute_urlR!RPtredirect(RRVRTR!RX((Rt&_redirect_default_view_request_handlers
RBcCs|dj	oG|i|o|iddSn|i|||odSqTn|i||\}
}
}}|i|
}
tdjo$t
ttd|
|
||fnd}|
o;yti|
d}	WqX|d|i|
fqXXn_tttdd}
yti|
d}	Wn|d|i|
fnXd	}
d}|d
jo|dj	o|dj	ot}ydkl}|i|
}|i djo|i!d}n|i"}t$|d
o
|i%}n|i&t'|t'|f|}|i(|dddWnt|
d}qX|i)d
d|i*}	|i)d
d}
nt|
d}d}z|dj	ot,|i-}|i/i0d||i/i0d|
|i/i0d|	|idt1dj	od
}t2|Sndd>}x<|i4|}|i/i6|t7||joPqqWdSn|i4SWd|o|i8nXdS(s3 Return the file with it's corresponding MIME-type R
isserving %s, %s, %s, %ssCan't read: is%s (%s)ticonss
broken.gifs	image/gifi(sImagetRGBt	ANTIALIAStJPEGtqualityiUtrbis
image/jpegs
Last-ModifiedsContent-TypesContent-LengthiN(9R!RRRStZCacheable_setR[RVRTt_get_file_to_serveRR t_get_fsnamet_debugRt_SUBSYStINFOt
cant_read_exctoststattsizeRtjointpackage_hometglobalstwidththeightt
TemporaryFiletdatatPILtImagetopentimR%tconverttBICUBICtfilterthasattrR^tresizetinttsavetseekttellt
close_dataRORMRNRPRQtIStreamIteratortstream_iteratort	blocksizetreadtbuffertwritetlentclose(RRVRTRoRpR!RRRvRkRRhRR RrRtRyRN((RRBs


$'	
	
$






tview_image_or_filecCst|idS(s8 The default view of the contents of the File or Image. N(R	RRY(R((RROstlinkcKsz|djo|i}nd|i}x6|iD](}|i|}d|||f}q:Wd||f}|S(s$ Return a HTML link tag to the file R
s<a href="%s"s
%s %s="%s"s	%s>%s</a>N(
R'Rttitle_or_idRWtstrgtargstkeystkeytgettvalue(RR'RRRR((RRTs

ticon_gifcCst|idddS(s) Return an icon for the file's MIME-Type RViN(R	RRW(R((RR_sticon_tagcCsd|iddS(s( Generate the HTML IMG tag for the icon s<img src="%s" border="0" />RViN(RRW(R((RRdst	icon_htmlcCs
|iS(s Same as icon_tag N(RR(R((RRist	is_brokencCs|i|iS(s@ Check if external file exists and return true (1) or false (0) N(RRdR(R((RRnstget_sizecCs2|i|i}|oti|dSndS(s' Returns the size of the file or image iiN(RRdRtfnRiRj(RR((RRss
trawsizecCs
|iS(s Same as get_size N(RR(R((RR{stgetSizecCs
|iS(s Same as get_size N(RR(R((RRsRkcCs|i|iS(s: Returns a formatted stringified version of the file size N(Rt
_bytetostringR(R((RRkstgetContentTypecCs|iS(s: Returns the content type (MIME type) of a file or image. N(RR (R((RRstgetIconPathcCsyti|id\}}WnHtj
o<t|dddj	od	\}}qjd
\}}nX|i	i
|or|i	|d}xJ|i	|iD]5}ti||djo|i	||}PqqWtd||Sntd|i	dS(s Depending on the MIME Type of the file/image an icon
            can be displayed. This function determines which
            image in the lib/python/Products/ExtFile/icons/...
            directory shold be used as icon for this file/image
        Rthas_previewR2R
R3iR\N(simageR
(R
R
(RRHRR tcattsubt
ValueErrorRRt_typesthas_keyRRtitemtfindRl(RRRRR((RRs 	RXcCs|i||S(s$ Returns the static url of the file N(RRWRVRT(RRVRT((RRXsRUcCstiiddj	S(s% Returns true if serving static urls tEXTFILE_STATIC_PATHN(RitenvironRR(R((RRUstget_filenamecCs|i|iS(si Returns the filename as file system path. 
            Used by the ZMI to display the filename.
        N(Rt_fsnameR(R((RRstPrincipiaSearchSourcecCs%|iidot|SndS(s, Allow file objects to be searched.
        stext/R
N(RR t
startswithtstr(R((RRssdtml/extFileEdittmanage_editExtFilecCsy|i|jo
||_n|i|jo
||_n|i|i|dj	o|i||ddSndS(s Manage the edited values tmanage_tabs_messagesSaved changes.N(RRRtreindex_objecttZCacheable_invalidateR!RR"(RRRR!((RRs




sdtml/extFileUploadt
manage_uploadcCsp|io
tdnt|tijo't}|i	||i
dn|}|i|||S(s/ Upload file from file handle or string buffer sFile is locked via WebDAViN(Rtwl_isLockedtResourceLockedErrorR$Rttypest
StringTypeRqt	temp_fileRR~RR R!(RRR R!R((RRs

	
RcCs6|io
tdnt|tijo0d}yt|d}Wq`||q`Xn|ot
||}n|i||id|i
|i	|_	|id|iz/|i|i}|i||i|Wd|iX||_|i|dj	o|i||ddSndS(	s1 Upload file from file handle or local directory sFile is locked via WebDAVsCan't open: RaidiNRsUpload complete.(RRRR$RRRRhRuR t
HTTPUploadt_get_content_typeRRR~t	_registert_get_ufnRtnew_fnt_update_datat_temp_fsnamet_dir__unlockt_afterUpdateR!RR"(RRR R!RRh((RRs0



	

tmanage_http_uploadcCs |io
tdnti|d}d}yti|}Wn||nXt	|}|i
||id|i|i
|_
|id|iz/|i|i}|i||i|Wd|iX||_|i|dj	o|i||ddSndS(	s Upload file from http-server sFile is locked via WebDAVs/:sCan't open: idiNRsUpload complete.(RRRturllibtquoteturlRhturlopenRRRRRR R~RRRRRRRRR!RR"(RRR!RRRh((RRs.




	

tPUTcCsA|i|||i||dd|d}|idd}|ot	||}n|i
||id|i|i|_|i
d|izry|iWn)tj
o|i|id}nXd}|i|id|}|i||i|Wd|iX||_|i|id	|S(
s Handle HTTP PUT requests trefreshitBODYFILEscontent-typeiditpathNi(Rt	dav__initR!RPtdav__simpleifhandlerRRFRR RRRRR~Rt	aq_parenttAttributeErrort_get_zodb_pathtPARENTSRRRRRRRRRR(RR!RPRR RR((RRs2


	

s
FTP accesstmanage_FTPstattmanage_FTPlistt
manage_FTPgetcCs|id|iS(s Return body for FTP R!N(RRBR!(R((RR:scCs|djo&t|dddj	o
|i}nt|ddo2|djptiit|odSndSdS(s3 Check if the user is allowed to download the file R!R(iiN(R!RRRtgetSecurityManagertgetUserthas_permissiontDownloadPermission(RR!((Rt_access_permittedBs&
=cCst|dd}|o|ido|d}nKt|tdj	o
|i}nt	t|d|||\}}|id}|djo|| Sn|S(s Determine the mime-type theadersscontent-typeR
RREiN(RRRRRR R$tbodyRrtguess_content_typeRtencRtcutoff(RRRRR RRR((RROs

cCst|tijo|i|}nt|tijo|i|}ny|i||WnBt|o+yt	i
|Wqtj
oqXnnX|idS(s Store infile to outfile N(
R$tinfileRtListTypeRRtoutfilet_copytisfileRitremovetOSErrorthttp__refreshEtag(RRR((RR]s
	c
Cst|tijoIyt|d}Wn)tj
otd|i|fnXd}n
|}d}t|tijo|tit
}y*t|d}ti||iWn6tj
o*ti|td|i|fnXd}n
|}d}yadd>}	|i|	}|i|x4t||	jo |i|	}|i|q5WWn)tj
otd|itfnXy|idWnnX|o|in|o|indS(	s Read binary data from infile and write it to outfile
            infile and outfile may be strings, in which case a file with that
            name is opened, or filehandles, in which case they are accessed
            directly.
        Ras%s (%s)iitwbiiN(R$RRRRutinstreamtIOErrorRRtclose_inRRitumasktREPOSITORY_UMASKt	outstreamRt	close_outRRtblockRRRR~R(
RRRRRRRRRR((RRmsN





cCsc|i|i}t|o?t|do.|iti|d|i|indS(s- Restore filename after delete or copy-paste s.undoN(	RRRRRRRitrenameR(RR((Rt_undos

cCsktg}|i|it|tijo|i|n|djo|i	|nt
t|S(sr Generates the full filesystem name, incuding directories from 
            self._repository and filename
        R
N(t
INSTANCE_HOMERtextendRt_repositoryR$RRRtappendtapplyRl(RRR((RRs	
cCsd|i|S(s: Generates the full filesystem name of the temporary file s%s.tmpN(RRR(RR((RRscCsk|i|}t|o|Sn|i|}t|o|Sn|it|o|SndS(s Returns the full filesystem name, preferring tmp over main. 
            Also attempts to undo. Returns None if the file is broken.
        N(RRRttmp_fnRRRR(RRRR((RRds



cCs
|i|S(s Deprecated, use _get_fsname N(RRdR(RR((Rt
_get_filenamescCsttjp
|gjo"|id|d|d|}n|}|o|i	|}ttjo2yti||dWqt
j
oqXqyti|d|Wqt
j
oqXn|S(sp If no unique filename has been generated, generate one
            otherwise, return the existing one.
        RR tlocks.undoN(tUNDO_POLICYt
ALWAYS_BACKUPRRt_get_new_ufnRR RRRtold_fnRiRR(RRRR RRR((RRs "
		cCsa|i}to=ti|}|dj	o|t|id}qMnti	|d}|do|| }||}
n
|}d}
|p
|i
}ntttfjot|}|dj	o|d jo
d}n|d!jo
d}n|d"jo
d
}n|djo|
p%ttjo||
}n|}
qPqTn|dj	o
|}n
|i}g}ttjo
|}n[ttttfjottjofdit||g}ti t!i"|i#d }|i%d
d}|i%dd}n=ttjo)t|}|i&di|}n|}xt't(D]Q}t|t*t(|jo|i+t*dqf|i+|t* |t*}qfWn0tt,jo"t-|t.}
|
||}nt0t1jo+g}|D]}||i4q~}n|i5|}t7ii8|pWd}t7i:t;}	yt7i<|t7i:|	Wqt7i:|	||qXnt=}ti?|ddjo1ti%|dd}t@tAiBd}nd}d}ti?|ddjo
|t=nti?|ddjostE|dddj	oA|iFiGdo.tHiIiJ}ti%|d|}qti%|dd}nti?|ddjo+tiL|d}ti%|d|}nti?|ddjpti?|ddjo.ti%|d|}ti%|d|
}n|o|iN|n|o&t|ti%|dd|}nt|ti%|dd}x`tP|p"tP|dptP|do0|d}t|ti%|dd|}qW|oti%|dd|}nti%|dd}|i+||S(#s Create a new unique filename it.R
s.jpegs.jpes.jpgs.objs.exes.tiffs.tifsapplication/octet-streamiRt_t+sCan't create directory: s%tis%cs
%m%d%H%M%SsInvalid file format: s%uR!tAUTHENTICATED_USERs%ps%ns%es.%ss.undos.tmpN(s.jpegs.jpe(s.obj(s.tiff(QRRtCOPY_OF_PROTECTIONt
copy_of_retmatchRRtgroupRRtpostid_nametid_extR tREPOSITORY_EXTENSIONStMIMETYPE_APPENDtMIMETYPE_REPLACEtguess_extensiontmime_extRtrel_url_listRtdirst
REPOSITORYt	SYNC_ZODBtSLICEDtSLICED_REVERSEtSLICED_HASHRltlistthashedtbase64tencodestringtshatnewtdigestttemptreplacetreversetrangetSLICE_DEPTHtitSLICE_WIDTHRtCUSTOMt
aq_acquiret
CUSTOM_METHODRtNORMALIZE_CASEt	NORMALIZEt_[1]tdtlowerRtdirpathRitisdirt	mkdir_excRRtmakedirstFILE_FORMATt
fileformatRR|RJtstrftimetcountertinvalid_format_excRR!RRRtgetUserNametusert
joinfieldsRt
_dir__lockRR(RRR RR)R'RR/RRRRRRRRR
RR.R%RRR,R$R	R1((RRs	
!














"




+


,2&/
'
cCs#tiid}|d	j	o|i||\}}}}|od|iSqtiid}|i
i}|d	j	o-|d djod|}qd|}n|ti|d}|tidi|Sn=|od|iSn$|od|iSn|iSd	S(
s# Return the static url of the file Rs	%s?icon=1tEXTFILE_STATIC_HOSTishttps://shttp://Rs%s?preview=1N(RiRRtstatic_pathRRRcRVRTRR RYtstatic_hostR!t
SERVER_URLthostRRRl(RRVRTR6RR8R R5((RRWVs&

cCs|ip
d}n|ot|ddo
d}n|o(ttt|i}d}n0|o|i}|i}n|i	}|i
}||||fS(s/ Find out about the file we are going to serve iRis	image/gifN(
RRRTRRVRlRmRnRRR t
prev_filenametprev_content_type(RRVRTRR ((RRcrs



	
		cCsydkl}Wntj
on?Xt||o-|ididd }td|Sn|djo
|i}ntt
jo|idid}nt|i}td|S(s, Returns the ZODB path of the parent object (s
PhotoImageiRiN(tProducts.Photo.ExtPhotoImaget
PhotoImagetImportErrort
isinstanceRRYRHRRyRtparentRt	ZODB_PATHtVIRTUALRtgetPhysicalPath(RR?R<R((RRs


cCst|}|djo5|d}|djo|d}d}qTd}nd}d|}|d }|dd	jo|d }n||}|S(sq Convert an int-value (file-size in bytes) to an String
            with the file-size in Byte, KB or MB
        iis MBs KBs Bytess%4.2fiiRN(tfloatRtbytesttypR(RRRRDRE((RRs








cCs2|i|i|i|i|i|iS(sm Called whenever the file data has been updated. 
            Invokes the manage_afterUpdate() hook.
        N(RRtmanage_afterUpdateRdRR R(R((RRs
tmanage_afterClonecCsd}y|iWntj
od|_nX|i|i}|op|iz?|p
|i
}|i||i|||_d}Wd|i
X|o|iqntid||S(s When a copy of the object is created (zope copy-paste-operation),
            this function is called by CopySupport.py. A copy of the external 
            file is created and self.filename is changed.
        iiNRG(tcall_afterUpdateRRRt_v_has_been_clonedRdRRRRRRRRRRtinheritedAttributeR(RRRRHR((RRGs&
	
tmanage_afterAddcCsQ|it|dot|d|i|ntid|||S(s This method is called, whenever _setObject in ObjectManager gets 
            called. This is the case after a normal add and if the object is a 
            result of cut-paste- or rename-operation. In the first case, the
            external files doesn't exist yet, otherwise it was renamed to .undo
            by manage_beforeDelete before and must be restored by _undo().
        RIRKN(	RRRztdelattrRGRRRJt	container(RRRM((RRKs

tmanage_beforeDeletecCs|i|i}|i|i}t|oYyti||dWnt	j
oqXyti
|Wqt	j
oqXn@t|o2yti||dWqt	j
oqXntid|||S(s` This method is called, when the object is deleted. To support 
            undo-functionality and because this happens too, when the object 
            is moved (cut-paste) or renamed, the external file is not deleted. 
            It is just renamed to filename.undo and remains in the 
            repository, until it is deleted manually.
        s.undoRNN(RRRRRRRRiRRRRRJRRM(RRRMRR((RRNs$
	
	RFcCsdS(s This method is called whenever the file data has been updated.
            May be overridden by subclasses to perform additional operations.
            The 'filename' argument contains the path as returned by get_fsname().
        N((RRR Rk((RRFst
get_fsnamecCs|i|iS(s Returns the current file system path of the file or image. 
            This path can be used to access the file even while a 
            transaction is in progress (aka Zagy's revenge :-). 
            Returns None if the file does not exist in the repository. 
        N(RRdR(R((RROscCs0t|do
tdnt||_dS(s Lock a directory t_v_dir__locksDouble lock in threadN(RzRtDirLockErrortDirLocktdirRP(RRS((RR3s
cCs2t|do|iit|dndS(s& Unlock a previously locked directory RPN(RzRRPtreleaseRL(R((RRs
cCsato!tttdti|nti|to!tttdti|ndS(Nsregistering %ss
registered %s(ReRRfRgtTMtcontainsRtregister(R((RR"s
!
cCs/d|_totttd|indS(Nisbeginning %s(Rt_v_begin_calledReRRfRgR(R((Rt_begin's	cCsd|_ti||io|i|i}tott	t
d|nt|oltott	t
d|n|i|i}yti|Wntj
onXti||qndS(s Commits the temporary file isfinishing %ss	isfile %sN(Rt_v_finish_calledRURRRRReRRfRgRRRRiRR(RRR((Rt_finish+s 	


cCsd|_ti||io|i|i}tott	t
d|nt|oJtott	t
d|nyti|Wqt
j
oqXqndS(s Deletes the temporary file isaborting %ss	isfile %sN(Rt_v_abort_calledRURRRRReRRfRgRRiR(RR((Rt_abort9s	


(sManager(Wt__name__t
__module__t__doc__tIExtFiletWriteLockInterfacet__implements__t_propertiesR(RtPropertyManagertmanage_optionst
SimpleItemt	CacheabletClassSecurityInfotsecurityt	meta_typetREPOSITORY_PATHRtsetPermissionDefaultRtZOPE28tdeclareProtectedRRARCRDRSR[tViewPermissionRRBRRRRRRRRRRkRRRXRUtAccessPermissionRRtHTMLFileRnR"tChangePermissionRR/RRRRRRRRRRRRRdRRRRWRcRRRtdeclarePrivateRGRKRNRFROR3RRRYR[R](((RRs^						L	
													

		
		*							


	

	
	
			
			sK ,;:'"()[]{}ݟtK____________AAAAAAaaaaaaCcEEEEEeeeeeIIIIiiiiNnOOOOOOooooooSssUUUUuuuuYYyyZzcCsyt|d}WnDtj
o8}yt|d}WqZtj
o
}|SqZXnX|idd}ti|t}|S(Nsutf-8siso-8859-15tignore(	tunicodeRtuidtUnicodeErrort	TypeErrortencodeRt	translatetTRANSMAP(RRzRx((RRMs(sFieldStorage(s
FileUploadcCst|to |o||id<n|Sn|hdd<}|o||d<n9t|do(|iido|id|d<ntd|d|}t|SdS(	sD Create a FileUpload instance from a file handle (and content_type) scontent-typetREQUEST_METHODtPOSTtCONTENT_TYPERtfpRN(
R>Rt
FileUploadR RRRzRtFieldStoragetfs(RR RR((RR`s#RQcBstZRS(N(R^R_(((RRQssRRcBsMtZdZdZdZdZdZdZdZdZ	dZ
RS(	s% Manage the lockfile for a directory s@@@lockf1.5i
cCs-t|id}|id|idS(Ntwts3ExtFile dir lock. You may want to remove this file.(RuRt_locktfRR(RR((Rt_mklock}s
cCsti|idS(N(RiRRR(R((Rt_rmlockscCstii|idS(N(RiRRRR(R((RtislockedscCs|idS(N(RR(R((RRTscCstii||i|_xt|iD]I}|i
o+ttt
d|iti|iq+|iPq+Wttt
d|itd|idS(NsWaiting for lock '%s'sFailed to get lock '%s'(RiRRlRSRt	lock_nameRRtsleep_timesRRRRftBLATHERttimetsleept
sleep_secsRRQ(RRSR((RRAs

(R^R_R`RRRRRRRTRA(((RRRvs				RcBs<tZefZdd>dZdZdZdZRS(NiicCs||_||_dS(N(tstreamRt_streamRt
_blocksize(RRR((RRAs	cCs@|ii|i}|p |iid|_tn|S(N(RRRRRrRRt
StopIteration(RRr((Rtnexts
	
cCsH|ii}|iidd|ii}|ii|d|S(Nii(RRRtcur_posR~Rk(RRRk((RRDs
cCs|iodpdS(Nii(RRD(R((Rt__nonzero__s(R^R_RRcRARRDR(((RRs
			(YR`R@t&Products.ZCatalog.CatalogPathAwarenesstCatalogAwaretOFS.SimpleItemRgtOFS.PropertyManagerRet	OFS.CacheRhtGlobalsRrt
MessageDialogtInitializeClassRmt
AccessControlRiRtPermissionstAcquisitionR t	mimetypesRtwebdav.LockableRt
webdav.commonRORJRRiRRRRtos.pathRlRttempfileRqtProducts.ExtFileRUtwebdav.WriteLockInterfaceRbRaRfReRRtZope2R=Rntzope.contenttypeRtzope.app.content_typestOFS.content_typestzExceptionsR	tZPublisher.IteratorsRRtviewRptview_management_screensRqRsRtretcompileRtConfigRntmanage_addExtFileFormR#Rt	bad_charst
good_charst	maketransR}RtcgiRtZPublisher.HTTPRequestRRRRRQRRR(:R	RRhRpRRR RJRRRbRRsRReR#RRRfRRRURqRR@RrR`RRRRRRRRiRRgR}RqRORRRRlRRRRRnRRQReRaRRRiRRmR((Rt?s*









6



	
			!
	

	$


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>