(state)
| 1904 | if setter: |
| 1905 | |
| 1906 | def _set_polymorphic_identity(state): |
| 1907 | dict_ = state.dict |
| 1908 | # TODO: what happens if polymorphic_on column attribute name |
| 1909 | # does not match .key? |
| 1910 | |
| 1911 | polymorphic_identity = ( |
| 1912 | state.manager.mapper.polymorphic_identity |
| 1913 | ) |
| 1914 | if ( |
| 1915 | polymorphic_identity is None |
| 1916 | and state.manager.mapper.polymorphic_abstract |
| 1917 | ): |
| 1918 | raise sa_exc.InvalidRequestError( |
| 1919 | f"Can't instantiate class for {state.manager.mapper}; " |
| 1920 | "mapper is marked polymorphic_abstract=True" |
| 1921 | ) |
| 1922 | |
| 1923 | state.get_impl(polymorphic_key).set( |
| 1924 | state, |
| 1925 | dict_, |
| 1926 | polymorphic_identity, |
| 1927 | None, |
| 1928 | ) |
| 1929 | |
| 1930 | self._polymorphic_attr_key = polymorphic_key |
| 1931 |
no test coverage detected