def base_create_dep_objs(cls):
     """
     Create all objects that ProposalParticipant need.
     """
     prop3 = Proposals()
     TestProposals.base_create_dep_objs()
     prop3.from_hash(SAMPLE_PROPOSAL_HASH)
     prop3.save(force_insert=True)
     user = Users()
     TestUsers.base_create_dep_objs()
     user.from_hash(SAMPLE_USER_HASH)
     user.save(force_insert=True)
 def base_create_dep_objs(cls):
     """
     Create all objects that FileKeyValue need.
     """
     prop2 = Proposals()
     TestProposals.base_create_dep_objs()
     prop2.from_hash(SAMPLE_PROPOSAL_HASH)
     prop2.save(force_insert=True)
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
 def base_create_dep_objs(cls):
     """
     Create all objects that FileKeyValue need.
     """
     prop1 = Proposals()
     TestProposals.base_create_dep_objs()
     prop1.from_hash(SAMPLE_PROPOSAL_HASH)
     prop1.save(force_insert=True)
     cite = Citations()
     TestCitations.base_create_dep_objs()
     cite.from_hash(SAMPLE_CITATION_HASH)
     cite.save(force_insert=True)
 def base_create_dep_objs(cls):
     """
     Build the object and make dependent user object.
     """
     submitter = Users()
     TestUsers.base_create_dep_objs()
     submitter.from_hash(SAMPLE_SUBMITTER_HASH)
     submitter.save(force_insert=True)
     prop = Proposals()
     TestProposals.base_create_dep_objs()
     prop.from_hash(SAMPLE_PROPOSAL_HASH)
     prop.save(force_insert=True)
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(ProposalParticipant, self).from_hash(obj)
     if 'person_id' in obj:
         self.person = Users.get(Users.id == obj['person_id'])
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(CitationProposal, self).from_hash(obj)
     if 'citation_id' in obj:
         self.citation = Citations.get(Citations.id == obj['citation_id'])
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
 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(ProposalInstrument, self).from_hash(obj)
     if 'instrument_id' in obj:
         self.instrument = Instruments.get(
             Instruments.id == obj['instrument_id'])
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(ProposalParticipant, self).from_hash(obj)
     if 'person_id' in obj:
         self.person = Users.get(Users.id == obj['person_id'])
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(CitationProposal, self).from_hash(obj)
     if 'citation_id' in obj:
         self.citation = Citations.get(Citations.id == obj['citation_id'])
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(ProposalInstrument, self).from_hash(obj)
     if 'instrument_id' in obj:
         self.instrument = Instruments.get(Instruments.id == obj['instrument_id'])
     if 'proposal_id' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(CitationProposal, self).where_clause(kwargs)
     if 'citation_id' in kwargs:
         citation = Citations.get(Citations.id == kwargs['citation_id'])
         where_clause &= Expression(CitationProposal.citation, OP.EQ, citation)
     if 'proposal_id' in kwargs:
         proposal = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(CitationProposal.proposal, OP.EQ, proposal)
     return where_clause
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(ProposalInstrument, self).where_clause(kwargs)
     if 'instrument_id' in kwargs:
         instrument = Instruments.get(Instruments.id == kwargs['instrument_id'])
         where_clause &= Expression(ProposalInstrument.instrument, OP.EQ, instrument)
     if 'proposal_id' in kwargs:
         proposal = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(ProposalInstrument.proposal, OP.EQ, proposal)
     return where_clause
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(CitationProposal, self).where_clause(kwargs)
     if 'citation_id' in kwargs:
         citation = Citations.get(Citations.id == kwargs['citation_id'])
         where_clause &= Expression(CitationProposal.citation, OP.EQ, citation)
     if 'proposal_id' in kwargs:
         proposal = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(CitationProposal.proposal, OP.EQ, proposal)
     return where_clause
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(ProposalParticipant, self).where_clause(kwargs)
     if 'person_id' in kwargs:
         member = Users.get(Users.id == kwargs['person_id'])
         where_clause &= Expression(ProposalParticipant.person, OP.EQ,
                                    member)
     if 'proposal_id' in kwargs:
         proposal = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(ProposalParticipant.proposal, OP.EQ,
                                    proposal)
     return where_clause
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(ProposalParticipant, self).where_clause(kwargs)
     if 'person_id' in kwargs:
         member = Users.get(Users.id == kwargs['person_id'])
         where_clause &= Expression(ProposalParticipant.person, OP.EQ, member)
     if 'proposal_id' in kwargs:
         proposal = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(ProposalParticipant.proposal, OP.EQ, proposal)
     return where_clause
 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 from_hash(self, obj):
     """Convert the hash into the object."""
     super(Transactions, self).from_hash(obj)
     if '_id' in obj:
         # pylint: disable=invalid-name
         self.id = int(obj['_id'])
         # pylint: enable=invalid-name
     if 'submitter' in obj:
         self.submitter = Users.get(Users.id == obj['submitter'])
     if 'instrument' in obj:
         self.instrument = Instruments.get(Instruments.id == obj['instrument'])
     if 'proposal' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal'])
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(ProposalInstrument, self).where_clause(kwargs)
     if 'instrument_id' in kwargs:
         instrument = Instruments.get(
             Instruments.id == kwargs['instrument_id'])
         where_clause &= Expression(ProposalInstrument.instrument, OP.EQ,
                                    instrument)
     if 'proposal_id' in kwargs:
         proposal = Proposals.get(Proposals.id == kwargs['proposal_id'])
         where_clause &= Expression(ProposalInstrument.proposal, OP.EQ,
                                    proposal)
     return where_clause
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(Transactions, self).from_hash(obj)
     if '_id' in obj:
         # pylint: disable=invalid-name
         self.id = int(obj['_id'])
         # pylint: enable=invalid-name
     if 'submitter' in obj:
         self.submitter = Users.get(Users.id == obj['submitter'])
     if 'instrument' in obj:
         self.instrument = Instruments.get(Instruments.id == obj['instrument'])
     if 'proposal' in obj:
         self.proposal = Proposals.get(Proposals.id == obj['proposal'])
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(Transactions, self).where_clause(kwargs)
     if '_id' in kwargs:
         where_clause &= Expression(Transactions.id, OP.EQ, kwargs['_id'])
     if 'submitter' in kwargs:
         user = Users.get(Users.id == kwargs['submitter'])
         where_clause &= Expression(Transactions.submitter, OP.EQ, user)
     if 'instrument' in kwargs:
         inst = Instruments.get(Instruments.id == kwargs['instrument'])
         where_clause &= Expression(Transactions.instrument, OP.EQ, inst)
     if 'proposal' in kwargs:
         prop = Proposals.get(Proposals.id == kwargs['proposal'])
         where_clause &= Expression(Transactions.proposal, OP.EQ, prop)
     return where_clause
 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)
 def base_create_dep_objs(cls):
     """Create all objects that FileKeyValue need."""
     prop1 = Proposals()
     TestProposals.base_create_dep_objs()
     prop1.from_hash(SAMPLE_PROPOSAL_HASH)
     prop1.save(force_insert=True)
     cite = Citations()
     TestCitations.base_create_dep_objs()
     cite.from_hash(SAMPLE_CITATION_HASH)
     cite.save(force_insert=True)
 def base_create_dep_objs(cls):
     """Create all objects that ProposalParticipant need."""
     prop3 = Proposals()
     TestProposals.base_create_dep_objs()
     prop3.from_hash(SAMPLE_PROPOSAL_HASH)
     prop3.save(force_insert=True)
     user = Users()
     TestUsers.base_create_dep_objs()
     user.from_hash(SAMPLE_USER_HASH)
     user.save(force_insert=True)
 def base_create_dep_objs(cls):
     """Create all objects that FileKeyValue need."""
     prop2 = Proposals()
     TestProposals.base_create_dep_objs()
     prop2.from_hash(SAMPLE_PROPOSAL_HASH)
     prop2.save(force_insert=True)
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(Transactions, self).where_clause(kwargs)
     if '_id' in kwargs:
         where_clause &= Expression(Transactions.id, OP.EQ, kwargs['_id'])
     if 'submitter' in kwargs:
         user = Users.get(Users.id == kwargs['submitter'])
         where_clause &= Expression(Transactions.submitter, OP.EQ, user)
     if 'instrument' in kwargs:
         inst = Instruments.get(Instruments.id == kwargs['instrument'])
         where_clause &= Expression(Transactions.instrument, OP.EQ, inst)
     if 'proposal' in kwargs:
         prop = Proposals.get(Proposals.id == kwargs['proposal'])
         where_clause &= Expression(Transactions.proposal, OP.EQ, prop)
     return where_clause
 def base_create_dep_objs(cls):
     """Build the object and make dependent user object."""
     submitter = Users()
     TestUsers.base_create_dep_objs()
     submitter.from_hash(SAMPLE_SUBMITTER_HASH)
     submitter.save(force_insert=True)
     prop = Proposals()
     TestProposals.base_create_dep_objs()
     prop.from_hash(SAMPLE_PROPOSAL_HASH)
     prop.save(force_insert=True)
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)