X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=htsworkflow%2Ffrontend%2Fbcmagic%2Futils.py;h=ace241f4a748cbebe3aab4f98b56459f9fae8224;hb=d6c69167534965c0ae923eac2bd7c6d059d5537f;hp=6ffc99f8ee045a8a217c5be195386eee348deb84;hpb=0a3ba3b6bc269dfd15b9e336e640492b65add6cc;p=htsworkflow.git diff --git a/htsworkflow/frontend/bcmagic/utils.py b/htsworkflow/frontend/bcmagic/utils.py index 6ffc99f..ace241f 100644 --- a/htsworkflow/frontend/bcmagic/utils.py +++ b/htsworkflow/frontend/bcmagic/utils.py @@ -5,23 +5,30 @@ import socket import StringIO -def print_zpl(zpl_text, 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, 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: