convert to unicode_literals
[htsworkflow.git] / inventory / bcmagic.py
1 from __future__ import absolute_import, print_function, unicode_literals
2
3 from .models import Item
4
5 from django.core.exceptions import ObjectDoesNotExist
6
7
8 def item_search(search):
9     """
10     Searches
11     """
12     hits = []
13     try:
14         item = Item.objects.get(uuid=search)
15     except ObjectDoesNotExist:
16         item = None
17
18     if item is not None:
19         hits.append((str(item), item.get_absolute_url()))
20
21     try:
22         item = Item.objects.get(barcode_id=search)
23     except ObjectDoesNotExist:
24         item = None
25
26     if item is not None:
27         hits.append((str(item), item.get_absolute_url()))
28
29     return hits