Example #1
0
def resolveGovPageError(page):
    m = govpageService().getOneByFilter(
        uha.TGovPageMember(),
        json.dumps({
            "pageId": page.id,
            "role": "creator",
            "isValid": {
                "$in": [True, False]
            }
        }))
    print m
    if m:
        page.creator = m.userId
        print govpageService().updateById(page)
Example #2
0
def getMembersByName(pageId, name):
        query = {}
        query["filter"] = {}
        query["filter"]["pageId"] = pageId
        query["limit"] = 1000
        query["offset"] = 0
       
        queryString = json.dumps(query)
        
        ms = govpageService().query(uha.TGovPageMember(), queryString)
        membersInfo = []
        
        for i in ms.result:
            d = objectToDict(i)
            u = userSerializer({"id": d["userId"]})
            if "name" not in u:
                continue
            d["name"] = u["name"]
            if d["name"] == name:
                membersInfo.append({
                    "name": d["name"],
                    "userId": d["userId"],
                    "memberId": d["id"]
                })
        if len(membersInfo) != 1:
            print "error", pageId, membersInfo
        return membersInfo
Example #3
0
def getPagesByName(name):
    query = {}
    query["filter"] = {}
    query["filter"]["name"] = name
    query["limit"] = 10
    query["offset"] = 0
    queryString = json.dumps(query)
    return govpageService().query(uha.TGovPage(), queryString).result
Example #4
0
def govPageWork():
    query = {
        "limit": 10,
        "filter": {
            "isValid": {
                "$in": [True, False]
            }
        },
        "sort": [{
            "id": -1
        }],
        "offset": 0
    }
    ret = govpageService().query(uha.TGovPage(), json.dumps(query))
    while (ret.offset < ret.total):
        for i in ret.result:
            generateGovpageData(i)
        query["offset"] += 10
        ret = govpageService().query(uha.TGovPage(), json.dumps(query))
Example #5
0
def govpageCreatorError():
    query = {
        "limit": 10,
        "sort": [{
            "id": -1
        }],
        "filter": {
            "creator": 0,
            "isValid": {
                "$in": [True, False]
            }
        },
        "offset": 0
    }
    ret = govpageService().query(uha.TGovPage(), json.dumps(query))
    while (ret.offset < ret.total):
        for i in ret.result:
            resolveGovPageError(i)
        query["offset"] += 10
        ret = govpageService().query(uha.TGovPage(), json.dumps(query))
Example #6
0
def actionWork():
    query = {
        "limit": 10,
        "filter": {
            "actionType": "govpage_publish_media"
        },
        "sort": [{
            "id": -1
        }],
        "offset": 0
    }
    ret = publishService().query(uha.TAction(), json.dumps(query))
    while (ret.offset < ret.total):
        for i in ret.result:
            if i.pageId == 0:
                m = govpageService().getById(uha.TGovPageMedia(), i.targetId)
                if m:
                    i.pageId = m.pageId
                    i = publishService().updateById(i)
                    print i
        query["offset"] += 10
        ret = userService().query(uha.TUser(), json.dumps(query))
Example #7
0
def exchangeGovPageCreator(pageId, targetUserId):
    govpageService().getById()