diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-08-17 00:05:23 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-08-17 00:05:23 +0300 |
commit | 8565e4dc0b7acd16078700c03031beca8d26be77 (patch) | |
tree | 014035d543dfa8de7d9b1c9407daf54a89ac4f67 /servo/views | |
parent | 424bfdb617003dc8cddc4c10afb64583824341db (diff) | |
download | Servo-8565e4dc0b7acd16078700c03031beca8d26be77.tar.gz Servo-8565e4dc0b7acd16078700c03031beca8d26be77.tar.bz2 Servo-8565e4dc0b7acd16078700c03031beca8d26be77.zip |
Misc fixes
Diffstat (limited to 'servo/views')
-rw-r--r-- | servo/views/device.py | 8 | ||||
-rw-r--r-- | servo/views/gsx.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/servo/views/device.py b/servo/views/device.py index f35bd99..0d517f9 100644 --- a/servo/views/device.py +++ b/servo/views/device.py @@ -292,7 +292,7 @@ def get_gsx_search_results(request, what, param, query): except Exception: try: device = Device.from_gsx(query) - except Exception, e: + except Exception as e: return render(request, error_template, {'message': e}) results.append(device) @@ -356,7 +356,7 @@ def get_gsx_search_results(request, what, param, query): repair = gsxws.Repair(number=query) try: results = repair.lookup() - except gsxws.GsxError, message: + except gsxws.GsxError as message: return render(request, error_template, locals()) return render(request, "devices/search_gsx_%s.html" % what, locals()) @@ -375,7 +375,7 @@ def search_gsx(request, what, param, query): GsxAccount.default(user=request.user) else: act.connect(request.user) - except gsxws.GsxError, message: + except gsxws.GsxError as message: return render(request, "devices/search_gsx_error.html", locals()) if request.is_ajax(): @@ -384,7 +384,7 @@ def search_gsx(request, what, param, query): dev = Device.from_gsx(query) products = dev.get_parts() return render(request, "devices/parts.html", locals()) - except gsxws.GsxError, message: + except gsxws.GsxError as message: return render(request, "search/results/gsx_error.html", locals()) return get_gsx_search_results(request, what, param, query) diff --git a/servo/views/gsx.py b/servo/views/gsx.py index 59030c9..1e20354 100644 --- a/servo/views/gsx.py +++ b/servo/views/gsx.py @@ -295,7 +295,7 @@ def create_repair(request, order_id, device_id, type): from django.utils import timezone order = get_object_or_404(Order, pk=order_id) - device = get_object_or_404(Device, pk=device_id) + device = order.devices.get(pk=device_id) repair = Repair(order=order, created_by=request.user, device=device) timediff = timezone.now() - order.created_at |