Refactor rate limiter and datetime formatting
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import getpass
|
||||
import logging
|
||||
|
||||
from . import datetime_str
|
||||
from .cleanup import cleanup_expired
|
||||
from .models import (
|
||||
DoesNotExist,
|
||||
@@ -27,7 +28,7 @@ def cmd_user_list(args, app):
|
||||
hostname_count = Hostname.select().where(
|
||||
Hostname.user == user
|
||||
).count()
|
||||
created_at = user.created_at.strftime("%Y-%m-%d %H:%M:%S")
|
||||
created_at = datetime_str(user.created_at)
|
||||
|
||||
print(
|
||||
f"{user.username:<20} {user.email:<30} "
|
||||
@@ -153,8 +154,8 @@ def cmd_hostname_list(args, app):
|
||||
)
|
||||
print("-" * 132)
|
||||
for h in hostnames:
|
||||
last_ipv4_update = h.last_ipv4_update.strftime("%Y-%m-%d %H:%M:%S") if h.last_ipv4_update else "Never"
|
||||
last_ipv6_update = h.last_ipv6_update.strftime("%Y-%m-%d %H:%M:%S") if h.last_ipv6_update else "Never"
|
||||
last_ipv4_update = datetime_str(h.last_ipv4_update) if h.last_ipv4_update else "Never"
|
||||
last_ipv6_update = datetime_str(h.last_ipv6_update) if h.last_ipv6_update else "Never"
|
||||
print(
|
||||
f"{h.hostname:<35} {h.user.username:<15} {h.zone:<20} "
|
||||
f"{h.dns_ttl:<8} {h.expiry_ttl:<8} {last_ipv4_update:<21} {last_ipv6_update}"
|
||||
|
||||
Reference in New Issue
Block a user