Prv8 Shell
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4
System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64
User : jackjohn ( 502)
PHP Version : 5.3.17
Disable Function : NONE
Directory :  /usr/share/system-config-network/netconfpkg/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/system-config-network/netconfpkg/transaction.pyc
Ñò
åOÜLc@sfdZddkZddkZdZd„Zdefd„ƒYZdeefd„ƒYZd	Z	dS(
sÀ
    Transactions of attributes by inheriting the Transaction class

    Basic Usage:
    
    class Test(Transaction):
        pass
        
    a = Test()
    a.test = "old state"
    a.commit()
    a.test = "bad state, roll me back"
    a.rollback()
    assert(a.test == "old state")
    
 See also: http://www.harald-hoyer.de/linux/pythontransactionclass
 
 Copyright (C) 2008 Harald Hoyer <harald@redhat.com>
 Copyright (C) 2008 Red Hat, Inc.
iÿÿÿÿNicCs#||jotS|i|ƒtS(s"checks and sets the obj id in seen(tTruetaddtFalse(twhattseen((s:/usr/share/system-config-network/netconfpkg/transaction.pyt
_checksetseen+s

tTransactioncBs2eZdZd„Zd„Zd„Zd„ZRS(sn
    This class allows sub-classes to commit changes to an instance to a 
    history, and rollback to previous states.
        
    Because the class only stores attributes in self.__dict__ sub-classes
    need to use the methods __getstate__ and __setstate__ to provide additional
    state information. See the Transactionlist below for an example usage.    
    cKsCtitd|iiƒ|idtƒƒ}tt|ƒ|ƒodS|idt	ƒ}t
ƒ}xŸ|iiƒD]Ž\}}t
|tƒo)|||<|o|id|ƒqqt|djo|||<qt|djo|||<qtti|ƒ||<qtWt|dƒo|t|dƒƒf}n||id<dS(sÆ
        Commit the object state.
        
        If the optional argument "deep" is set to False,
        objects of class Transaction stored in this object will
        not be committed.
        sTransaction.commit() %st_commit_seenNtdeept__lt__origt__getstate__(tloggingtlogt_debuglevelt	__class__t__name__tgettsetRtidRtdictt__dict__titemst
isinstanceRtcommittcopytdeepcopythasattrtgetattr(tselftkwargsRRtstatetkeytval((s:/usr/share/system-config-network/netconfpkg/transaction.pyR;s*
	


c	Ksftitd|iiƒ|idtƒƒ}tt|ƒ|ƒodS|idt	ƒ}d}d}t}t}d|ijo@|id}t	}t
|ƒtjot	}|\}}qÃnxF|iiƒD]5}t|tƒo|o|id|ƒqqÓqÓW|o!|iiƒ|ii|ƒn|o't|dƒot|dƒ|ƒndS(sÙ
        Rollback the last committed object state.
        
        If the optional argument "deep" is set to False,
        objects of class Transaction stored in this object will
        not be rolled back.
        sTransaction.rollback() %st_rollback_seenNRR	t__setstate__(RR
RRRRRRRRtNoneRRttypettupletvaluesRRtrollbacktcleartupdateRR(	RRRRRt
extrastatetgotstatet
gotextrastatetchild((s:/usr/share/system-config-network/netconfpkg/transaction.pyR(_s4


cCsåtitd|iiƒtƒ}xƒ|iiƒD]r\}}t|t	ƒo|i
ƒ|||<q2|djo1|djo$|djoti|ƒ||<q2q2Wt
|dƒo|t|dƒƒf}n||id<dS(s#set the changed state of the objectsTransaction.setunmodified() %sR
R	tchangedRN(RR
RRRRRRRRt
setunmodifiedRRRR(RRR R!((s:/usr/share/system-config-network/netconfpkg/transaction.pyR0†s
	
'c	Cs
titd|iiƒd|ijotitdƒtS|id}t}t|ƒt	jot}|\}}nxª|D]¢}||ijotitd|ƒtS|i|||jo-titd||i|||fƒtSt
||tƒo||iƒotSqqWxn|iD]c}|djoP|djoC||jo6|i|djo"titd||ifƒtSq1W|ojt|dƒot|dƒƒ}ntitd	ƒtS||jotitd
||fƒtSntS(NsTransaction.modified() %sR
s"__orig" not in self.__dict__s%s  not in self.__dict__s%s %s != %sR	s#%s is a new key in self.__dict__=%sRs!not hasattr(self, '__getstate__')sstate: %s != %s(RR
RRRRRRR%R&RRtmodifiedR$RR(RRR-R+R ((s:/usr/share/system-config-network/netconfpkg/transaction.pyR1˜sT






		
		(Rt
__module__t__doc__RR(R0R1(((s:/usr/share/system-config-network/netconfpkg/transaction.pyR2s
	$	'	tTransactionlistcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(sÚ
    An example subclass of list, which inherits transactions.
    
    Due to the special list implementation, we need the 
    __getstate__ and __setstate__ methods.
    
    See the code for the implementation.
    cKsœt|idtƒƒƒ}tt|ƒi|tt|ƒ|ƒodS|idtƒ}|o3x0|D]$}t|t	ƒo|iƒqlqlWndS(sÆ
        Commit the object state.
        
        If the optional argument "deep" is set to False,
        objects of class Transaction stored in this object will
        not be committed.
        RNR(
RRtsuperR4RRRRRR(RRRRR!((s:/usr/share/system-config-network/netconfpkg/transaction.pyRÕs	cKsœt|idtƒƒƒ}tt|ƒi|tt|ƒ|ƒodS|idtƒ}|o3x0|D]$}t|t	ƒo|iƒqlqlWndS(sÙ
        Rollback the last committed object state.
        
        If the optional argument "deep" is set to False,
        objects of class Transaction stored in this object will
        not be rolled back.
        R"NR(
RRR5R4R(RRRRR(RRRRR!((s:/usr/share/system-config-network/netconfpkg/transaction.pyR(ìs	cCsZxD|D]<}t|tƒo&|iƒotitdƒtSqqWtt|ƒiƒS(NsList val.modified() == True(	RRR1RR
RRR5R4(RR!((s:/usr/share/system-config-network/netconfpkg/transaction.pyR1s

cCsBx,|D]$}t|tƒo|iƒqqWtt|ƒiƒS(s#set the changed state of the object(RRR0R5R4(RR!((s:/usr/share/system-config-network/netconfpkg/transaction.pyR0
s
cCsRg}xE|D]=}t|tƒo|i|ƒq
|iti|ƒƒq
W|S(sž
        return a deepcopy of all non Transaction class objects in our list, 
        and a reference for the committed Transaction objects.
        
        (RRtappendRR(RRR!((s:/usr/share/system-config-network/netconfpkg/transaction.pyRscCs|2|i|ƒdS(s5clear the list and restore all objects from the stateN(textend(RR((s:/usr/share/system-config-network/netconfpkg/transaction.pyR##s(	RR2R3RR(R1R0RR#(((s:/usr/share/system-config-network/netconfpkg/transaction.pyR4Ìs						s Harald Hoyer <harald@redhat.com>(
R3RRRRtobjectRtlistR4t
__author__(((s:/usr/share/system-config-network/netconfpkg/transaction.pyt<module>#s	š\

haha - 2025