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/row.pyc


[XMc@sTdZddlZddlmZmZmZmZdddYZdgZdS(sq
DEPRECATED.

A (R)elational (O)bject (W)rapper.

This is an extremely thin wrapper.

Maintainer: Dave Peticolas
iN(tDBErrortNOQUOTEtgetKeyColumnt	dbTypeMapt	RowObjectcBsYeZdZdZdZdZdZdZdZdZ	dZ
dZRS(	s
    I represent a row in a table in a relational database.

    My class is "populated" by a Reflector object. After I am
    populated, instances of me are able to interact with a particular
    database table.

    You should use a class derived from this class for each database
    table.

    reflector.loadObjectsFrom() is used to create sets of
    instance of objects of this class from database tables.

    Once created, the "key column" attributes cannot be changed.


    Class Attributes that users must supply::

       rowKeyColumns     # list of key columns in form: [(columnName, typeName)]
       rowTableName      # name of database table
       rowColumns        # list of the columns in the table with the correct
                         # case.this will be used to create member variables.
       rowFactoryMethod  # method to create an instance of this class.
                         # HACK: must be in a list!!! [factoryMethod] (optional)
       rowForeignKeys    # keys to other tables (optional)
    icCstjddtdddS(s
        DEPRECATED.
        s6twisted.enterprise.row is deprecated since Twisted 8.0tcategoryt
stackleveliN(twarningstwarntDeprecationWarning(tself((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyt__init__4scCs_d}x,|jD]!\}}||krd}qqW|sNtd|n||j|<dS(sAssign to a key attribute.

        This cannot be done through normal means to protect changing
        keys of db objects.
        iis%s is not a key columns.N(t
rowKeyColumnsRt__dict__(R
tattrNametvaluetfoundt	keyColumnttype((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyt
assignKeyAttr;s
cCsSx<|jD]1\}}|j|jkr
t||Sq
Wtd|dS(s,Find an attribute by caseless name.
        sUnable to find attribute %sN(t
rowColumnstlowertgetattrR(R
RtattrR((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyt
findAttributeIscCst|j|r+td||fn||jkrr||jj|dkrr|jrr|jdqrn||j|<dS(s;Special setattr to prevent changing of key values.
        sHcannot assign value <%s> to key column attribute <%s> of RowObject classiN(	Rt	__class__RRR
tgettNonetdirtytsetDirty(R
tnameR((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyt__setattr__Qs%cCsx|jD]}t|j|r(q
nxy|jD]n\}}}|j||jkr2tj|d}|tkrt	||dqt	||dq2q2Wq
WdS(sPopulate instance with default attributes.

        This is used when creating a new instance NOT from the
        database.
        itN(
RRRt	dbColumnsRRRRRtsetattr(R
Rtcolumntctypettypeidtq((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pytcreateDefaultAttributes^scCs||jd<dS(sUse this to set the 'dirty' flag.

        (note: this avoids infinite recursion in __setattr__, and
        prevents the 'dirty' flag )
        RN(R
(R
tflag((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyRoscCsPg}|j|jx-|jD]"\}}|jt||q Wt|S(N(tappendtrowTableNameRRttuple(R
tkeystkeyNametkeyType((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pytgetKeyTuplews
(t__name__t
__module__t__doc__t	populatedRRRRRR'RR/(((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyRs				
		((	R2Rttwisted.enterprise.utilRRRRRt__all__(((s:/usr/lib/python2.7/dist-packages/twisted/enterprise/row.pyt<module>s"j