def from_hash(self, obj):
     """Convert the hash into the object."""
     super(AToolProposal, self).from_hash(obj)
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
     if 'analytical_tool_id' in obj:
         self.analytical_tool = AnalyticalTools.get(
             AnalyticalTools.id == obj['analytical_tool_id'])
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(AToolTransaction, self).from_hash(obj)
     if 'analytical_tool_id' in obj:
         self.analytical_tool = AnalyticalTools.get(
             AnalyticalTools.id == obj['analytical_tool_id'])
     if 'transaction_id' in obj:
         self.transaction = Transactions.get(
             Transactions.id == obj['transaction_id'])
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(AToolProposal, self).where_clause(kwargs)
     if 'proposal_id' in kwargs:
         prop = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(AToolProposal.proposal, OP.EQ, prop)
     if 'analytical_tool_id' in kwargs:
         atool = AnalyticalTools.get(
             AnalyticalTools.id == kwargs['analytical_tool_id'])
         where_clause &= Expression(AToolProposal.analytical_tool, OP.EQ,
                                    atool)
     return where_clause
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(AToolTransaction, self).where_clause(kwargs)
     if 'analytical_tool_id' in kwargs:
         atool = AnalyticalTools.get(
             AnalyticalTools.id == kwargs['analytical_tool_id'])
         where_clause &= Expression(AToolTransaction.analytical_tool, OP.EQ,
                                    atool)
     if 'transaction_id' in kwargs:
         trans = Transactions.get(
             Transactions.id == kwargs['transaction_id'])
         where_clause &= Expression(AToolTransaction.transaction, OP.EQ,
                                    trans)
     return where_clause
 def base_create_dep_objs(cls):
     """Create all objects that TransactionKeyValue need."""
     trans = Transactions()
     tool = AnalyticalTools()
     TestTransactions.base_create_dep_objs()
     trans.from_hash(SAMPLE_TRANSACTION_HASH)
     trans.save(force_insert=True)
     TestAnalyticalTools.base_create_dep_objs()
     tool.from_hash(SAMPLE_TOOL_HASH)
     tool.save(force_insert=True)
 def base_create_dep_objs(cls):
     """Create all objects that TransactionKeyValue need."""
     prop = Proposals()
     tool = AnalyticalTools()
     TestProposals.base_create_dep_objs()
     prop.from_hash(SAMPLE_PROPOSAL_HASH)
     prop.save(force_insert=True)
     TestAnalyticalTools.base_create_dep_objs()
     tool.from_hash(SAMPLE_TOOL_HASH)
     tool.save(force_insert=True)