示例#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
示例#2
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
示例#3
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
示例#4
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
示例#5
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
示例#6
0
 def get_protected_fields(self):
     user = User()
     return user.get_protected_fields()
示例#7
0
 def get_empty_user(self):
     return User()
示例#8
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
示例#9
0
 def get_protected_fields(self):
     user = User()
     return user.get_protected_fields()