관리-도구
편집 파일: unitofwork.cpython-37.pyc
B ��4]�` � @ s d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z d d � Z G dd� de�ZG d d� de�Z G dd� de �ZG dd� de�ZG dd� de e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�Zd!S )"z�The internals for the unit of work system. The session's flush() process passes objects to a contextual object here, which assembles flush tasks based on mappers and their properties, organizes them in order of dependency, and executes. � )� attributes)�exc)�persistence)�util� )�event)�topologicalc sj |j � � fdd�}� fdd�}� fdd�}tj| d|ddd � tj| d |ddd � tj| d|ddd � dS ) z\Establish event listeners on object attributes which handle cascade-on-set/append. c sn |d krd S | j }|rj|jr&|�d� | jjj� }t�|�}|jj rj|j sV� |jkrj|�|�sj|� |� |S )Nzcollection append)�session�_warn_on_events�_flush_warning�manager�mapper�_propsr �instance_state�_cascade�save_update�cascade_backrefs�key�_contains_state�_save_or_update_state)�state�item� initiator�sess�prop� item_state)r � �L/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/orm/unitofwork.py�append s z$track_cascade_events.<locals>.appendc s� |d krd S | j }| jjj� }|r>|jr>|�|jr8dnd� |d k r�|tjk r�|tj k r�|j jr�t�|�}|j� |�r�|r�||jkr�|�|� nd|_d S )Nzcollection removezrelated attribute deleteT)r r r r r r Zuselistr � NEVER_SET�PASSIVE_NO_RESULTr � delete_orphanr � _is_orphan�_new�expungeZ_orphaned_outside_of_session)r r r r r r )r r r �remove6 s"