Fixed a bug with wrong dates conversion

pull/232/head
Codelinefi-admin 2018-09-19 21:50:56 +03:00
parent b67aca09e5
commit c19989e217
1 changed files with 11 additions and 4 deletions

View File

@ -79,29 +79,36 @@ def handler(q=False):
misperrors['error'] = 'Unknown error' misperrors['error'] = 'Unknown error'
return misperrors return misperrors
date_created = \
response.block_details.date_created.strftime('%d %B %Y') if response.block_details.date_created else None
date_updated = \
response.block_details.date_updated.strftime('%d %B %Y') if response.block_details.date_updated else None
results = { results = {
'results': [ 'results': [
{'types': ['text'], 'values': {'types': ['text'], 'values':
{ {
# Mac address details
'Valid MAC address': "True" if response.mac_address_details.is_valid else "False", 'Valid MAC address': "True" if response.mac_address_details.is_valid else "False",
'Transmission type': response.mac_address_details.transmission_type, 'Transmission type': response.mac_address_details.transmission_type,
'Administration type': response.mac_address_details.administration_type, 'Administration type': response.mac_address_details.administration_type,
# Vendor details
'OUI': response.vendor_details.oui, 'OUI': response.vendor_details.oui,
'Vendor details are hidden': "True" if response.vendor_details.is_private else "False", 'Vendor details are hidden': "True" if response.vendor_details.is_private else "False",
'Company name': response.vendor_details.company_name, 'Company name': response.vendor_details.company_name,
'Company\'s address': response.vendor_details.company_address, 'Company\'s address': response.vendor_details.company_address,
'County code': response.vendor_details.country_code, 'County code': response.vendor_details.country_code,
# Block details
'Block found': "True" if response.block_details.block_found else "False", 'Block found': "True" if response.block_details.block_found else "False",
'The left border of the range': response.block_details.border_left, 'The left border of the range': response.block_details.border_left,
'The right border of the range': response.block_details.border_right, 'The right border of the range': response.block_details.border_right,
'The total number of MAC addresses in this range': response.block_details.block_size, 'The total number of MAC addresses in this range': response.block_details.block_size,
'Assignment block size': response.block_details.assignment_block_size, 'Assignment block size': response.block_details.assignment_block_size,
'Date when the range was allocated': response.block_details.date_created, 'Date when the range was allocated': date_created,
'Date when the range was last updated': response.block_details.date_updated 'Date when the range was last updated': date_updated
} }
} }
] ]