]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/utils.py
[views] Don't create bundles with no name
[patchwork] / apps / patchwork / utils.py
index 5bd6925b6bf0065ee2beaf30b60f354c2d4de5c0..3737e8923abe2f98af783ff36adaabf738d471a1 100644 (file)
@@ -97,8 +97,12 @@ def set_bundle(user, project, action, data, patches, context):
     # set up the bundle
     bundle = None
     if action == 'create':
+        bundle_name = data['bundle_name'].strip()
+        if not bundle_name:
+            return ['No bundle name was specified']
+
         bundle = Bundle(owner = user, project = project,
-                name = data['bundle_name'])
+                name = bundle_name)
         bundle.save()
         context.add_message("Bundle %s created" % bundle.name)