diff options
| author | Fabien Meghazi <fme@openerp.com> | 2014-01-30 13:46:06 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2014-01-30 13:46:06 +0100 |
| commit | d5031cbee897f8fe6fa111a3cfe4f6510aff9e92 (patch) | |
| tree | 2bcaad8bdb9d7415a22e544af8d9e17bca2dcd3e /addons/hw_proxy/controllers | |
| parent | 9ce7c7d561ba3f2aff9f2eafda1c8dffd05e8b1f (diff) | |
[ADD] POS: added cors argument to all routes
bzr revid: fme@openerp.com-20140130124606-wetmhcjqqvvkv5dy
Diffstat (limited to 'addons/hw_proxy/controllers')
| -rw-r--r-- | addons/hw_proxy/controllers/main.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index e6c19e322d6..5293abd1f25 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -41,7 +41,7 @@ class Proxy(http.Controller): def handshake(self): return True - @http.route('/hw_proxy/status', type='http', auth='none') + @http.route('/hw_proxy/status', type='http', auth='none', cors='*') def status_http(self): resp = '<html>\n<body>\n<h1>Hardware Proxy Status</h1>\n' statuses = self.get_status() @@ -70,39 +70,39 @@ class Proxy(http.Controller): 'Access-Control-Allow-Methods': 'GET', }) - @http.route('/hw_proxy/status_json', type='json', auth='none') + @http.route('/hw_proxy/status_json', type='json', auth='none', cors='*') def status_json(self): return self.get_status() - @http.route('/hw_proxy/scan_item_success', type='json', auth='none') + @http.route('/hw_proxy/scan_item_success', type='json', auth='none', cors='*') def scan_item_success(self, ean): """ A product has been scanned with success """ print 'scan_item_success: ' + str(ean) - @http.route('/hw_proxy/scan_item_error_unrecognized', type='json', auth='none') + @http.route('/hw_proxy/scan_item_error_unrecognized', type='json', auth='none', cors='*') def scan_item_error_unrecognized(self, ean): """ A product has been scanned without success """ print 'scan_item_error_unrecognized: ' + str(ean) - @http.route('/hw_proxy/help_needed', type='json', auth='none') + @http.route('/hw_proxy/help_needed', type='json', auth='none', cors='*') def help_needed(self): """ The user wants an help (ex: light is on) """ print "help_needed" - @http.route('/hw_proxy/help_canceled', type='json', auth='none') + @http.route('/hw_proxy/help_canceled', type='json', auth='none', cors='*') def help_canceled(self): """ The user stops the help request """ print "help_canceled" - @http.route('/hw_proxy/weighting_start', type='json', auth='none') + @http.route('/hw_proxy/weighting_start', type='json', auth='none', cors='*') def weighting_start(self): if self.scale == 'closed': print "Opening (Fake) Connection to Scale..." @@ -113,7 +113,7 @@ class Proxy(http.Controller): else: print "WARNING: Scale already Connected !!!" - @http.route('/hw_proxy/weighting_read_kg', type='json', auth='none') + @http.route('/hw_proxy/weighting_read_kg', type='json', auth='none', cors='*') def weighting_read_kg(self): if self.scale == 'open': print "Reading Scale..." @@ -125,7 +125,7 @@ class Proxy(http.Controller): print "WARNING: Reading closed scale !!!" return 0.0 - @http.route('/hw_proxy/weighting_end', type='json', auth='none') + @http.route('/hw_proxy/weighting_end', type='json', auth='none', cors='*') def weighting_end(self): if self.scale == 'open': print "Closing Connection to Scale ..." @@ -136,7 +136,7 @@ class Proxy(http.Controller): else: print "WARNING: Scale already Closed !!!" - @http.route('/hw_proxy/payment_request', type='json', auth='none') + @http.route('/hw_proxy/payment_request', type='json', auth='none', cors='*') def payment_request(self, price): """ The PoS will activate the method payment @@ -144,55 +144,55 @@ class Proxy(http.Controller): print "payment_request: price:"+str(price) return 'ok' - @http.route('/hw_proxy/payment_status', type='json', auth='none') + @http.route('/hw_proxy/payment_status', type='json', auth='none', cors='*') def payment_status(self): print "payment_status" return { 'status':'waiting' } - @http.route('/hw_proxy/payment_cancel', type='json', auth='none') + @http.route('/hw_proxy/payment_cancel', type='json', auth='none', cors='*') def payment_cancel(self): print "payment_cancel" - @http.route('/hw_proxy/transaction_start', type='json', auth='none') + @http.route('/hw_proxy/transaction_start', type='json', auth='none', cors='*') def transaction_start(self): print 'transaction_start' - @http.route('/hw_proxy/transaction_end', type='json', auth='none') + @http.route('/hw_proxy/transaction_end', type='json', auth='none', cors='*') def transaction_end(self): print 'transaction_end' - @http.route('/hw_proxy/cashier_mode_activated', type='json', auth='none') + @http.route('/hw_proxy/cashier_mode_activated', type='json', auth='none', cors='*') def cashier_mode_activated(self): print 'cashier_mode_activated' - @http.route('/hw_proxy/cashier_mode_deactivated', type='json', auth='none') + @http.route('/hw_proxy/cashier_mode_deactivated', type='json', auth='none', cors='*') def cashier_mode_deactivated(self): print 'cashier_mode_deactivated' - @http.route('/hw_proxy/open_cashbox', type='json', auth='none') + @http.route('/hw_proxy/open_cashbox', type='json', auth='none', cors='*') def open_cashbox(self): print 'open_cashbox' - @http.route('/hw_proxy/print_receipt', type='json', auth='none') + @http.route('/hw_proxy/print_receipt', type='json', auth='none', cors='*') def print_receipt(self, receipt): print 'print_receipt' + str(receipt) - @http.route('/hw_proxy/is_scanner_connected', type='json', auth='none') + @http.route('/hw_proxy/is_scanner_connected', type='json', auth='none', cors='*') def print_receipt(self, receipt): print 'is_scanner_connected?' return False - @http.route('/hw_proxy/scanner', type='json', auth='none') + @http.route('/hw_proxy/scanner', type='json', auth='none', cors='*') def print_receipt(self, receipt): print 'scanner' time.sleep(10) return '' - @http.route('/hw_proxy/log', type='json', auth='none') + @http.route('/hw_proxy/log', type='json', auth='none', cors='*') def log(self, arguments): _logger.info(' '.join(str(v) for v in arguments)) - @http.route('/hw_proxy/print_pdf_invoice', type='json', auth='none') + @http.route('/hw_proxy/print_pdf_invoice', type='json', auth='none', cors='*') def print_pdf_invoice(self, pdfinvoice): print 'print_pdf_invoice' + str(pdfinvoice) |
