Esempio n. 1
0
def puzzle_list(context, puzzles, user, with_new_link=False):
    req = context["request"]
    limit = None
    if req.method == "GET" and "limit" in req.GET:
        try:
            limit = int(req.GET["limit"])
        except ValueError:
            limit = 50

    return {
        "limit":
        limit,
        "puzzles":
        make_puzzle_data(puzzles, user, do_query_filter_in=req.path != "/all"),
        "new_puzzle_link":
        False,
        "dead_status":
        status.DEAD,
        "deferred_status":
        status.DEFERRED,
        "past_needs_solution_statuses": [
            st["value"] for st in status.ALL_STATUSES
            if status.get_status_rank(st["value"]) > status.get_status_rank(
                status.NEEDS_SOLUTION)
        ],
        "random_id":
        "%016x" % random.randrange(16**16),
    }
Esempio n. 2
0
 def get_status_rank(self):
     return status.get_status_rank(self.status)