[FIX] hw_proxy: error when check status in debug mode
when access status hw_proxy in debug mode it's will raise error,
it's happens because hw_proxy uses subprocess module to get a list of usb
but the subprocess module not imported.
Introduced at 56456359
Closes #18820
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import commands
|
||||
import logging
|
||||
import time
|
||||
import subprocess
|
||||
from threading import Lock
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ BANNED_DEVICES = set([
|
||||
])
|
||||
|
||||
|
||||
# drivers modules must add to drivers an object with a get_status() method
|
||||
# drivers modules must add to drivers an object with a get_status() method
|
||||
# so that 'status' can return the status of all active drivers
|
||||
drivers = {}
|
||||
|
||||
@@ -107,7 +108,7 @@ class Proxy(http.Controller):
|
||||
if not (device_id in BANNED_DEVICES):
|
||||
resp+= "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n"
|
||||
count += 1
|
||||
|
||||
|
||||
if count == 0:
|
||||
resp += "<div class='device'>No USB Device Found</div>"
|
||||
|
||||
@@ -125,7 +126,7 @@ class Proxy(http.Controller):
|
||||
""" % subprocess.check_output('lsusb -v', shell=True)
|
||||
|
||||
return request.make_response(resp,{
|
||||
'Cache-Control': 'no-cache',
|
||||
'Cache-Control': 'no-cache',
|
||||
'Content-Type': 'text/html; charset=utf-8',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET',
|
||||
@@ -166,7 +167,7 @@ class Proxy(http.Controller):
|
||||
@http.route('/hw_proxy/payment_request', type='json', auth='none', cors='*')
|
||||
def payment_request(self, price):
|
||||
"""
|
||||
The PoS will activate the method payment
|
||||
The PoS will activate the method payment
|
||||
"""
|
||||
print "payment_request: price:"+str(price)
|
||||
return 'ok'
|
||||
@@ -174,7 +175,7 @@ class Proxy(http.Controller):
|
||||
@http.route('/hw_proxy/payment_status', type='json', auth='none', cors='*')
|
||||
def payment_status(self):
|
||||
print "payment_status"
|
||||
return { 'status':'waiting' }
|
||||
return { 'status':'waiting' }
|
||||
|
||||
@http.route('/hw_proxy/payment_cancel', type='json', auth='none', cors='*')
|
||||
def payment_cancel(self):
|
||||
@@ -206,12 +207,12 @@ class Proxy(http.Controller):
|
||||
|
||||
@http.route('/hw_proxy/is_scanner_connected', type='json', auth='none', cors='*')
|
||||
def is_scanner_connected(self, receipt):
|
||||
print 'is_scanner_connected?'
|
||||
print 'is_scanner_connected?'
|
||||
return False
|
||||
|
||||
@http.route('/hw_proxy/scanner', type='json', auth='none', cors='*')
|
||||
def scanner(self, receipt):
|
||||
print 'scanner'
|
||||
print 'scanner'
|
||||
time.sleep(10)
|
||||
return ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user