Remove iteritems() calls
This commit is contained in:
parent
ebb2fb6c1c
commit
d318861399
3 changed files with 6 additions and 6 deletions
|
|
@ -155,9 +155,9 @@ class AuditedServerSession(ServerSession):
|
||||||
|
|
||||||
# Remove any keys with blank values
|
# Remove any keys with blank values
|
||||||
if AUDIT_ALLOW_SPARSE is False:
|
if AUDIT_ALLOW_SPARSE is False:
|
||||||
log['data'] = {k: v for k, v in log['data'].iteritems() if v}
|
log['data'] = {k: v for k, v in log['data'].items() if v}
|
||||||
log['objects'] = {k: v for k, v in log['objects'].iteritems() if v}
|
log['objects'] = {k: v for k, v in log['objects'].items() if v}
|
||||||
log = {k: v for k, v in log.iteritems() if v}
|
log = {k: v for k, v in log.items() if v}
|
||||||
|
|
||||||
return log
|
return log
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ class AuditedServerSession(ServerSession):
|
||||||
is_embedded = True
|
is_embedded = True
|
||||||
|
|
||||||
for mask in AUDIT_MASKS:
|
for mask in AUDIT_MASKS:
|
||||||
for command, regex in mask.iteritems():
|
for command, regex in mask.items():
|
||||||
try:
|
try:
|
||||||
match = re.match(regex, msg, flags=re.IGNORECASE)
|
match = re.match(regex, msg, flags=re.IGNORECASE)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class AuditingTest(EvenniaTest):
|
||||||
parsed from the Session object.
|
parsed from the Session object.
|
||||||
"""
|
"""
|
||||||
log = self.session.audit(src='client', text=[['hello']])
|
log = self.session.audit(src='client', text=[['hello']])
|
||||||
obj = {k:v for k,v in log.iteritems() if k in ('direction', 'protocol', 'application', 'text')}
|
obj = {k:v for k,v in log.items() if k in ('direction', 'protocol', 'application', 'text')}
|
||||||
self.assertEqual(obj, {
|
self.assertEqual(obj, {
|
||||||
'direction': 'RCV',
|
'direction': 'RCV',
|
||||||
'protocol': 'telnet',
|
'protocol': 'telnet',
|
||||||
|
|
|
||||||
|
|
@ -1505,7 +1505,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
if users or things:
|
if users or things:
|
||||||
# handle pluralization of things (never pluralize users)
|
# handle pluralization of things (never pluralize users)
|
||||||
thing_strings = []
|
thing_strings = []
|
||||||
for key, itemlist in sorted(things.iteritems()):
|
for key, itemlist in sorted(things.items()):
|
||||||
nitem = len(itemlist)
|
nitem = len(itemlist)
|
||||||
if nitem == 1:
|
if nitem == 1:
|
||||||
key, _ = itemlist[0].get_numbered_name(nitem, looker, key=key)
|
key, _ = itemlist[0].get_numbered_name(nitem, looker, key=key)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue