From 955ea4f8ce51129726cce82cd95afb281e543547 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 24 May 2013 19:22:32 +0200 Subject: [PATCH] BIO: Simplify the spaghetti code. --- webapp/backend/netboot.py | 5 ----- webapp/handlers_boot.py | 13 ++++++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/webapp/backend/netboot.py b/webapp/backend/netboot.py index 190ba270..eabd4dc8 100644 --- a/webapp/backend/netboot.py +++ b/webapp/backend/netboot.py @@ -52,11 +52,6 @@ class NetBoot(object): if m.type == "header": m.submenu = self.get_menu(m.submenu_level) - elif m.type == "config": - c = self.db.get("SELECT * FROM boot WHERE id = %s", m.item) - if c: - m._data.update(c) - menu.append(m) return menu diff --git a/webapp/handlers_boot.py b/webapp/handlers_boot.py index f56afb88..c1c4aed1 100644 --- a/webapp/handlers_boot.py +++ b/webapp/handlers_boot.py @@ -104,16 +104,15 @@ class MenuCfgHandler(BootBaseHandler): lines.append(ident + "menu end") elif entry.type == "config": - lines.append(ident + "label %d" % entry.id) - lines.append(ident + "\tmenu label %s" % entry.title) - if entry.description: + config = self.netboot.get_config(entry.item) + + lines.append(ident + "label %d" % config.id) + lines.append(ident + "\tmenu label %s" % config.title) + if config.description: lines.append(ident + "\ttext help") - lines.append(word_wrap(entry.description)) + lines.append(word_wrap(config.description)) lines.append(ident + "\tendtext") - config = self.netboot.get_config(entry.item) - if not config: return "" - lines.append(ident + "\tkernel %s" % config.image1) if config.image2: lines.append(ident + "\tinitrd %s" % config.image2) -- 2.47.3