From febd01ff03a27a8125a077356f57b1e9b47f0573 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Thu, 27 Sep 2018 09:20:50 +0200
Subject: [PATCH] [code][model] Improve handling of empty description

This ensure that the corresponding file is created even if
empty.
---
 beat/web/code/models.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/beat/web/code/models.py b/beat/web/code/models.py
index 5a5d3a1ea..2ff0f51e0 100755
--- a/beat/web/code/models.py
+++ b/beat/web/code/models.py
@@ -148,13 +148,15 @@ class CodeManager(StoredContributionManager):
             code_db.source_code = code
 
         # Check the provided description
-        if not(description):
+        if description is None:
             if previous_version is not None:
-                code_db.description = previous_version.description
+                description = previous_version.description
             elif fork_of is not None:
-                code_db.description = fork_of.description
-        else:
-            code_db.description = description
+                description = fork_of.description
+            else:
+                description = ''
+
+        code_db.description = description
 
         try:
             code_db.save()
-- 
GitLab