From ce74a1b13f9f379f8c0704d1e283851b6790aa14 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 17 Jun 2009 19:09:50 +0000 Subject: [PATCH] Add stub uuid function to make this module import when running under python2.4 --- htsworkflow/frontend/inventory/models.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htsworkflow/frontend/inventory/models.py b/htsworkflow/frontend/inventory/models.py index 8f54fc3..5926107 100644 --- a/htsworkflow/frontend/inventory/models.py +++ b/htsworkflow/frontend/inventory/models.py @@ -1,3 +1,5 @@ +import logging + from django.db import models from django.db.models.signals import pre_save @@ -5,7 +7,16 @@ from htsworkflow.frontend.samples.models import Library from htsworkflow.frontend.experiments.models import FlowCell -import uuid +try: + import uuid +except ImportError, e: + # Some systems are using python 2.4, which doesn't have uuid + # this is a stub + logging.warning('Real uuid is not available, initializing fake uuid module') + class uuid: + def uuid1(self): + self.hex = None + return self def _assign_uuid(sender, instance, **kwargs): """ @@ -123,4 +134,5 @@ class LongTermStorage(models.Model): storage_devices = models.ManyToManyField(Item) def __unicode__(self): - return u"%s: %s" % (str(self.flowcell), ', '.join([ str(s) for s in self.storage_devices.iterator() ])) \ No newline at end of file + return u"%s: %s" % (str(self.flowcell), ', '.join([ str(s) for s in self.storage_devices.iterator() ])) + -- 2.30.2