Exemplo n.º 1
0
def get_admin_A_all():
    "データベースに登録されたすべての回答データの一覧リスト"
    #query = Answer.query(ancestor=userlist_key()).order(Answer.owner, Answer.anum)
    query = Answer.query(ancestor=userlist_key())
    q = query.fetch()
    num = len(q)
    out = str(num) + "\n"
    for i in q:
        dt = gae_datetime_JST(i.date)
        out += "A%02d (%s) %s\n" % (i.anum, i.owner, dt)
    return out
Exemplo n.º 2
0
def log_get_or_delete(username=None, fetch_num=100, when=None, delete=False):
    query = Log.query(ancestor = log_key()).order(-Log.date)
    if username is not None:
        query = query.filter(Log.username == username)
    if when is not None:
        before = datetime.datetime.now() - when
        #print "before=", before
        query = query.filter(Log.date > before)
    q = query.fetch(fetch_num)
    results = []
    for i in q:
        if delete:
            tmp = { 'date': gae_datetime_JST(i.date) }
            i.key.delete()
        else:
            tmp = { 'date': gae_datetime_JST(i.date),
                    'username': i.username,
                    'what': i.what }
        results.append( tmp )
    return results
Exemplo n.º 3
0
def get_admin_Q_all():
    "データベースに登録されたすべての問題の一覧リスト"
    #query = Question.query().order(Question.author, Question.qnum)
    query = Question.query(ancestor=userlist_key()).order(Question.author, Question.qnum)
    q = query.fetch()
    num = len(q)
    out = str(num) + "\n"
    for i in q:
        dt = gae_datetime_JST(i.date)
        out += "Q%02d SIZE %dX%d LINE_NUM %d (%s) %s\n" % (i.qnum, i.cols, i.rows, i.linenum, i.author, dt)
    return out
Exemplo n.º 4
0
def log_get_or_delete(username=None, fetch_num=100, when=None, delete=False):
    query = Log.query(ancestor = log_key()).order(-Log.date)
    if username is not None:
        query = query.filter(Log.username == username)
    if when is not None:
        before = datetime.datetime.now() - when
        #print "before=", before
        query = query.filter(Log.date > before)
    q = query.fetch(fetch_num)
    results = []
    for i in q:
        if delete:
            tmp = { 'date': gae_datetime_JST(i.date) }
            i.key.delete()
        else:
            tmp = { 'date': gae_datetime_JST(i.date),
                    'username': i.username,
                    'what': i.what }
        results.append( tmp )
    return results
Exemplo n.º 5
0
def get_admin_A_all():
    "データベースに登録されたすべての回答データの一覧リスト"
    #query = Answer.query(ancestor=userlist_key()).order(Answer.owner, Answer.anum)
    query = Answer.query(ancestor=userlist_key())
    q = query.fetch()
    num = len(q)
    out = str(num) + "\n"
    for i in q:
        dt = gae_datetime_JST(i.date)
        out += "A%02d (%s) %s\n" % (i.anum, i.owner, dt)
    return out
Exemplo n.º 6
0
def get_admin_Q_all():
    "データベースに登録されたすべての問題の一覧リスト"
    #query = Question.query().order(Question.author, Question.qnum)
    query = Question.query(ancestor=userlist_key()).order(Question.author, Question.qnum)
    q = query.fetch()
    num = len(q)
    out = str(num) + "\n"
    for i in q:
        dt = gae_datetime_JST(i.date)
        out += "Q%02d SIZE %dX%d LINE_NUM %d (%s) %s\n" % (i.qnum, i.cols, i.rows, i.linenum, i.author, dt)
    return out