def base_create_dep_objs(cls):
     """
     Create all objects that InstrumentCustodian need.
     """
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
     custodian = Users()
     TestUsers.base_create_dep_objs()
     custodian.from_hash(SAMPLE_USER_HASH)
     custodian.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 InstrumentGroup need.
     """
     groups = Groups()
     TestGroups.base_create_dep_objs()
     groups.from_hash(SAMPLE_GROUP_HASH)
     groups.save(force_insert=True)
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
예제 #4
0
 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)
예제 #5
0
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(InstrumentCustodian, self).from_hash(obj)
     if 'instrument_id' in obj:
         self.instrument = Instruments.get(Instruments.id == obj['instrument_id'])
     if 'custodian_id' in obj:
         self.custodian = Users.get(Users.id == obj['custodian_id'])
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(InstrumentGroup, self).from_hash(obj)
     if 'instrument_id' in obj:
         self.instrument = Instruments.get(
             Instruments.id == obj['instrument_id'])
     if 'group_id' in obj:
         self.group = Groups.get(Groups.id == obj['group_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(InstrumentCustodian, self).from_hash(obj)
     if 'instrument_id' in obj:
         self.instrument = Instruments.get(Instruments.id == obj['instrument_id'])
     if 'person_id' in obj:
         self.custodian = Users.get(Users.id == obj['person_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'])
예제 #10
0
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(InstrumentGroup, self).from_hash(obj)
     if 'instrument_id' in obj:
         self.instrument = Instruments.get(Instruments.id == obj['instrument_id'])
     if 'group_id' in obj:
         self.group = Groups.get(Groups.id == obj['group_id'])
예제 #11
0
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(InstrumentCustodian, self).where_clause(kwargs)
     if 'instrument_id' in kwargs:
         instrument = Instruments.get(Instruments.id == kwargs['instrument_id'])
         where_clause &= Expression(InstrumentCustodian.instrument, OP.EQ, instrument)
     if 'custodian_id' in kwargs:
         user = Users.get(Users.id == kwargs['custodian_id'])
         where_clause &= Expression(InstrumentCustodian.custodian, OP.EQ, user)
     return where_clause
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(InstrumentCustodian, self).where_clause(kwargs)
     if 'instrument_id' in kwargs:
         instrument = Instruments.get(Instruments.id == kwargs['instrument_id'])
         where_clause &= Expression(InstrumentCustodian.instrument, OP.EQ, instrument)
     if 'person_id' in kwargs:
         user = Users.get(Users.id == kwargs['person_id'])
         where_clause &= Expression(InstrumentCustodian.custodian, OP.EQ, user)
     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
예제 #14
0
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(InstrumentGroup, self).where_clause(kwargs)
     if 'instrument_id' in kwargs:
         instrument = Instruments.get(Instruments.id == kwargs['instrument_id'])
         where_clause &= Expression(InstrumentGroup.instrument, OP.EQ, instrument)
     if 'group_id' in kwargs:
         group = Groups.get(Groups.id == kwargs['group_id'])
         where_clause &= Expression(InstrumentGroup.group, OP.EQ, group)
     return where_clause
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(InstrumentGroup, self).where_clause(kwargs)
     if 'instrument_id' in kwargs:
         instrument = Instruments.get(
             Instruments.id == kwargs['instrument_id'])
         where_clause &= Expression(InstrumentGroup.instrument, OP.EQ,
                                    instrument)
     if 'group_id' in kwargs:
         group = Groups.get(Groups.id == kwargs['group_id'])
         where_clause &= Expression(InstrumentGroup.group, OP.EQ, group)
     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 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(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
예제 #19
0
 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'])
예제 #20
0
 def base_create_dep_objs(cls):
     """Create all objects that InstrumentGroup need."""
     groups = Groups()
     TestGroups.base_create_dep_objs()
     groups.from_hash(SAMPLE_GROUP_HASH)
     groups.save(force_insert=True)
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
예제 #21
0
 def base_create_dep_objs(cls):
     """Create all objects that InstrumentCustodian need."""
     inst = Instruments()
     TestInstruments.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTRUMENT_HASH)
     inst.save(force_insert=True)
     custodian = Users()
     TestUsers.base_create_dep_objs()
     custodian.from_hash(SAMPLE_USER_HASH)
     custodian.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)
예제 #23
0
 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)