Changeset 756:673a9809df08 for src/mlx/rpc.py
- Timestamp:
- 01/11/16 15:56:23 (8 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/rpc.py
r745 r756 125 125 #--------------------------------------------------------------------------------------- 126 126 127 class Registration(object): 128 """Data for registration.""" 129 def __init__(self, name, yearOfBirth, emailAddress, emailAddressPublic, 130 vatsimID, ivaoID, phoneNumber, nationality, password): 131 """Construct the registration data.""" 132 self.name = name 133 self.yearOfBirth = yearOfBirth 134 self.emailAddress = emailAddress 135 self.emailAddressPublic = 1 if emailAddressPublic is True else \ 136 0 if emailAddressPublic is False else emailAddressPublic 137 self.vatsimID = "" if vatsimID is None else vatsimID 138 self.ivaoID = "" if ivaoID is None else ivaoID 139 self.phoneNumber = phoneNumber 140 self.nationality = nationality 141 self.password = password 142 143 #--------------------------------------------------------------------------------------- 144 127 145 class RPCException(Exception): 128 146 """An exception thrown by RPC operations.""" … … 155 173 RESULT_DATABASE_ERROR = 3 156 174 175 # Result code: invalid data 176 RESULT_INVALID_DATA = 4 177 157 178 # Result code: the flight does not exist 158 179 RESULT_FLIGHT_NOT_EXISTS = 101 … … 160 181 # Result code: the flight has already been reported. 161 182 RESULT_FLIGHT_ALREADY_REPORTED = 102 183 184 # Result code: a user with the given e-mail address already exists 185 RESULT_EMAIL_ALREADY_REGISTERED = 103 162 186 163 187 def __init__(self, getCredentialsFn): … … 189 213 self._sessionID = None 190 214 215 def register(self, registrationData): 216 """Register with the given data. 217 218 Returns a tuple of: 219 - the error code, 220 - the PID if there is no error.""" 221 reply = Reply(self._server.register(registrationData)) 222 223 return (reply.result, 224 reply.value["pid"] if reply.result==Client.RESULT_OK else None) 225 191 226 def login(self): 192 227 """Login using the given previously set credentials. … … 194 229 The session ID is stored in the object and used for later calls. 195 230 196 Returns a boolean indicating if login has succeeded."""231 Returns the name of the pilot on success, or None on error.""" 197 232 self._sessionID = None 198 233
Note:
See TracChangeset
for help on using the changeset viewer.