1 from htsworkflow.frontend import settings
8 def print_zpl(zpl_text, host=settings.BCPRINTER_PRINTER1_HOST):
10 Sends zpl_text to printer
12 ftp = ftplib.FTP(host=host, user='blank', passwd='')
14 ftp.storlines("STOR printme.txt", StringIO.StringIO(zpl_text))
18 def print_zpl_socket(zpl_text, host=settings.BCPRINTER_PRINTER1_HOST, port=settings.BCPRINTER_PRINTER1_PORT):
20 Sends zpl_text to printer via a socket
23 # PORT 9100 is default for Zebra tabletop/desktop printers
24 # PORT 6101 is default for Zebra mobile printers
25 s.connect((host, port))
29 def report_error(message):
31 Return a dictionary with a command to display 'message'
33 return {'mode': 'Error', 'status': message}
36 def redirect_to_url(url):
38 Return a bcm dictionary with a command to redirect to 'url'
40 return {'mode': 'redirect', 'url': url}
43 def autofill(field, value):
45 Return a bcm dictionary with a command to automatically fill the
46 corresponding "field" with "value"
48 return {'mode': 'autofill', 'field': field, 'value': value}