mς ρ¦Dc@sCdZdkZdkZdkZy dkZWnej odkZnXy dkZWnej odkZnXdk l Z l Z dk l Z dklZlZd„Zd„Zdefd„ƒYZd fd „ƒYZeZd e ifd „ƒYZdd „Zdd„Zd„Zddd dddgZdS(sœSave and load Small OBjects to and from files, using various formats. API Stability: unstable Maintainer: U{Moshe Zadka} N(slogsruntime(sstyles(s implementss InterfacecCsidkl}t|ƒ|i}|o|d|i|7}n|iti|ƒi ƒd ƒi |ƒS(N(sAESt i( t Crypto.CiphertAEStciphertlentdatat block_sizetleftovertnewtmd5t passphrasetdigesttencrypt(R RRR((tm/home/radix/Projects/Twisted/branches/releases/twisted-core-2.5.x-2329-2/Twisted.exp/twisted/persisted/sob.pyt_encrypts  cCs6dkl}|iti|ƒiƒd ƒi|ƒS(N(sAESi(RRRR R R tdecryptR(R RR((R t_decrypt%s t IPersistablecBs)tZdZd„Zeeed„ZRS(s9An object which can be saved in several formats to a filecCsdS(s^Set desired format. @type style: string (one of 'pickle', 'source' or 'xml') N((tstyle((R tsetStyle.scCsdS(sxSave object to file. @type tag: string @type filename: string @type passphrase: string N((ttagtfilenameR ((R tsave4s(t__name__t __module__t__doc__RtNoneR(((R R*s  t PersistentcBsWtZeeƒdZd„Zd„Zd„Zd„Zd„Z dddd„Z RS(NtpicklecCs||_||_dS(N(toriginaltselftname(RRR((R t__init__Cs cCs ||_dS(s^Set desired format. @type style: string (one of 'pickle', 'source' or 'xml') N(RR(RR((R RGscCs‚|o|}|d}n^|o0d|i||f}d|i||f}n'd|i|f}d|i|f}||fS(Ns-2s %s-%s-2.%ss%s-%s.%ss%s-2.%ss%s.%s(Rt finalnameRRRtext(RRR"RR!((R t _getFilenameNscCsvt|dƒ}|djo||i|ƒn9tiƒ}||i|ƒ|i t ||i ƒƒƒ|i ƒdS(Ntwb(topenRtfR RtdumpFuncRRtStringIOtstwriteRtgetvaluetclose(RRR R'R&R)((R t _saveTempZs  cCsg|idjodkl}d}n7|idjodkl}d}nd„}d}||fS( Ntxml(s jellyToXMLttaxtsource(s jellyToSourcettascCsti||dƒdS(Ni(Rtdumptobjtfile(R3R4((R R'lsttap(RRttwisted.persisted.marmaladet jellyToXMLR'R"ttwisted.persisted.aott jellyToSource(RR'R"((R t _getStyleds     cCsΚ|iƒ\}}|od|}n|i|||ƒ\}}t i d|i d|dƒ|i |||ƒt idjo$tii|ƒoti|ƒnti||ƒt i dƒdS(sxSave object to file. @type tag: string @type filename: string @type passphrase: string tesSaving s application to s...twin32sSaved.N(RR:R"R'R R#RRR!tlogtmsgRR-truntimet platformTypetostpathtisfiletremovetrename(RRRR R!R"R'((R Rqs #( RRt implementsRRR RR#R-R:RR(((R R=s    t_EverythingEphemeralcBs tZdZd„Zd„ZRS(NicCs ||_dS(sS @param mainMod: The '__main__' module that this class will proxy. N(tmainModR(RRH((R R ŠscCsZyt|i|ƒSWn?tj o3|io‚qVtid|ƒti ƒSnXdS(Ns#Warning! Loading from __main__: %s( tgetattrRRHtkeytAttributeErrortinitRunR=R>tstylest Ephemeral(RRJ((R t __getattr__s (RRRLR RO(((R RG†s c Cs$d}|djodkl}n/|djodkl}ntid}}|o+t i t |t |dƒiƒƒƒ}nt ||ƒ}ttidƒ}|tid