Skip to content
Snippets Groups Projects
Commit 3aeae5cb authored by Robert Latta's avatar Robert Latta
Browse files

reinstated old method and added possible replacement commented out for discussion

parent 461eb0b2
No related branches found
No related tags found
No related merge requests found
...@@ -54,36 +54,37 @@ def _locations_from_router(router_name): ...@@ -54,36 +54,37 @@ def _locations_from_router(router_name):
# todo - see if Erik is happy for this to # todo - see if Erik is happy for this to
# just make a call to _location_from_router # just make a call to _location_from_router, will need to make sure that
# all equipment is exported and change the name to loaction_from_equipment
def _location_from_service_dict(s): def _location_from_service_dict(s):
loc = _locations_from_router(s['equipment']) # loc = _locations_from_router(s['equipment'])
location = {
'a': _LOCATION(
equipment=loc['a']['equipment'],
name=loc['a']['pop_name'],
abbreviation=loc['a']['pop_abbreviation'])
}
if 'other_end_equipment' in s:
loc = _locations_from_router(s['other_end_equipment'])
location['b'] = _LOCATION(
equipment=loc['a']['equipment'],
name=loc['a']['pop_name'],
abbreviation=loc['a']['abbreviation'])
# location = { # location = {
# 'a': _LOCATION( # 'a': _LOCATION(
# equipment=s['equipment'], # equipment=loc['a']['equipment'],
# name=s['pop_name'], # name=loc['a']['pop_name'],
# abbreviation=s['pop_abbreviation']) # abbreviation=loc['a']['pop_abbreviation'])
# } # }
# # if 'other_end_equipment' in s:
# if all(s[n] for n in ( # loc = _locations_from_router(s['other_end_equipment'])
# 'other_end_equipment',
# 'other_end_pop_name',
# 'other_end_pop_abbreviation')):
# location['b'] = _LOCATION( # location['b'] = _LOCATION(
# equipment=s['other_end_equipment'], # equipment=loc['a']['equipment'],
# name=s['other_end_pop_name'], # name=loc['a']['pop_name'],
# abbreviation=s['other_end_pop_abbreviation']) # abbreviation=loc['a']['abbreviation'])
location = {
'a': _LOCATION(
equipment=s['equipment'],
name=s['pop_name'],
abbreviation=s['pop_abbreviation'])
}
if all(s[n] for n in (
'other_end_equipment',
'other_end_pop_name',
'other_end_pop_abbreviation')):
location['b'] = _LOCATION(
equipment=s['other_end_equipment'],
name=s['other_end_pop_name'],
abbreviation=s['other_end_pop_abbreviation'])
return location return location
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment