Rev 494 | Rev 766 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 14-Jul-2010@author: ashish'''from shop2020.helpers.impl import DataAccessorfrom shop2020.helpers.impl.DataAccessor import getSubstitutedMessage, getMessage,\updateMessage, addMessage, add_user, authenticate_user, delete_user, update_password,\initializefrom shop2020.helpers.impl.DataService import LogisticsUserfrom shop2020.thriftpy.utils.ttypes import HelperServiceExceptionfrom shop2020.helpers.impl.Converters import to_t_luserclass HelperServiceHandler():def __init__(self):initialize()def sendMail(self, mail):DataAccessor.sendMail(mail)def sendText(self, message):"""Parameters:- message"""DataAccessor.sendText(message)def addMessage(self, message):"""Parameters:- message"""addMessage(message)def updateMessage(self, id, message):"""Parameters:- id- message"""return updateMessage(id, message)def getMessage(self, id):"""Parameters:- id"""return getMessage(id)def getSubstitutedMessage(self, id, params):"""Parameters:- id- params"""return getSubstitutedMessage(id, params)def addUser(self, username, password, warehouseId):"""Parameters:- username- password- warehouseId"""return add_user(username, password, warehouseId)passdef deleteUser(self, username):"""Parameters:- username"""return delete_user(username)passdef authenticateUser(self, username, password):"""Parameters:- username- password"""return authenticate_user(username, password)passdef updatePassword(self, username, oldPassword, newPassword):"""Parameters:- username- oldPassword- newPassword"""update_password(username, oldPassword, newPassword)passdef authenticateLogisticsUser(self, username, password):"""Returns the LogisticsUser struct associated with the given username and password if they match.Throws an exception otherwise.Parameters:- username- password"""try:luser = LogisticsUser.get_by(username=username, password=password)return to_t_luser(luser)except:raise HelperServiceException(101, "No such user")