Initial port to python3
[htsworkflow.git] / htsworkflow / frontend / inventory / views.py
index 265e1bc74f43d74d53957401a20d018c043ac170..226ef8a36674a2f65e12f1c05067fa1261811804 100644 (file)
@@ -19,7 +19,7 @@ register_search_plugin('Inventory Item', item_search)
 
 try:
     import json
-except ImportError, e:
+except ImportError as e:
     import simplejson as json
 
 INVENTORY_CONTEXT_DEFAULTS = {
@@ -88,7 +88,7 @@ def getPrinterTemplateByType(item_type):
             printer_template = PrinterTemplate.objects.get(default=True)
         except ObjectDoesNotExist:
             msg = "No template for item type (%s) and no default template found" % (item_type.name)
-            raise ValueError, msg
+            raise ValueError(msg)
 
         return printer_template
 
@@ -214,7 +214,7 @@ def item_summary_by_barcode(request, barcode_id, msg=''):
     """
     try:
         item = Item.objects.get(barcode_id=barcode_id)
-    except ObjectDoesNotExist, e:
+    except ObjectDoesNotExist as e:
         item = None
 
     return item_summary_by_uuid(request, None, msg, item)
@@ -229,7 +229,7 @@ def item_summary_by_uuid(request, uuid, msg='', item=None):
     if item is None:
         try:
             item = Item.objects.get(uuid=uuid)
-        except ObjectDoesNotExist, e:
+        except ObjectDoesNotExist as e:
             item = None
 
     context_dict = {
@@ -289,7 +289,7 @@ def item_print(request, uuid):
     """
     try:
         item = Item.objects.get(uuid=uuid)
-    except ObjectDoesNotExist, e:
+    except ObjectDoesNotExist as e:
         item = None
         msg = "Item with UUID %s does not exist" % (uuid)
 
@@ -314,7 +314,7 @@ def link_flowcell_and_device(request, flowcell, serial):
     # Retrieve Storage Device
     try:
         sd = Item.objects.get(barcode_id=serial)
-    except ObjectDoesNotExist, e:
+    except ObjectDoesNotExist as e:
         msg = "Item with barcode_id of %s not found." % (serial)
         raise ObjectDoesNotExist(msg)
 
@@ -322,7 +322,7 @@ def link_flowcell_and_device(request, flowcell, serial):
     # Retrieve FlowCell
     try:
         fc = FlowCell.objects.get(flowcell_id__startswith=flowcell)
-    except ObjectDoesNotExist, e:
+    except ObjectDoesNotExist as e:
         msg = "FlowCell with flowcell_id of %s not found." % (flowcell)
         raise ObjectDoesNotExist(msg)
 
@@ -332,7 +332,7 @@ def link_flowcell_and_device(request, flowcell, serial):
     lts = None
     if count > 1:
         msg = "There really should only be one longtermstorage object per flowcell"
-        raise ValueError, msg
+        raise ValueError(msg)
     elif count == 1:
         # lts already attached to flowcell
         lts = fc.longtermstorage_set.all()[0]