try:
                if exclusive and not has_lock:
                    has_lock = try_lock()
                if not exclusive or has_lock:
                    func()
            except Exception, e:
                tell_sentry(e)
                log_dammit(traceback.format_exc().strip())
            sleep(period)

    t = threading.Thread(target=f)
    t.daemon = True
    t.start()


cron(env.update_global_stats_every, lambda: utils.update_global_stats(website))
cron(env.check_db_every, website.db.self_check, True)


# Website Algorithm
# =================


def add_stuff_to_context(request):
    request.context["username"] = None

    # Helpers for global call to action to support Gratipay itself.
    user = request.context.get("user")
    p = user.participant if user else None
    if p and p.is_free_rider is None:
        usage = p.usage
示例#2
0
            try:
                if exclusive and not has_lock:
                    has_lock = try_lock()
                if not exclusive or has_lock:
                    func()
            except Exception, e:
                tell_sentry(e)
                log_dammit(traceback.format_exc().strip())
            sleep(period)

    t = threading.Thread(target=f)
    t.daemon = True
    t.start()


cron(env.update_global_stats_every, lambda: utils.update_global_stats(website))
cron(env.check_db_every, website.db.self_check, True)

# Website Algorithm
# =================


def add_stuff_to_context(request):
    request.context['username'] = None

    def filter_profile_subnav(user, participant, pages):
        out = []
        for foo, bar, show_them, show_others in pages:
            if (user.participant == participant and show_them) \
            or (user.participant is None and show_others)       \
            or (user.participant != participant and show_others) \