fixed barcode generators

workspace
Brendan Howell 5 years ago
parent def8c6c16b
commit 2211378651

@ -74,7 +74,7 @@ class InhumanResources(Bureau):
cmd_code = prefix + cmd + "."
# barcode = clean_svg(code128.svg(prefix + cmd + "."))
barcode_png = os.path.join(self.datadir, cmd_code)
bc = barcode.generate("code128", prefix + cmd + ".", writer=barcode.writer.ImageWriter, output=barcode_png)
bc = barcode.generate("code128", prefix + cmd + ".", writer=barcode.writer.ImageWriter(), output=barcode_png)
except KeyError as e:
print("cannot add invalid command:", str(e))
return

@ -171,22 +171,22 @@ class MailRoom(Bureau):
# make action barcodes
msg.un_bc = os.path.join("/tmp", "POun." + shortcode + ".png")
barcode.generate("code128", "POun." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.un_bc)
writer=barcode.writer.ImageWriter(), output=msg.un_bc)
msg.d_bc = os.path.join("/tmp", "POd." + shortcode + ".png")
barcode.generate("code128", "POd." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.d_bc)
writer=barcode.writer.ImageWriter(), output=msg.d_bc)
msg.sp_bc = os.path.join("/tmp", "POsp." + shortcode + ".png")
barcode.generate("code128", "POsp." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.sp_bc)
writer=barcode.writer.ImageWriter(), output=msg.sp_bc)
msg.re_bc = os.path.join("/tmp", "POre." + shortcode + ".png")
barcode.generate("code128", "POre." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.re_bc)
writer=barcode.writer.ImageWriter(), output=msg.re_bc)
msg.rea_bc = os.path.join("/tmp", "POrea." + shortcode + ".png")
barcode.generate("code128", "POrea." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.rea_bc)
writer=barcode.writer.ImageWriter(), output=msg.rea_bc)
msg.r_bc = os.path.join("/tmp", "POr." + shortcode + ".png")
barcode.generate("code128", "POr." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.r_bc)
writer=barcode.writer.ImageWriter(), output=msg.r_bc)
self.print_full("email.html", msg=msg, shortcode=shortcode)

@ -276,7 +276,7 @@ class Publications(Bureau):
entry.source = feed.feed.title
entry.dbhash = self._make_shorturl(entry.link)
entry.svg = barcode.get("CODE128", "PBr." + tmpcode).raw
entry.svg = barcode.get("CODE128", "PBr." + entry.dbhash).raw
encoded_svg = b64encode(entry.svg).decode()
encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg
entry.svg = '<img src="%s"/>' % encoded_data

Loading…
Cancel
Save