forked from shaba/openuds
Cleaning up things
This commit is contained in:
parent
5b5a4e31e7
commit
4f107ad464
@ -151,10 +151,10 @@ def getEvents(
|
|||||||
Returns:
|
Returns:
|
||||||
A generator, that contains pairs of (stamp, value) tuples
|
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)
|
since = kwargs.get('since', NEVER_UNIX)
|
||||||
to = kwargs.get('to', datetime.datetime.now())
|
to = kwargs.get('to', getSqlDatetimeAsUnix())
|
||||||
type_ = type(obj)
|
type_ = type(obj)
|
||||||
|
|
||||||
if kwargs.get('all', False):
|
if kwargs.get('all', False):
|
||||||
@ -165,7 +165,7 @@ def getEvents(
|
|||||||
for i in StatsManager.manager().getEvents(
|
for i in StatsManager.manager().getEvents(
|
||||||
__transDict[type_], eventType, owner_id=owner_id, since=since, to=to
|
__transDict[type_], eventType, owner_id=owner_id, since=since, to=to
|
||||||
):
|
):
|
||||||
val = (
|
yield (
|
||||||
datetime.datetime.fromtimestamp(i.stamp),
|
datetime.datetime.fromtimestamp(i.stamp),
|
||||||
i.fld1,
|
i.fld1,
|
||||||
i.fld2,
|
i.fld2,
|
||||||
@ -173,4 +173,3 @@ def getEvents(
|
|||||||
i.fld4,
|
i.fld4,
|
||||||
i.event_type,
|
i.event_type,
|
||||||
)
|
)
|
||||||
yield val
|
|
||||||
|
@ -52,11 +52,6 @@ logger = logging.getLogger(__name__)
|
|||||||
class ListReportUsers(ListReport):
|
class ListReportUsers(ListReport):
|
||||||
filename = 'users.pdf'
|
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(
|
authenticator = gui.ChoiceField(
|
||||||
label=_("Authenticator"),
|
label=_("Authenticator"),
|
||||||
order=1,
|
order=1,
|
||||||
@ -68,6 +63,11 @@ class ListReportUsers(ListReport):
|
|||||||
description = _('List users of platform') # Report description
|
description = _('List users of platform') # Report description
|
||||||
uuid = '8cd1cfa6-ed48-11e4-83e5-10feed05884b'
|
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:
|
def initGui(self) -> None:
|
||||||
logger.debug('Initializing gui')
|
logger.debug('Initializing gui')
|
||||||
vals = [gui.choiceItem(v.uuid, v.name) for v in Authenticator.objects.all()]
|
vals = [gui.choiceItem(v.uuid, v.name) for v in Authenticator.objects.all()]
|
||||||
@ -116,8 +116,6 @@ class ListReportsUsersCSV(ListReportUsers):
|
|||||||
for v in users:
|
for v in users:
|
||||||
writer.writerow([v.name, v.real_name, v.last_access])
|
writer.writerow([v.name, v.real_name, v.last_access])
|
||||||
|
|
||||||
# writer.writerow(['ñoño', 'ádios', 'hola'])
|
|
||||||
|
|
||||||
return output.getvalue().encode()
|
return output.getvalue().encode()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user