当前位置: 首页>>代码示例>>Python>>正文


Python ErrorCodeManager.ErrorCodeManager类代码示例

本文整理汇总了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)
开发者ID:bropony,项目名称:gamit,代码行数:32,代码来源:ipostoperimpl.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:27,代码来源:iuserinfoimpl.py

示例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())
开发者ID:bropony,项目名称:gamit,代码行数:28,代码来源:iloginimpl.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:35,代码来源:ipostoperimpl.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:11,代码来源:ipostoperimpl.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:11,代码来源:iuserinfoimpl.py

示例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))
开发者ID:bropony,项目名称:gamit,代码行数:11,代码来源:ipostoperimpl.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:11,代码来源:ipostoperimpl.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:11,代码来源:iuserinfoimpl.py

示例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))
开发者ID:bropony,项目名称:gamit,代码行数:12,代码来源:ipostoperimpl.py

示例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()
开发者ID:bropony,项目名称:gamit,代码行数:12,代码来源:itablesaverimpl.py

示例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
开发者ID:bropony,项目名称:gamit,代码行数:13,代码来源:userdb.py

示例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)
开发者ID:bropony,项目名称:gamit,代码行数:14,代码来源:userdb.py

示例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())
开发者ID:bropony,项目名称:gamit,代码行数:32,代码来源:ipostoperimpl.py

示例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()
开发者ID:bropony,项目名称:gamit,代码行数:14,代码来源:itablesaverimpl.py


注:本文中的staticdata.manager.ErrorCodeManager.ErrorCodeManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。