コード例 #1
0
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(UserGroup, self).from_hash(obj)
     self._set_only_if('person_id', obj, 'person',
                       lambda: Users.get(Users.id == obj['person_id']))
     self._set_only_if('group_id', obj, 'group',
                       lambda: Groups.get(Groups.id == obj['group_id']))
コード例 #2
0
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(InstrumentCustodian, self).from_hash(obj)
     self._set_only_if(
         'instrument_id', obj, 'instrument',
         lambda: Instruments.get(Instruments.id == obj['instrument_id']))
     self._set_only_if('custodian_id', obj, 'custodian',
                       lambda: Users.get(Users.id == obj['custodian_id']))
コード例 #3
0
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(ProposalParticipant, self).from_hash(obj)
     self._set_only_if('person_id', obj, 'person',
                       lambda: Users.get(Users.id == obj['person_id']))
     self._set_only_if(
         'proposal_id', obj, 'proposal',
         lambda: Proposals.get(Proposals.id == obj['proposal_id']))
コード例 #4
0
 def from_hash(self, obj):
     """Convert the hash to the object."""
     super(TransactionRelease, self).from_hash(obj)
     self._set_only_if(
         'transaction', obj, 'transaction',
         lambda: Transactions.get(Transactions.id == obj['transaction']))
     self._set_only_if(
         'authorized_person', obj, 'authorized_person',
         lambda: Users.get(Users.id == obj['authorized_person']))
コード例 #5
0
 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)
コード例 #6
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)
コード例 #7
0
 def base_create_dep_objs(cls):
     """Build the object and make dependent user object."""
     auth_person = Users()
     TestUsers.base_create_dep_objs()
     auth_person.from_hash(SAMPLE_CREATOR_HASH)
     auth_person.save(force_insert=True)
     rel_trans = Transactions()
     TestTransactions.base_create_dep_objs()
     rel_trans.from_hash(SAMPLE_TRANSACTION_HASH)
     rel_trans.save(force_insert=True)
コード例 #8
0
 def base_create_dep_objs(cls):
     """Create all objects that UserGroup need."""
     member = Users()
     TestUsers.base_create_dep_objs()
     member.from_hash(SAMPLE_USER_HASH)
     member.save(force_insert=True)
     groups = Groups()
     TestGroups.base_create_dep_objs()
     groups.from_hash(SAMPLE_GROUP_HASH)
     groups.save(force_insert=True)
コード例 #9
0
 def base_create_dep_objs(cls):
     """Create all objects that Files depend on."""
     user = Users()
     TestUsers.base_create_dep_objs()
     user.from_hash(SAMPLE_USER_HASH)
     user.save(force_insert=True)
     inst = Institutions()
     TestInstitutions.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTITUTION_HASH)
     inst.save(force_insert=True)
コード例 #10
0
 def base_create_dep_objs(cls):
     """Create all objects that InstitutionPerson need."""
     inst = Institutions()
     TestInstitutions.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTITUTION_HASH)
     inst.save(force_insert=True)
     user1 = Users()
     TestUsers.base_create_dep_objs()
     user1.from_hash(SAMPLE_USER_HASH)
     user1.save(force_insert=True)
コード例 #11
0
 def from_hash(self, obj):
     """Convert the hash into the object fields."""
     super(Contributors, self).from_hash(obj)
     self._set_only_if('_id', obj, 'id', lambda: int(obj['_id']))
     for attr in ['first_name', 'middle_initial', 'last_name', 'dept_code']:
         self._set_only_if(attr,
                           obj,
                           attr,
                           lambda k=attr: unicode_type(obj[k]))
     self._set_only_if('person_id', obj, 'person',
                       lambda: Users.get(Users.id == int(obj['person_id'])))
     self._set_only_if(
         'institution_id', obj, 'institution', lambda: Institutions.get(
             Institutions.id == int(obj['institution_id'])))
     self._set_only_if('encoding', obj, 'encoding',
                       lambda: str(obj['encoding']))
コード例 #12
0
 def base_create_dep_objs(cls):
     """Create all objects that InstitutionUser need."""
     rel = Relationships()
     TestRelationships.base_create_dep_objs()
     rel.from_hash(SAMPLE_RELATIONSHIP_HASH)
     rel.save(force_insert=True)
     inst = Institutions()
     TestInstitutions.base_create_dep_objs()
     inst.from_hash(SAMPLE_INSTITUTION_HASH)
     inst.save(force_insert=True)
     user1 = Users()
     TestUsers.base_create_dep_objs()
     user1.from_hash(SAMPLE_USER_HASH)
     user1.save(force_insert=True)
コード例 #13
0
 def base_create_dep_objs(cls):
     """Build the object and make dependent user object."""
     rel = Relationships()
     TestRelationships.base_create_dep_objs()
     rel.from_hash(SAMPLE_RELATIONSHIP_HASH)
     rel.save(force_insert=True)
     user3 = Users()
     TestUsers.base_create_dep_objs()
     user3.from_hash(SAMPLE_CREATOR_HASH)
     user3.save(force_insert=True)
     rel_trans = Transactions()
     TestTransactions.base_create_dep_objs()
     rel_trans.from_hash(SAMPLE_TRANSACTION_HASH)
     rel_trans.save(force_insert=True)
コード例 #14
0
 def base_create_dep_objs(cls):
     """Create all objects that ProjectUser need."""
     rel = Relationships()
     TestRelationships.base_create_dep_objs()
     rel.from_hash(SAMPLE_RELATIONSHIP_HASH)
     rel.save(force_insert=True)
     proj3 = Projects()
     TestProjects.base_create_dep_objs()
     proj3.from_hash(SAMPLE_PROJECT_HASH)
     proj3.save(force_insert=True)
     user = Users()
     TestUsers.base_create_dep_objs()
     user.from_hash(SAMPLE_USER_HASH)
     user.save(force_insert=True)
コード例 #15
0
 def base_create_dep_objs(cls):
     """Build the object and make dependent user object."""
     proj = Projects()
     TestProjects.base_create_dep_objs()
     proj.from_hash(SAMPLE_PROJECT_HASH)
     proj.save(force_insert=True)
     submitter = Users()
     TestUsers.base_create_dep_objs()
     submitter.from_hash(SAMPLE_SUBMITTER_HASH)
     submitter.save(force_insert=True)
     atool = AnalyticalTools()
     TestAnalyticalTools.base_create_dep_objs()
     atool.from_hash(SAMPLE_TOOL_HASH)
     atool.save(force_insert=True)
     trans = Transactions()
     TestTransactions.base_create_dep_objs()
     trans.from_hash(SAMPLE_TRANSACTION_HASH)
     trans.save(force_insert=True)
コード例 #16
0
 def base_create_dep_objs(cls):
     """Build the object and make dependent user object."""
     submitter, _created = Users().get_or_create(
         id=SAMPLE_SUBMITTER_HASH['_id'])
     TestUsers.base_create_dep_objs()
     submitter.from_hash(SAMPLE_SUBMITTER_HASH)
     submitter.save()
     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)
     trans = Transactions()
     TestTransactions.base_create_dep_objs()
     trans.from_hash(SAMPLE_TRANSACTION_HASH)
     trans.save(force_insert=True)
コード例 #17
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_CREATOR_HASH)
        submitter.save(force_insert=True)

        uni_submitter = Users()
        uni_submitter.from_hash(SAMPLE_UNICODE_CREATOR_HASH)
        uni_submitter.save(force_insert=True)