#NEWLINE# def getDecodableAttributes( self , obj , attrs , codec = None ) : #NEWLINE# #INDENT# '\n        Returns a dictionary of attributes for C{obj} that has been filtered,\n        based on the supplied C{attrs}. This allows for fine grain control\n        over what will finally end up on the object or not.\n\n        @param obj: The object that will recieve the attributes.\n        @param attrs: The C{attrs} dictionary that has been decoded.\n        @param codec: An optional argument that will contain the decoder\n            instance calling this function.\n        @return: A dictionary of attributes that can be applied to C{obj}\n        @since: 0.5\n        ' #NEWLINE# if ( not self . _compiled ) : #NEWLINE# #INDENT# self . compile ( ) #NEWLINE# #UNINDENT# changed = False #NEWLINE# props = set ( attrs . keys ( ) ) #NEWLINE# if self . static_attrs : #NEWLINE# #INDENT# missing_attrs = self . static_attrs_set . difference ( props ) #NEWLINE# if missing_attrs : #NEWLINE# #INDENT# raise AttributeError ( ( 'Static attributes %r expected when decoding %r' % ( missing_attrs , self . klass ) ) ) #NEWLINE# #UNINDENT# props . difference_update ( self . static_attrs ) #NEWLINE# #UNINDENT# if ( not props ) : #NEWLINE# #INDENT# return attrs #NEWLINE# #UNINDENT# if ( not self . dynamic ) : #NEWLINE# #INDENT# if ( not self . decodable_properties ) : #NEWLINE# #INDENT# props = set ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# props . intersection_update ( self . decodable_properties ) #NEWLINE# #UNINDENT# changed = True #NEWLINE# #UNINDENT# if self . readonly_attrs : #NEWLINE# #INDENT# props . difference_update ( self . readonly_attrs ) #NEWLINE# changed = True #NEWLINE# #UNINDENT# if self . exclude_attrs : #NEWLINE# #INDENT# props . difference_update ( self . exclude_attrs ) #NEWLINE# changed = True #NEWLINE# #UNINDENT# if ( ( self . proxy_attrs is not None ) and codec ) : #NEWLINE# #INDENT# context = codec . context #NEWLINE# for k in self . proxy_attrs : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# v = attrs [ k ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# attrs [ k ] = context . getObjectForProxy ( v ) #NEWLINE# #UNINDENT# #UNINDENT# if self . synonym_attrs : #NEWLINE# #INDENT# missing = object ( ) #NEWLINE# for ( k , v ) in self . synonym_attrs . iteritems ( ) : #NEWLINE# #INDENT# value = attrs . pop ( k , missing ) #NEWLINE# if ( value is obj ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# attrs [ v ] = value #NEWLINE# #UNINDENT# #UNINDENT# if ( not changed ) : #NEWLINE# #INDENT# return attrs #NEWLINE# #UNINDENT# a = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# [ a . __setitem__ ( p , attrs [ p ] ) for p in props ] #NEWLINE# return a