From 908420937fa5409f9d8ceed7a7af53d0d240a162 Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 5 Oct 2015 20:20:22 +0000 Subject: [PATCH] system users improvement --- tildetown/app.py | 2 +- tildetown/stats.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tildetown/app.py b/tildetown/app.py index a4f8f2f..d1e3414 100644 --- a/tildetown/app.py +++ b/tildetown/app.py @@ -10,7 +10,7 @@ from pyhocon import ConfigFactory import requests from flask import Flask, render_template, request, redirect -from stats import get_data +from tildetown.stats import get_data ## disgusting hack for python 3.4.0 import pkgutil diff --git a/tildetown/stats.py b/tildetown/stats.py index ac79a30..7176f8f 100644 --- a/tildetown/stats.py +++ b/tildetown/stats.py @@ -4,12 +4,14 @@ from os import listdir from os.path import getmtime, join from datetime import datetime from sh import find, uptime, who, sort, wc, cut -from util import slurp, thread, p +from tildetown.util import slurp, thread, p # this script emits json on standard out that has information about tilde.town # users. It denotes who has not updated their page from the default. It also # reports the time this script was run. The user list is sorted by public_html update time. +SYSTEM_USERS = ['wiki', 'root', 'ubuntu', 'nate'] + DEFAULT_HTML = slurp("/etc/skel/public_html/index.html") username_to_html_path = lambda u: "/home/{}/public_html".format(u) @@ -43,7 +45,7 @@ def sort_user_list(usernames): return sorted(usernames, key=modify_time) def user_generator(): - ignore_system_users = lambda f: f != "ubuntu" and f != "poetry" + ignore_system_users = lambda un: un not in SYSTEM_USERS return filter(ignore_system_users, listdir("/home")) def get_user_data():