예제 #1
0
def find_invalid_logs():
    for log in NodeLog.find(Q('action', 'eq', NodeLog.WIKI_DELETED)):
        # Derive UTC datetime object from ObjectId
        id_date = ObjectId(log._id).generation_time
        id_date = id_date.replace(tzinfo=None) - id_date.utcoffset()

        if id_date > log.date:
            yield log
예제 #2
0
def find_invalid_logs():
    for log in NodeLog.find(Q('action', 'eq', NodeLog.WIKI_DELETED)):
        # Derive UTC datetime object from ObjectId
        id_date = ObjectId(log._id).generation_time
        id_date = id_date.replace(tzinfo=None) - id_date.utcoffset()

        if id_date > log.date:
            yield log
예제 #3
0
def fix_invalid_log(log):
    new_dt = ObjectId(log._id).generation_time
    new_dt = new_dt.replace(tzinfo=None) - new_dt.utcoffset()
    NodeLog._fields['date'].__set__(
        log,
        new_dt,
        safe=False
    )
    log.save()
예제 #4
0
def fix_invalid_log(log):
    new_dt = ObjectId(log._id).generation_time
    new_dt = new_dt.replace(tzinfo=None) - new_dt.utcoffset()
    NodeLog._fields['date'].__set__(log, new_dt, safe=False)
    log.save()