#NEWLINE# @ classmethod #NEWLINE# def as_mutable( cls , sqltype ) : #NEWLINE# #INDENT# "Associate a SQL type with this mutable Python type.\n\n        This establishes listeners that will detect ORM mappings against\n        the given type, adding mutation event trackers to those mappings.\n\n        The type is returned, unconditionally as an instance, so that\n        :meth:`.as_mutable` can be used inline::\n\n            Table('mytable', metadata,\n                Column('id', Integer, primary_key=True),\n                Column('data', MyMutableType.as_mutable(PickleType))\n            )\n\n        Note that the returned type is always an instance, even if a class\n        is given, and that only columns which are declared specifically with\n        that type instance receive additional instrumentation.\n\n        To associate a particular mutable type with all occurrences of a\n        particular type, use the :meth:`.Mutable.associate_with` classmethod\n        of the particular :class:`.Mutable` subclass to establish a global\n        association.\n\n        .. warning::\n\n           The listeners established by this method are *global*\n           to all mappers, and are *not* garbage collected.   Only use\n           :meth:`.as_mutable` for types that are permanent to an application,\n           not with ad-hoc types else this will cause unbounded growth\n           in memory usage.\n\n        " #NEWLINE# sqltype = types . to_instance ( sqltype ) #NEWLINE# def listen_for_type( mapper , class_ ) : #NEWLINE# #INDENT# for prop in mapper . column_attrs : #NEWLINE# #INDENT# if ( prop . columns [ 0 ] . type is sqltype ) : #NEWLINE# #INDENT# cls . associate_with_attribute ( getattr ( class_ , prop . key ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# event . listen ( mapper , 'mapper_configured' , cls ) #NEWLINE# return sqltype