本文整理汇总了Python中staticdata.manager.ErrorCodeManager.ErrorCodeManager类的典型用法代码示例。如果您正苦于以下问题:Python ErrorCodeManager类的具体用法?Python ErrorCodeManager怎么用?Python ErrorCodeManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorCodeManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAllMyFocuses
def getAllMyFocuses(self, sessionKey, _request):
"""
:type sessionKey: str
:type _request: message.gate.ipostoper.IPostOper_Getallmyfocuses_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
tb = MongoDatabase.findTableByMessageType(TUserFan)
if not tb:
Logger.log("Table {} not found".format(TUserFan.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
tFocusList = tb.findManyWithQuey({TUserFan.fn_fanUserId: userEntity.getUserId()})
sFocusList = SeqMyFocus()
for tFan in tFocusList:
userEntity = UserEntityManager.findUserEntityByUserId(tFan.myUserId)
if not userEntity:
Logger.log("getAllMyFocuses",
"UserNotFound:", tFan.myUserId)
continue
sFocus = SMyFocus()
sFocus.userInfo = userEntity.getUserBriefInfo()
sFocus.operDt = tFan.createDt
sFocusList.append(sFocus)
_request.response(sFocusList)
示例2: updateAdress
def updateAdress(self, sessionKey, addressInfo, _request):
"""
:type sessionKey: str
:type addressInfo: message.common.publicmsg.SAddress
:type _request: message.gate.iuserinfo.IUserInfo_Updateadress_Request
"""
if not addressInfo.recipientName:
ErrorCodeManager.raiseError("ErrorGate_addressRecipentNameEmpty")
if not addressInfo.recipientPhoneNum:
ErrorCodeManager.raiseError("ErrorGate_addressRecipentPhoneNumEmpty")
if not addressInfo.city:
ErrorCodeManager.raiseError("ErrorGate_addressCityEmpty")
if not addressInfo.details:
ErrorCodeManager.raiseError("ErrorGate_addressDetailsEmpty")
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
addressIndex = userEntity.updateUserAddress(addressInfo)
DbSaver.saveTable(userEntity.getTUserAddress())
_request.response(addressIndex)
示例3: login
def login(self, loginInfo, _request):
"""
:type loginInfo: message.gate.gatemsg.SLogin
:type _request: message.gate.ilogin.ILogin_Login_Request
"""
Logger.log("ILoginImpl.login: ", loginInfo.account)
userEntity = UserEntityManager.findUserEntityByAccount(loginInfo.account)
if not userEntity:
ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")
if not userEntity.isPasswordValid(loginInfo.password):
ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")
if not userEntity.isDataLoaded():
userDataView = UserDbHelper.loadUserDataView(userEntity.getUserId())
userEntity.updateUserData(userDataView)
sessionKey = MyUuid.getUuid()
userEntity.updateDeviceCodeAndSessionKey(loginInfo.deviceCode, sessionKey)
UserEntityManager.onUserLogin(userEntity, _request.connId, loginInfo.deviceCode)
loginReturn = userEntity.getLoginReturn()
_request.response(loginReturn)
DbSaver.saveTable(userEntity.getTUserSettings())
DbSaver.saveTable(userEntity.getTUserBasic())
示例4: getFansByPageIndex
def getFansByPageIndex(self, sessionKey, pageIndex, _request):
"""
:type sessionKey: str
:type pageIndex: int
:type _request: message.gate.ipostoper.IPostOper_Getfansbypageindex_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
numPerPage = 100
tb = MongoDatabase.findTableByMessageType(TUserFan)
if not tb:
Logger.log("Table {} not found".format(TUserFan.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
skips = numPerPage * pageIndex
tFanList = tb.findManyWithQuey({TUserFan.fn_myUserId: userEntity.getUserId()},
limit=numPerPage, skip=skips, sort=MongoDatabase.SortByIdDesc)
sFanList = SeqMyFan()
for tFan in tFanList:
userEntity = UserEntityManager.findUserEntityByUserId(tFan.fanUserId)
if not userEntity:
Logger.log("getFansByPageIndex",
"UserNotFound:", tFan.fanUserId)
continue
sFan = SMyFan()
sFan.fanInfo = userEntity.getUserBriefInfo()
sFan.operDt = tFan.createDt
sFanList.append(sFan)
_request.response(sFanList)
示例5: getPostCommentsHints
def getPostCommentsHints(self, sessionKey, _request):
"""
:type sessionKey: str
:type _request: message.gate.ipostoper.IPostOper_Getpostcommentshints_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
hints = userEntity.getAllCommentHints()
_request.response(hints)
示例6: getAddressList
def getAddressList(self, sessionKey, _request):
"""
:type sessionKey: str
:type _request: message.gate.iuserinfo.IUserInfo_Getaddresslist_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
_request.response(userEntity.getTUserAddress().addressList)
示例7: getUserPostByPostId
def getUserPostByPostId(self, deviceCode, postId, imgFormat, _request):
"""
:type deviceCode: str
:type postId: str
:type _request: message.gate.ipostoper.IPostOper_Getuserpostbypostid_Request
"""
wPost = PostManager.findPostByPostId(postId)
if not wPost:
ErrorCodeManager.raiseError("ErrorGate_noSuchPost")
_request.response(wPost.getClientInfo(imgFormat))
示例8: getNewFanList
def getNewFanList(self, sessionKey, _request):
"""
:type sessionKey: str
:type _request: message.gate.ipostoper.IPostOper_Getnewfanlist_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
res = userEntity.getNewFans()
_request.response(res)
示例9: getMyDetails
def getMyDetails(self, sessionKey, _request):
"""
:type sessionKey: str
:type _request: message.gate.iuserinfo.IUserInfo_Getmydetails_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
details = userEntity.getDetails()
_request.response(details)
示例10: getSysTopicByTopicId
def getSysTopicByTopicId(self, deviceCode, topicId, imgFormat, _request):
"""
:type deviceCode: str
:type topicId: str
:type imgFormat: str
:type _request: message.gate.ipostoper.IPostOper_Getsystopicbytopicid_Request
"""
sysTopic = SysTopicManager.getSysTopicByTopicId(topicId)
if not sysTopic:
ErrorCodeManager.raiseError("ErrorGate_noSuchSysTopic")
_request.response(sysTopic.getClientInfo(imgFormat))
示例11: saveUserImages
def saveUserImages(self, userImages, _request):
"""
:type userImages: list[message.db.mongodb.usertables.TUserImage]
:type _request: message.db.itablesaver.ITableSaver_Saveuserimages_Request
"""
tb = MongoDatabase.findTableByMessageType(TUserImage)
if not tb:
Logger.log("Table {} not found".format(TUserImage.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
tb.save(userImages)
_request.response()
示例12: loadAllUserBasics
def loadAllUserBasics(cls):
"""
:rtype: list[TUserBasic]
"""
res = []
tb = MongoDatabase.findTableByMessageType(TUserBasic)
if not tb:
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
res = tb.findManyWithQuey()
return res
示例13: removeFamilyMembers
def removeFamilyMembers(cls, userId, indexes):
"""
:type userId: str
:type indexes: list[int]
"""
tb = MongoDatabase.findTableByMessageType(TFamilyMember)
if not tb:
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
for index in indexes:
query = {TFamilyMember.fn_userId: userId, TFamilyMember.fn_index: index}
tb.delete(query, True)
示例14: unfollowAUser
def unfollowAUser(self, sessionKey, userId, _request):
"""
:type sessionKey: str
:type userId: str
:type _request: message.gate.ipostoper.IPostOper_Unfollowauser_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
hisEntity = UserEntityManager.findUserEntityByUserId(userId)
if not hisEntity:
ErrorCodeManager.raiseError("ErrorGate_noSuchUser")
tb = MongoDatabase.findTableByMessageType(TUserFan)
if not tb:
Logger.log("Table {} not found".format(TUserFan.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
fanFound = tb.findOneWithQuery({TUserFan.fn_fanUserId: userEntity.getUserId(), TUserFan.fn_myUserId: userId})
if not fanFound:
ErrorCodeManager.raiseError("ErrorGate_didNotFollowThisUser")
tb.delete({TUserFan.fn_recordId: fanFound.recordId}, delete_one=True)
_request.response()
userEntity.getTUserProperty().focusNum -= 1
hisEntity.getTUserProperty().fanNum -= 1
DbSaver.saveTable(userEntity.getTUserProperty())
DbSaver.saveTable(hisEntity.getTUserProperty())
示例15: userImagesDidUpload
def userImagesDidUpload(self, imageKeys, _request):
"""
:type imageKeys: list[str]
:type _request: message.db.itablesaver.ITableSaver_Userimagesdidupload_Request
"""
tb = MongoDatabase.findTableByMessageType(TUserImage)
if not tb:
Logger.log("Table {} not found".format(TUserImage.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
for imgKey in imageKeys:
tb.updateWithQuery({tb.key: imgKey}, {"$set":{"isUploaded": True}}, upsert=False, update_one=True)
_request.response()