Fix owner_tag mapping of StoredWorkflow. Previously this mapping incorrectly retrieved *all* workflow tags owned by the user.

This commit is contained in:
Dannon Baker
2012-03-20 10:34:01 -04:00
parent 24370ef810
commit 9b4814a33a
+4 -5
View File
@@ -1566,7 +1566,7 @@ assign_mapper( context, WorkflowStepConnection, WorkflowStepConnection.table,
assign_mapper( context, StoredWorkflow, StoredWorkflow.table,
properties=dict( user=relation( User,
properties=dict( user=relation( User,
primaryjoin=( User.table.c.id == StoredWorkflow.table.c.user_id ),
backref='stored_workflows' ),
workflows=relation( Workflow, backref='stored_workflow',
@@ -1575,16 +1575,15 @@ assign_mapper( context, StoredWorkflow, StoredWorkflow.table,
latest_workflow=relation( Workflow, post_update=True,
primaryjoin=( StoredWorkflow.table.c.latest_workflow_id == Workflow.table.c.id ),
lazy=False ),
tags=relation( StoredWorkflowTagAssociation, order_by=StoredWorkflowTagAssociation.table.c.id, backref="stored_workflows" ),
owner_tags=relation( StoredWorkflowTagAssociation,
tags=relation( StoredWorkflowTagAssociation, order_by=StoredWorkflowTagAssociation.table.c.id, backref="stored_workflows" ),
owner_tags=relation( StoredWorkflowTagAssociation,
primaryjoin=and_( StoredWorkflow.table.c.id == StoredWorkflowTagAssociation.table.c.stored_workflow_id,
StoredWorkflow.table.c.user_id == StoredWorkflowTagAssociation.table.c.user_id ),
foreign_keys=[StoredWorkflowTagAssociation.table.c.user_id],
order_by=StoredWorkflowTagAssociation.table.c.id ),
annotations=relation( StoredWorkflowAnnotationAssociation, order_by=StoredWorkflowAnnotationAssociation.table.c.id, backref="stored_workflows" ),
ratings=relation( StoredWorkflowRatingAssociation, order_by=StoredWorkflowRatingAssociation.table.c.id, backref="stored_workflows" ) )
)
# Set up proxy so that
# StoredWorkflow.users_shared_with
# returns a list of users that workflow is shared with.