from tx2.Misc.DBMessages import db_messages def decode(result,rescode): if result == 1: return 'SUCCESS' elif result == 2: return 'Requested object already exists' else: return db_messages[str(rescode)] # insert function messages db_messages.update({'601':'User registration failed. Please try again later, if problem persists, contact system administrator.', '602':'User registration failed. Error adding user to group. Please try again later, if problem persists, contact system administrator.', '603':'User registration failed. Error adding entry to logs.Please try again later, if problem persists, contact system administrator.', }) #login user db_messages.update({ '2101':'user does not exist', '2102':'user email or password is not correct', '2103':'SYSTEM-ERROR.login type does not exist.Please report this error to your coordinator', #2104 = insertion in login log table failed '2104':'SYSTEM-ERROR. Error Generating login id.Please report this error to your coordinator', }) #logout user db_messages.update({ '2111':'SYSTEM ERROR. Login Id not found.Please report this error to your coordinator', '2112':'SYSTEM ERROR. Logout Type not exists.Please report this error to your coordinator', #2113 = updation of login log failed
msg += 'Requested object already exists. ' elif result == -1: msg += 'Error. ' elif result == 999: msg += 'Error in updating logs and book-keeping. ' try: msg += db_messages[int(rescode)] except Exception , e: msg = 'EXCEPTION : ' + str(e) return msg db_messages.update({ 201:'Requested city is already present in the database.', 202:'Failed to add requested city in database.', 206:'Requested state is already present in the database.', 207:'Failed to add requested city in database.', 211:'Requested country is already present in the database.', 212:'Failed to add requested country in database.', 216:'Failed to add adress to database.', 221:'Requested Adress Object does not exist in the system.', 222:'Failed to update adress in database.', 225:'Sucessfully updated adress in database', 231:'Record already exists for this user in contact information table. Please use update operation.', 232:'Failed to add contact information to database.', 236:'Requested Contact Information does not exist in the system.', 237:'Failed to update Contact Information in database.', 240:'Sucessfully updated Contact Information in database', })
from tx2.Misc.DBMessages import db_messages, decode db_messages.update({ # check user for permission 501: 'User does not exist.', 502: 'Requested permission is not there in the system.', 503: 'Content Type does not exist.', 504: 'Sorry you do not have permission to perform this operation on this object.', })
msg = 'EXCEPTION : ' + str(e) return msg db_messages.update({ # user insert 91:'User already exists with this emailid.', 92: 'Error creating user in the system. Insertion failed.', 999:'Log insertion failed.', # log in 113: 'login type does not exist.', 114: 'Login failed. Could not log down login.', 115: 'Login sucessful.', # log out 116: 'Logout failed. Login ID does not match.', 117: 'Log out Type does not exist.', 118: 'Error Logging out user. Error in Book Keeping.', # user update 96:'User does not exist.', 97: 'Updation of records failed.', # login type 141: 'login type exists.', 142: 'Error creation login type.', })
from tx2.Misc.DBMessages import db_messages, decode db_messages.update( { # check user for permission 501: "User does not exist.", 502: "Requested permission is not there in the system.", 503: "Content Type does not exist.", 504: "Sorry you do not have permission to perform this operation on this object.", } )
from tx2.Misc.DBMessages import db_messages,decode db_messages.update({ '51':'State with same name exists in system', '52':'Insertion failed in state table in security system', }) db_messages.update({ '61':'permission with same name exists in system', '62':'Insertion failed in permission table in security system', })