Esempio n. 1
0
 def read(self, userID):
     '''Return an User instance given an ID.
     '''
     response = self.driver.get(userID)
     user = User()
     if response:
         user.from_dictionary(response)
     return user
Esempio n. 2
0
 def read_multiple(self, userIDs, asDictionary=True):
     '''Return dictionary (default) or list of User instances.
     Use dictionary for easier indexing.
     Use list for order preservation.
     '''
     response = self.driver.get_multiple(userIDs, asDictionary)
     if asDictionary:
         output = {}
         for x in response:
             output[x] = User()
             output[x].from_dictionary(response[x])
     else:
         output = []
         for x in response:
             user = User()
             user.from_dictionary()
             output.append(user)
     return output
Esempio n. 3
0
 def read_by_field(self, field, id):
     response = self.driver.get_by_field(field, id)
     user = User()
     if response:
         user.from_dictionary(response)
     return user
Esempio n. 4
0
 def get_protected_fields(self):
     user = User()
     return user.get_protected_fields()
Esempio n. 5
0
 def get_empty_user(self):
     return User()