mς χ»rCc@s΄dZdkZdkZdkZy dkZWnej odkZnXdklZydk l Z Wndk l Z e Z nXhZ d„Zd„Zeieieeƒd„Zd„Zeieieeƒd „Zd „Zeed ƒoeieieeƒnd „Zd „Zeedƒoeieieeƒndfd„ƒYZhahad„Zd„Z dkl!Z!d„Z"dfd„ƒYZ#dS(s( Different styles of persisted objects. N(slog(sinstancemethod(sPyMethodcCst|ii|i|iffS(s3support function for copy_reg to pickle method refsN(tunpickleMethodtmethodtim_funct__name__tim_selftim_class(R((tp/home/radix/Projects/Twisted/branches/releases/twisted-core-2.5.x-2329-2/Twisted.exp/twisted/persisted/styles.pyt pickleMethod#scCsΫyAt||ƒ}|djo|Snt|i||ƒ}|SWn“t j o‡t i d|d|ƒ|dj p t d‚t|i |ƒ}t i d|ƒ|djo|Snt|i||i ƒ}|SnXdS(s5support function for copy_reg to unpickle method refstMethods not on classs'No recourse: no instance to guess from.sAttempting fixup withN(tgetattrRtim_nametunboundRtNonetinstancemethodRtboundtAttributeErrortlogtmsgtAssertionErrort __class__(R RRR R((RR)s(      cCst|iffS(s3support function for copy_reg to pickle module refsN(tunpickleModuletmoduleR(R((Rt pickleModuleHscCsOti|ƒo,tid|ƒt|}ti|ƒnt|hhdƒS(s5support function for copy_reg to unpickle module refssModule has moved: %stxN(t oldModulesthas_keytnameRRt __import__(R((RRLs  cCst|iƒ|iƒffS(s<support function for copy_reg to pickle StringIO.OutputTypesN(tunpickleStringOtstringotgetvaluettell(R((Rt pickleStringOYscCs*tiƒ}|i|ƒ|i|ƒ|S(N(tStringIORtwritetvaltseektsek(R#R%R((RR]s   t OutputTypecCst|iƒ|iƒffS(N(tunpickleStringItstringiRR(R(((Rt pickleStringIhscCs ti|ƒ}|i|ƒ|S(N(R!R#RR$R%(R#R%R((RR'ks t InputTypet EphemeralcBs tZdZd„Zd„ZRS(sh This type of object is never persisted; if possible, even references to it are eliminated. cCsLtid|ƒdk}x+|i|ƒD]}tid|fƒq*WdS(Ns!WARNING: serializing ephemeral %ss referred to by %s(RRtselftgct get_referrerstrR (R,R/R-((Rt __getstate__|s  cCs!tid|iƒt|_dS(Ns#WARNING: unserializing ephemeral %s(RRR,RR+(R,tstate((Rt __setstate__ƒs(Rt __module__t__doc__R0R2(((RR+vs  cCs1xtiƒD]}t|ƒq WhahadS(N(tversionedsToUpgradetvaluest versionedtrequireUpgradetupgraded(R7((Rt doUpgrade‹s  cCsFt|ƒ}|tjo)|tjodt|<|iƒ|SndS(sDRequire that a Versioned instance be upgraded completely first. iN(tidtobjtobjIDR5R9tversionUpgrade(R<R=((RR8’s    (sreflectcCsRg}xEti|tƒD]1}||jo|tj o|i|ƒqqW|S(N(tltreflectt allYourBasetct Versionedtbtappend(RBRDR?((Rt_aybabtus RCcBs8tZdZdZfZd„Zed„Zd„ZRS(s² This type of object is persisted with versioning information. I have a single class attribute, the int persistenceVersion. After I am unserialized (and styles.doUpgrade() is called), self.upgradeToVersionX() will be called for each version upgrade I must undergo. For example, if I serialize an instance of a Foo(Versioned) at version 4 and then unserialize it when the code is at version 9, the calls:: self.upgradeToVersion5() self.upgradeToVersion6() self.upgradeToVersion7() self.upgradeToVersion8() self.upgradeToVersion9() will be made. If any of these methods are undefined, a warning message will be printed. icCs|tt|ƒ<||_dS(N(R,R5R;R1t__dict__(R,R1((RR2»scCsΞti|p|iƒ}t|iƒ}|iƒ|i |iƒx…|D]}}|ii dƒo3x0|i D]!}|i |ƒo ||=qlqlWn|ii dƒo|i|dti|ƒΟsH   "$   8( RR3R4RIRHR2R R0R>(((RRC€s   ($R4ttypestcopy_regRJt cStringIOR!t ImportErrorttwisted.pythonRtnewR torg.python.coretPyMethodRRRtpicklet MethodTypeRRt ModuleTypeR RthasattrR&R)R'R*R+R5R9R:R8R@RFRC(R[R'R+RRRRaR:RZR)R RRR RRFRJR@RCR!R8R((Rt? sX