changeset 66:f1705e90695b

Don't allow to add a revision without tracking information
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 09 Oct 2014 09:48:05 +0200
parents 08a24e470de2
children 023080ffd995
files CHANGES farol/document.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Wed Oct 08 14:38:24 2014 +0200
+++ b/CHANGES	Thu Oct 09 09:48:05 2014 +0200
@@ -15,6 +15,7 @@
 * Implement three different kind of 'caching': disableds, global or
   session-based.
 * Add possibility to download the rendered document.
+* Add Description for each field on each edit/add page.
 * Various styling improvements.
 
 
--- a/farol/document.py	Wed Oct 08 14:38:24 2014 +0200
+++ b/farol/document.py	Thu Oct 09 09:48:05 2014 +0200
@@ -23,7 +23,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
 from flask import (Blueprint, render_template, abort, redirect, request,
-    url_for)
+    url_for, flash)
 
 from farolluz.parsers.cvrf import parseDate, parseVersion
 from farolluz.cvrf import (CVRFNote, CVRFReference, CVRFPublisher,
@@ -76,7 +76,7 @@
     tracking = get_current()._tracking
     if tracking is None:
         wasNone = True
-        tracking = CVRFTracking(CVRFTrackingID(''), 'Draft', (0,), utcnow(), utcnow())
+        tracking = CVRFTracking(CVRFTrackingID(''), 'Draft', (0,0), utcnow(), utcnow())
     generator = tracking._generator
     if not tracking._generator:
         generator = CVRFGenerator()
@@ -126,6 +126,9 @@
 def add_revision():
     tracking = get_current()._tracking
     if request.method != 'POST':
+        if tracking is None:
+            flash('The tracking information should be set first to be able to add a revision.', 'danger')
+            return redirect(url_for('.edit_tracking'))
         version = tracking._version
         version = version[:-1] + (version[-1] + 1,)
         return render_template('document/edit_revision.j2', number='.'.join("%d"%v for v in version), date=utcnow(), action='Add')

http://farol.wald.intevation.org