Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/enterprise/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyc


[XMc@slddlZddlZddlmZdd
dYZdZdZdZdZdd	d
ddgZ	dS(iN(tDBErrort	ReflectorcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZddgd
dZdZdZdZRS(s]
    DEPRECATED.

    Base class for enterprise reflectors. This implements row caching.
    icCsHtjddtddtj|_||_i|_|jdS(s
        Initialize me against a database.

        @param rowClasses: a list of row class objects that describe the
            database schema.
        s<twisted.enterprise.reflector is deprecated since Twisted 8.0tcategoryt
stackleveliN(	twarningstwarntDeprecationWarningtweakreftWeakValueDictionarytrowCachet
rowClassestschemat	_populate(tselfR
((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt__init__s
		cCs|jj}|d=|S(NR	(t__dict__tcopy(R
td((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt__getstate__!scCs&||_tj|_|jdS(N(RRRR	R(R
tstate((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt__setstate__&s	cCstddS(sGImplement me to populate schema information for the reflector.
        snot implementedN(R(R
((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyR+scCsZ||j|j<xC|jD]8\}}}}}|j|j|||j||qWdS(sThis is called once for each registered rowClass to add it
        and its foreign key relationships for that rowClass to the
        schema.N(RtrowTableNametrowForeignKeyst
addForeignKeytrowClass(R
t	tableInfotforeignTableNametchildColumnst
parentColumnstcontainerMethodtautoLoad((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytpopulateSchemaFor0s
	cCsCy|j|jSWn*tk
r>td|j|fnXdS(sGet a TableInfo record about a particular instance.

        This record contains various information about the instance's
        class as registered with this reflector.

        @param rowObject: a L{RowObject} instance of a class previously
            registered with me.
        @raises twisted.enterprise.row.DBError: raised if this class was not
            previously registered.
        s#class %s was not registered with %sN(RRtKeyErrorRt	__class__(R
t	rowObject((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytgetTableInfo=s

cCshg}x[tdt|jD]A}t||j|d}|j|j|dt|gqW|S(s^util method used by reflectors. builds a where clause to link a row to another table.
        i(trangetlenRtgetattrRtappendtEQUAL(R
trelationshiptrowtwhereClausetitvalue((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytbuildWhereClauseNs
%cCs|j|}|j|}|s@td|j|fn|jst|drx<|D](}||jkr_|jj|q_q_Wn	||_dSt||jstd||jfnt||j}x|D]}||qWdS(sutil method used by reflectors. adds these rows to the parent row object.
        If a rowClass does not have a containerMethod, then a list attribute "childRows"
        will be used.
        sno relationship from %s to %st	childRowsNs2parent row (%s) doesnt have container method <%s>!(	R#tgetRelationshipForRRRthasattrR/R'R&(R
t	parentRowtrowst	tableNamet
parentInfoR)R*tmeth((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytaddToParentWs 	
	
cCs||j|j<dS(sGNOTE: Should this be recursive?! requires better container knowledge...N(R	tgetKeyTuple(R
R"((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt
addToCachesscCs]g}|j|jx(|jD]\}}|j||q Wt|}|jj|S(N(R'Rt
rowKeyColumnsttupleR	tget(R
RtkwtkeystkeyNametkeyTypetkeyTuple((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytfindInCachewscCs/|j}|jj|r+|j|=ndS(s!NOTE: should this be recursive!??N(R8R	thas_key(R
R"tkey((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytremoveFromCachesicCstddS(sImplement me to load objects from the database.

        @param whereClause: a list of tuples of (columnName, conditional, value)
            so it can be parsed by all types of reflectors. eg.::
              whereClause = [("name", EQUALS, "fred"), ("age", GREATERTHAN, 18)]
        snot implementedN(R(R
R4tparenttdataR+tloadChildren((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pytloadObjectsFromscCstddS(s/update this rowObject to the database.
        snot implementedN(R(R
R"((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt	updateRowscCstddS(s3insert a new row for this object instance.
        snot implementedN(R(R
R"((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt	insertRowscCstddS(s:delete the row for this object from the database.
        snot implementedN(R(R
R"((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt	deleteRowsN(t__name__t
__module__t__doc__t	populatedRRRRRR#R.R7R9RBREtNoneRIRJRKRL(((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyR
s$					
										iiiiR(tLESSTHANtGREATERTHANtLIKE((
RRttwisted.enterprise.utilRRR(RRRSRTt__all__(((s@/usr/lib/python2.7/dist-packages/twisted/enterprise/reflector.pyt<module>s