import random
import ftplib
+import socket
import StringIO
ftp.login()
ftp.storlines("STOR printme.txt", StringIO.StringIO(zpl_text))
ftp.quit()
-
+
+def print_zpl_socket(zpl_text):
+ """
+ Sends zpl_text to printer via a socket
+ """
+ s = socket.socket()
+ # PORT 9100 is default for Zebra tabletop/desktop printers
+ # PORT 6101 is default for Zebra mobile printers
+ s.connect((settings.PRINTER_HOST, settings.PRINTER_PORT))
+ s.sendall(zpl_text)
+ s.close()
def __center_line(line, width):
spaces_to_add = width - len(line)
s_obj = form.save(commit=False)
# Add sample ID
- s_obj.sampleid = get_sampleid()
+ #s_obj.sampleid = get_sampleid()
# If the user wants us to assign a container.
if form.cleaned_data['assign_container']: