(state)
| 1985 | if setter: |
| 1986 | |
| 1987 | def _set_polymorphic_identity(state): |
| 1988 | dict_ = state.dict |
| 1989 | # TODO: what happens if polymorphic_on column attribute name |
| 1990 | # does not match .key? |
| 1991 | |
| 1992 | polymorphic_identity = ( |
| 1993 | state.manager.mapper.polymorphic_identity |
| 1994 | ) |
| 1995 | if ( |
| 1996 | polymorphic_identity is None |
| 1997 | and state.manager.mapper.polymorphic_abstract |
| 1998 | ): |
| 1999 | raise sa_exc.InvalidRequestError( |
| 2000 | f"Can't instantiate class for {state.manager.mapper}; " |
| 2001 | "mapper is marked polymorphic_abstract=True" |
| 2002 | ) |
| 2003 | |
| 2004 | state.get_impl(polymorphic_key).set( |
| 2005 | state, |
| 2006 | dict_, |
| 2007 | polymorphic_identity, |
| 2008 | None, |
| 2009 | ) |
| 2010 | |
| 2011 | self._polymorphic_attr_key = polymorphic_key |
| 2012 |
no test coverage detected