From d6c69167534965c0ae923eac2bd7c6d059d5537f Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Tue, 17 Dec 2013 11:05:00 -0800 Subject: [PATCH] Move use of settings default into the function instead of function definition. This is because the if its not defined the program wont start up. --- htsworkflow/frontend/bcmagic/utils.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htsworkflow/frontend/bcmagic/utils.py b/htsworkflow/frontend/bcmagic/utils.py index 5acc6dd..ace241f 100644 --- a/htsworkflow/frontend/bcmagic/utils.py +++ b/htsworkflow/frontend/bcmagic/utils.py @@ -5,25 +5,30 @@ import socket import StringIO -def print_zpl(zpl_text, host=settings.BCPRINTER_PRINTER1_HOST): +def print_zpl(zpl_text, host=None): """ Sends zpl_text to printer """ + if not host: + host = settings.BCPRINTER_PRINTER1_HOST ftp = ftplib.FTP(host=host, user='blank', passwd='') ftp.login() ftp.storlines("STOR printme.txt", StringIO.StringIO(zpl_text)) ftp.quit() -def print_zpl_socket(zpl_text, - host=settings.BCPRINTER_PRINTER1_HOST, - port=settings.BCPRINTER_PRINTER1_PORT): +def print_zpl_socket(zpl_text, host=None, port=None): """ Sends zpl_text to printer via a socket if zpl_text is a list of zpl_texts, it will print each one in that list. """ + + if not host: + host=settings.BCPRINTER_PRINTER1_HOST + if not port: + port=settings.BCPRINTER_PRINTER1_PORT # Process anyway if zpl_text is a list. if type(zpl_text) is list: -- 2.30.2