ó FRTc@sŽddlmZddlmZddlmZddlZdefd„ƒYZdefd„ƒYZ dd „Z d efd „ƒYZ dS( iÿÿÿÿ(tuser(tkey(thandlerNtCompleteMultiPartUploadcBs5eZdZdd„Zd„Zd„Zd„ZRS(sÙ Represents a completed MultiPart Upload. Contains the following useful attributes: * location - The URI of the completed upload * bucket_name - The name of the bucket in which the upload is contained * key_name - The name of the new, completed key * etag - The MD5 hash of the completed, combined upload * version_id - The version_id of the completed upload * encrypted - The value of the encryption header cCsC||_d|_d|_d|_d|_d|_d|_dS(N(tbuckettNonetlocationt bucket_nametkey_nametetagt version_idt encrypted(tselfR((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt__init__-s      cCsd|j|jfS(Ns (RR(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt__repr__6s cCsdS(N(R(R tnametattrst connection((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt startElement:scCst|dkr||_nX|dkr0||_n@|dkrH||_n(|dkr`||_nt|||ƒdS(NtLocationtBuckettKeytETag(RRRR tsetattr(R RtvalueR((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt endElement=s        N(t__name__t __module__t__doc__RR RRR(((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyRs    tPartcBs5eZdZdd„Zd„Zd„Zd„ZRS(s Represents a single part in a MultiPart upload. Attributes include: * part_number - The integer part number * last_modified - The last modified date of this part * etag - The MD5 hash of this part * size - The size, in bytes, of this part cCs1||_d|_d|_d|_d|_dS(N(RRt part_numbert last_modifiedR tsize(R R((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR Us     cCs%t|jtƒrd|jSdSdS(Ns s s (t isinstanceRtintR(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR\s cCsdS(N(R(R RRR((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyRbscCs€|dkrt|ƒ|_n^|dkr6||_nF|dkrN||_n.|dkrlt|ƒ|_nt|||ƒdS(Nt PartNumbert LastModifiedRtSize(R"RRR R R(R RRR((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyRes      N(RRRRR RRR(((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyRJs     ccsWt}d}xD|rR|jd|ƒ}x|D] }|Vq.W|j}|j}qWdS(sG A generator function for listing parts of a multipart upload. N(tTrueRt get_all_partstnext_part_number_markert is_truncated(tmpuploadtpart_number_markert more_resultstparttparts((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt part_listerrs    tMultiPartUploadcBs›eZdZd d„Zd„Zd„Zd„Zd„Zd„Z d d d d„Z d e d dd d d „Z d d d d d „Z d „Zd „ZRS(s2 Represents a MultiPart Upload operation. cCsy||_d|_d|_t|_d|_d|_d|_d|_d|_ d|_ d|_ t |_ d|_dS(N(RRRRtidt initiatortownert storage_classt initiatedR+R(t max_partstFalseR)t_parts(R R((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR …s            cCs d|jS(Ns(R(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR”scCs t|ƒS(N(R/(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt__iter__—scCs[d}xD|D]<}|d7}|d|j7}|d|j7}|d7}q W|d7}|S(Ns s s %d s %s s s(RR (R tsR-((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pytto_xmlšs   cCs}|dkr%tj|ƒ|_|jS|dkrJtj|ƒ|_|jS|dkryt|jƒ}|jj|ƒ|SdS(Nt InitiatortOwnerR( RtUserR2R3RRR8tappendR(R RRRR-((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR¤s   cCs |dkr||_nî|dkr0||_nÖ|dkrH||_n¾|dkr`||_n¦|dkrx||_nŽ|dkr||_nv|dkr®t|ƒ|_nX|dkrÞ|d krÒt|_ qt |_ n(|d krö||_ nt |||ƒdS( NRRtUploadIdt StorageClasstPartNumberMarkertNextPartNumberMarkertMaxPartst IsTruncatedttruet Initiated( RRR1R4R+R(R"R6R&R)R7R5R(R RRR((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR±s*                   cCsÐg|_d|j}|r-|d|7}n|rD|d|7}n|r[|d|7}n|jjjd|jj|jd|ƒ}|jƒ}|jdkrÌt j ||ƒ}t j j ||ƒ|jSdS( s@ Return the uploaded parts of this MultiPart Upload. This is a lower-level method that requires you to manually page through results. To simplify this process, you can just use the object itself as an iterator and it will automatically handle all of the paging with S3. s uploadId=%ss &max-parts=%ds&part-number-marker=%ss&encoding-type=%stGETt query_argsiÈN(R8R1RRt make_requestRRtreadtstatusRt XmlHandlertxmltsaxt parseString(R R6R+t encoding_typeRItresponsetbodyth((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR'Ês     i c Cs„|dkrtdƒ‚nd|j|f} |jj|jƒ} | j|d|d|d|d|d|d td | d |ƒ| S( s_ Upload another part of this MultiPart Upload. .. note:: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage. :type fp: file :param fp: The file object you want to upload. :type part_num: int :param part_num: The number of this part. The other parameters are exactly as defined for the :class:`boto.s3.key.Key` set_contents_from_file method. :rtype: :class:`boto.s3.key.Key` or subclass :returns: The uploaded part containing the etag. is&Part numbers must be greater than zerosuploadId=%s&partNumber=%dtheaderstreplacetcbtnum_cbtmd5treduced_redundancyRIR (t ValueErrorR1Rtnew_keyRtset_contents_from_fileR7( R tfptpart_numRURVRWRXRYR RIR((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pytupload_part_from_fileäs  c CsÇ|dkrtdƒ‚nd|j|f}|d k r–|d k r–d||f} |jjj} |d krzi}n |jƒ}| || j/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pytcopy_part_from_keys     cCs(|jƒ}|jj|j|j|ƒS(s. Complete the MultiPart Upload operation. This method should be called when all parts of the file have been successfully uploaded to S3. :rtype: :class:`boto.s3.multipart.CompletedMultiPartUpload` :returns: An object representing the completed upload. (R;Rtcomplete_multipart_uploadRR1(R RN((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pytcomplete_upload4s cCs|jj|j|jƒdS(sŸ Cancels a MultiPart Upload operation. The storage consumed by any previously uploaded parts will be freed. However, if any part uploads are currently in progress, those part uploads might or might not succeed. As a result, it might be necessary to abort a given multipart upload multiple times in order to completely free all storage consumed by all parts. N(Rtcancel_multipart_uploadRR1(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyt cancel_uploadAs N(RRRRR RR9R;RRR'R&R`RkRmRo(((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyR0€s     #  + ( tboto.s3RRtbotoRtxml.saxRNtobjectRRRR/R0(((s>/opt/freeware/lib/python2.7/site-packages/boto/s3/multipart.pyts +(