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/gdt.pyo
Ñò
åOÜLc@sÀdZddkZddklZlZd„Zed„ƒZed„ƒZdefd	„ƒYZd
efd„ƒYZ	de	fd
„ƒYZ
dee	fd„ƒYZeZ
eZeZdS(s"Basic classes with predefined properties

Example usage:
    class Article(Gdtstruct):
        "A basic Article class"
        # fields and types are dynamically set by the initializer
        gdtstruct_properties([('title', Gdtstr, "The Title of the Article"),
                              ('page', Gdtlist, "List of pages in the Article")
                              ])

        def __init__(self, *args):
            super(Article, self).__init__(*args)
            self.title = Gdtstr("")
            self.page = Gdtlist()         

    class Page(Gdtstruct):
        # fields and types are dynamically set by the initializer
        gdtstruct_properties([('text', Gdtstr, "The text of the page"),
                              ])

        def __init__(self, *args):            
            super(Page, self).__init__(*args)
            self.text = Gdtstr(args[0] if len(args) else "")
            

    a = Article()
    print Article.title.__doc__
    print
    a.title = "My title"
    a.page.append(Page("page 1"))
    a.page.append(Page("page 2"))
    a.commit()
    print a
    print
    a.title = "My bad title"
    a.page[1].text = "bad page 2"
    a.page.append(Page("bad page 3"))
    print a
    print
    a.page.rollback()
    print a
    print
    a.rollback()
    print a

Output of the example:

    The Title of the Article

    Article.title=My title
    Article.page.1.Page.text=page 1
    Article.page.2.Page.text=page 2
    
    
    Article.title=My bad title
    Article.page.1.Page.text=page 1
    Article.page.2.Page.text=bad page 2
    Article.page.3.Page.text=bad page 3
    
    
    Article.title=My bad title
    Article.page.1.Page.text=page 1
    Article.page.2.Page.text=page 2
    
    
    Article.title=My title
    Article.page.1.Page.text=page 1
    Article.page.2.Page.text=page 2
iÿÿÿÿNi(tTransactiontTransactionlistcsC‡fd†}ˆi|_ˆi|_ˆi|_ˆi|_|S(s6basic idea stolen from zope.interface.advice, P.J. Ebycs‰tidƒ}d|ijoYd|iijoFd|ijotdƒ‚n‡‡‡fd†}||id<nˆˆˆŽdS(Nit
__module__t
__metaclass__sZDon't use two class initializers or
a class initializer together with a __metaclass__ hookcsuyt|||ƒ}WnHtj
o<}dt|ƒjot||tf|ƒ}qa‚nXˆ|ˆˆŽ|S(screate the classscan't have only classic bases(ttypet	TypeErrortstrtobject(tnametbasestdictclste(targstproctkwargs(s2/usr/share/system-config-network/netconfpkg/gdt.pyt_makeclses(tsyst	_getframetf_localstf_codetco_varnamestSyntaxError(R
RtframeR(R(R
Rs2/usr/share/system-config-network/netconfpkg/gdt.pyt_newproc]s(t__name__Rt__doc__t__dict__(RR((Rs2/usr/share/system-config-network/netconfpkg/gdt.pyt_classinitializer[sc
Cs¨x¡|D]™\}}}t||ƒotd|ƒ‚n|d„}||d„}|d„}t||t|||d|ƒƒ|ii|ƒ||i|<qWdS(sR
    Add properties to cls, according to the schema, which is a list
    of pairs (fieldname, Gdtobject_subclass, docstring).
    A Gdtobject_subclass is a callable converting the field value 
    into the Gdtobject_subclass.
    Instances of cls are expected to have private attributes 
    with names determined by the field names.
    sYou are overriding %s!cSs*t|d|ƒpdSt|d|ƒS(sget the property 'name't_N(thasattrtNonetgetattr(tselfR((s2/usr/share/system-config-network/netconfpkg/gdt.pyt_getter“scSss|djot|d|dƒnKt|dƒo|ƒ}|i|ƒn
||ƒ}t|d||ƒdS(sset the property 'name'RtapplyN(RtsetattrRR#(R!tvalueRttypecasttnval((s2/usr/share/system-config-network/netconfpkg/gdt.pyt_setteršs
	cSst|d|dƒdS(NR(R$R(R!R((s2/usr/share/system-config-network/netconfpkg/gdt.pyt_deler§stdocN(RtAttributeErrorR$tpropertyt_fieldstaddt_types(RtschemaRR&t	docstringR"R(R)((s2/usr/share/system-config-network/netconfpkg/gdt.pytgdtstruct_properties{s
"cCs
||_dS(sR
    Add properties to cls, according to the schema, which is a list
    of pairs (fieldname, Gdtobject_subclass, docstring).
    A Gdtobject_subclass is a callable converting the field value 
    into the Gdtobject_subclass.
    Instances of cls are expected to have private attributes 
    with names determined by the field names.
    N(t_type(RR&((s2/usr/share/system-config-network/netconfpkg/gdt.pytgdtlist_properties¯s
t	GdtobjectcBs2eZdZdZdd„Zd„Zd„ZRS(sThe base of all GdtobjectscCs
t‚dS(s&returns a string in gdt representationN(tNotImplementedError(R!t
prefix_string((s2/usr/share/system-config-network/netconfpkg/gdt.pyttostrÀscCs
|iƒS(N(R8(R!((s2/usr/share/system-config-network/netconfpkg/gdt.pyt__str__ÄscCstS(s3test on integrity, to be implemented by sub-classes(tTrue(R!((s2/usr/share/system-config-network/netconfpkg/gdt.pyttestÇsN(RRRRtkeyidR8R9R;(((s2/usr/share/system-config-network/netconfpkg/gdt.pyR5¼s
	tGdtcontainercBseZdZd„ZRS(s9A base container class, which contains several GdtobjectscCs
t‚dS(scopy from another objectN(R6(R!tother((s2/usr/share/system-config-network/netconfpkg/gdt.pyR#Ïs(RRRR#(((s2/usr/share/system-config-network/netconfpkg/gdt.pyR=Ìst	GdtstructcBsGeZdZeƒZeƒZd„Zdd„Z	d„Z
d„ZRS(s9A base class, which can be used with gdtstruct_propertiescCs%t}x|iD]
}t|d|ƒo^t|d|ƒ}t|ƒt|iƒjo+y||ƒM}Wq„tj
oq„Xqqt|d|ƒot|d|ƒ}t|dƒoZt|dƒ}t|ƒt|iƒjo+y||ƒM}Wqtj
oqXqqqqW|S(NR;R(R:R-RR RR;R6(R!tall_oktfieldttmtval((s2/usr/share/system-config-network/netconfpkg/gdt.pyR;Øs(

cCsÖ|djo|ii}nd}t|iƒ}|iƒx“|D]‹}t||ƒout||ƒ}|djoqCnt|t	ƒo!||i
d||fƒ7}qÎ|d||t|ƒf7}qCqCW|S(s&returns a string in gdt representationts%s.%ss	%s.%s=%s
N(Rt	__class__RtlistR-tsortRR t
isinstanceR=R8R(R!R7tmstrtfieldsRRC((s2/usr/share/system-config-network/netconfpkg/gdt.pyR8ðs


!%cCså|d}||ijoÁt|ƒdjoXt||ƒ}|djo|i|ƒ}n|i|d|ƒt|||ƒqá|i|tjo!t|||djptƒqát|||i||ƒƒnt	‚dS(NiiR:(
R-tlenR RR/tfromstrR$tbooltFalsetKeyError(R!tvalsR%Rto((s2/usr/share/system-config-network/netconfpkg/gdt.pyRLs

!!cCsEx>|iD]3}t||ƒot||t||ƒƒq
q
WdS(scopy from another objectN(R-RR$R (R!R>RA((s2/usr/share/system-config-network/netconfpkg/gdt.pyR#s
N(RRRtsetR-tdictR/R;RR8RLR#(((s2/usr/share/system-config-network/netconfpkg/gdt.pyR?Ós				tGdtlistcBs;eZdZdZdd„Zd„Zd„Zd„ZRS(s7A list base class, which can hold Gdtobjects in a list.cCs¿|djo|ii}nd}d}x|D]‡}|d7}t|tƒoP|i}|ot||ƒ}n
t|ƒ}||id||fƒ7}q0|d|||f7}q0W|S(s&returns a string in gdt representationRDiis%s.%ss	%s.%d=%s
N(	RRERRHR5R<R RR8(R!R7RItiR%tkid((s2/usr/share/system-config-network/netconfpkg/gdt.pyR8s 

	cCsÑ|d|iijo|d=nt|dƒ}|t|ƒjo;x8td|t|ƒƒD]}|i|iƒƒq_Wn||d}t|tƒo|i|d|ƒn|i|ƒ||d<dS(Nii(	R3RtintRKtrangetappendRHR5RL(R!RPR%tindexRUtchild((s2/usr/share/system-config-network/netconfpkg/gdt.pyRL7scCs…t}xx|D]p}t|dƒoZt|dƒ}t|ƒt|iƒjo+y||ƒM}Wqytj
oqyXq}q
q
W|S(NR;(R:RR RR;R6(R!R@RCRB((s2/usr/share/system-config-network/netconfpkg/gdt.pyR;HscCs|2|i|ƒdS(N(textend(R!R%((s2/usr/share/system-config-network/netconfpkg/gdt.pyR#VsN(	RRRRR3R8RLR;R#(((s2/usr/share/system-config-network/netconfpkg/gdt.pyRTs		(RRttransactionRRRR2R4R5R=R?RTRtGdtstrRMtGdtboolRWtGdtint(((s2/usr/share/system-config-network/netconfpkg/gdt.pyt<module>Ts	 4
G@

haha - 2025