diff farol/producttree.py @ 85:b6a48669edb8

Don't create a branch only to have empty name
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 09 Oct 2014 14:50:05 +0200
parents cc836f9e869e
children 2d41121ec991
line wrap: on
line diff
--- a/farol/producttree.py	Thu Oct 09 14:26:59 2014 +0200
+++ b/farol/producttree.py	Thu Oct 09 14:50:05 2014 +0200
@@ -69,7 +69,9 @@
     except (ValueError, IndexError): abort(404)
     if request.method != 'POST':
         branches = [('', '')] + [(b.getName(), b.getPath(True)) for b in ptree.getNotTerminalBranches(branch)]
-        return render_template('producttree/edit_branch.j2', branch=branch, branches=branches, types=branch.TYPES)
+        return render_template('producttree/edit_branch.j2',
+                               _type=branch._type, name=branch._name, parentpath=branch.getParentPath(),
+                               branches=branches, types=branch.TYPES)
 
     pbranch = ptree
     if request.form['parent']:
@@ -95,7 +97,9 @@
     ptree = cvrf._producttree
     if request.method != 'POST':
         branches = [('', '')] + [(b.getName(), b.getPath(True)) for b in ptree.getNotTerminalBranches()]
-        return render_template('producttree/edit_branch.j2', branch=CVRFProductBranch('', '', ptree), action='Add', branches=branches, types=CVRFProductBranch.TYPES)
+        return render_template('producttree/edit_branch.j2',
+                               action='Add',
+                               branches=branches, types=CVRFProductBranch.TYPES)
 
     pbranch = ptree
     if request.form['parent']:

http://farol.wald.intevation.org