Bugzilla – Attachment 1120 Details for
Bug 8123
Cannot add printer if location name is empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch that enables adding printer if location name is empty
8123.patch (text/plain), 3.25 KB, created by
Samuel Mannehed
on 2023-04-19 16:51:27 CEST
(
hide
)
Description:
Patch that enables adding printer if location name is empty
Filename:
MIME Type:
Creator:
Samuel Mannehed
Created:
2023-04-19 16:51:27 CEST
Size:
3.25 KB
patch
obsolete
>diff --git a/tladm/modules/thinlinc/tlwebadm/locations.py b/tladm/modules/thinlinc/tlwebadm/locations.py >index ca53f5553..25829dfc9 100644 >--- a/tladm/modules/thinlinc/tlwebadm/locations.py >+++ b/tladm/modules/thinlinc/tlwebadm/locations.py >@@ -77,25 +77,26 @@ class WebAdminSection(WebAdminSectionBase): > ("", False, [])) > selected_location = newloc[0] > search_list['new_name'] = "New location" >+ search_list['new_location'] = True > elif selected_location and search_list['new_name']: > newloc = self.location_from_query(query) > # Rename? > if search_list['new_name'] != selected_location: > newloc = (selected_location, newloc[1]) >- >- if newloc: >- if newloc[0] not in locations: > search_list['new_location'] = True >+ elif selected_location and selected_location not in locations: >+ search_list['new_location'] = True >+ >+ if newloc: > locations[newloc[0]] = newloc[1] > >- # FIXME: One reason that selected_location is missing from locations is >- # that it is new, has empty new_name and has not been saved yet. Bug 8123. >- if selected_location is not None and selected_location in locations: >+ if selected_location is not None: > search_list["all_printers"] = self._get_current_printerlist() >- search_list["details"] = {'location': selected_location, >- 'description': locations[selected_location][0], >- 'unknown': locations[selected_location][1], >- 'printers': locations[selected_location][2]} >+ details = locations.get(selected_location, ["", False, []]) >+ search_list["details"] = { 'location': selected_location, >+ 'description': details[0], >+ 'unknown': details[1], >+ 'printers': details[2] } > > search_list['locations'] = sorted(self.dict_to_list(locations), > key = lambda t: locale.strxfrm(t[0])) >diff --git a/tladm/tests/test_locations.py b/tladm/tests/test_locations.py >index 72fc9ae69..e0135bc1e 100755 >--- a/tladm/tests/test_locations.py >+++ b/tladm/tests/test_locations.py >@@ -356,10 +356,14 @@ class LocationsTest(BaseTestClass): > detailed_location = {'description': '', 'location': '__new_entry_1234', > 'printers': [], 'unknown': False} > wanted_restult = {'add_printer': False, >- 'details': None, >+ 'all_printers': ['my_printer'], >+ 'details': {'description': '', >+ 'location': '__new_entry_1234', >+ 'printers': [], >+ 'unknown': False}, > 'errors': ['Location name is required.'], > 'locations': [], >- 'new_location': False, >+ 'new_location': True, > 'new_name': ''} > self.assertDictEqual(wanted_restult, result) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 8123
: 1120