Changeset 756:673a9809df08 for src/mlx/web.py
- Timestamp:
- 01/11/16 15:56:23 (8 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/web.py
r746 r756 2 2 import const 3 3 import util 4 from rpc import Registration 4 5 import rpc 5 6 import rpccommon … … 620 621 super(RPCRequest, self).__init__(callback) 621 622 self._client = client 623 624 #------------------------------------------------------------------------------ 625 626 class Register(RPCRequest): 627 """A registration request.""" 628 def __init__(self, client, callback, registrationData): 629 """Construct the request.""" 630 super(Register, self).__init__(client, callback) 631 self._registrationData = registrationData 632 633 def run(self): 634 """Perform the registration.""" 635 636 registrationData = self._registrationData 637 638 (resultCode, pilotID) = self._client.register(registrationData) 639 result = Result() 640 result.registered = resultCode==rpc.Client.RESULT_OK 641 if result.registered: 642 result.pilotID = pilotID 643 644 self._client.setCredentials(pilotID, registrationData.password) 645 loginResult = self._client.login() 646 result.loggedIn = loginResult is not None 647 648 result.invalidData = \ 649 resultCode==rpc.Client.RESULT_INVALID_DATA 650 result.emailAlreadyRegistered = \ 651 resultCode==rpc.Client.RESULT_EMAIL_ALREADY_REGISTERED 652 653 return result 622 654 623 655 #------------------------------------------------------------------------------ … … 1134 1166 self._rpcClient.setCredentials(config.pilotID, config.password) 1135 1167 1168 def register(self, callback, registrationData): 1169 """Enqueue a registration request.""" 1170 self._addRequest(Register(self._rpcClient, callback, registrationData)) 1171 1136 1172 def login(self, callback, pilotID, password, entranceExam = False): 1137 1173 """Enqueue a login request."""
Note:
See TracChangeset
for help on using the changeset viewer.