Lines 77-101
class WebAdminSection(WebAdminSectionBase):
Link Here
|
77 |
("", False, [])) |
77 |
("", False, [])) |
78 |
selected_location = newloc[0] |
78 |
selected_location = newloc[0] |
79 |
search_list['new_name'] = "New location" |
79 |
search_list['new_name'] = "New location" |
|
|
80 |
search_list['new_location'] = True |
80 |
elif selected_location and search_list['new_name']: |
81 |
elif selected_location and search_list['new_name']: |
81 |
newloc = self.location_from_query(query) |
82 |
newloc = self.location_from_query(query) |
82 |
# Rename? |
83 |
# Rename? |
83 |
if search_list['new_name'] != selected_location: |
84 |
if search_list['new_name'] != selected_location: |
84 |
newloc = (selected_location, newloc[1]) |
85 |
newloc = (selected_location, newloc[1]) |
85 |
|
|
|
86 |
if newloc: |
87 |
if newloc[0] not in locations: |
88 |
search_list['new_location'] = True |
86 |
search_list['new_location'] = True |
|
|
87 |
elif selected_location and selected_location not in locations: |
88 |
search_list['new_location'] = True |
89 |
|
90 |
if newloc: |
89 |
locations[newloc[0]] = newloc[1] |
91 |
locations[newloc[0]] = newloc[1] |
90 |
|
92 |
|
91 |
# FIXME: One reason that selected_location is missing from locations is |
93 |
if selected_location is not None: |
92 |
# that it is new, has empty new_name and has not been saved yet. Bug 8123. |
|
|
93 |
if selected_location is not None and selected_location in locations: |
94 |
search_list["all_printers"] = self._get_current_printerlist() |
94 |
search_list["all_printers"] = self._get_current_printerlist() |
95 |
search_list["details"] = {'location': selected_location, |
95 |
details = locations.get(selected_location, ["", False, []]) |
96 |
'description': locations[selected_location][0], |
96 |
search_list["details"] = { 'location': selected_location, |
97 |
'unknown': locations[selected_location][1], |
97 |
'description': details[0], |
98 |
'printers': locations[selected_location][2]} |
98 |
'unknown': details[1], |
|
|
99 |
'printers': details[2] } |
99 |
|
100 |
|
100 |
search_list['locations'] = sorted(self.dict_to_list(locations), |
101 |
search_list['locations'] = sorted(self.dict_to_list(locations), |
101 |
key = lambda t: locale.strxfrm(t[0])) |
102 |
key = lambda t: locale.strxfrm(t[0])) |