Example #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']))
Example #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']))
 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']))
 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']))
Example #5
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']))