1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-24 21:34:41 +03:00

Cleaning up things

This commit is contained in:
Adolfo Gómez García 2021-10-27 16:27:03 +02:00
parent 5b5a4e31e7
commit 4f107ad464
2 changed files with 9 additions and 12 deletions

View File

@ -151,10 +151,10 @@ def getEvents(
Returns:
A generator, that contains pairs of (stamp, value) tuples
"""
from uds.models import NEVER
from uds.models import NEVER_UNIX, getSqlDatetimeAsUnix
since = kwargs.get('since', NEVER)
to = kwargs.get('to', datetime.datetime.now())
since = kwargs.get('since', NEVER_UNIX)
to = kwargs.get('to', getSqlDatetimeAsUnix())
type_ = type(obj)
if kwargs.get('all', False):
@ -165,7 +165,7 @@ def getEvents(
for i in StatsManager.manager().getEvents(
__transDict[type_], eventType, owner_id=owner_id, since=since, to=to
):
val = (
yield (
datetime.datetime.fromtimestamp(i.stamp),
i.fld1,
i.fld2,
@ -173,4 +173,3 @@ def getEvents(
i.fld4,
i.event_type,
)
yield val

View File

@ -52,11 +52,6 @@ logger = logging.getLogger(__name__)
class ListReportUsers(ListReport):
filename = 'users.pdf'
def initialize(self, values):
if values:
auth = Authenticator.objects.get(uuid=self.authenticator.value)
self.filename = auth.name + '.pdf'
authenticator = gui.ChoiceField(
label=_("Authenticator"),
order=1,
@ -68,6 +63,11 @@ class ListReportUsers(ListReport):
description = _('List users of platform') # Report description
uuid = '8cd1cfa6-ed48-11e4-83e5-10feed05884b'
def initialize(self, values):
if values:
auth = Authenticator.objects.get(uuid=self.authenticator.value)
self.filename = auth.name + '.pdf'
def initGui(self) -> None:
logger.debug('Initializing gui')
vals = [gui.choiceItem(v.uuid, v.name) for v in Authenticator.objects.all()]
@ -116,8 +116,6 @@ class ListReportsUsersCSV(ListReportUsers):
for v in users:
writer.writerow([v.name, v.real_name, v.last_access])
# writer.writerow(['ñoño', 'ádios', 'hola'])
return output.getvalue().encode()