From 221137865155df3ab1626c301b72a27d5beff91a Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 1 Dec 2019 21:04:36 +0100 Subject: [PATCH] fixed barcode generators --- screenless/bureau/ihr/ihr.py | 2 +- screenless/bureau/mailroom/mailroom.py | 12 ++++++------ screenless/bureau/publications/publications.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/screenless/bureau/ihr/ihr.py b/screenless/bureau/ihr/ihr.py index 89b69d1..5e4351a 100644 --- a/screenless/bureau/ihr/ihr.py +++ b/screenless/bureau/ihr/ihr.py @@ -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 diff --git a/screenless/bureau/mailroom/mailroom.py b/screenless/bureau/mailroom/mailroom.py index dce7d8d..feda675 100644 --- a/screenless/bureau/mailroom/mailroom.py +++ b/screenless/bureau/mailroom/mailroom.py @@ -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) diff --git a/screenless/bureau/publications/publications.py b/screenless/bureau/publications/publications.py index 99d068a..5b1896c 100644 --- a/screenless/bureau/publications/publications.py +++ b/screenless/bureau/publications/publications.py @@ -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 = '' % encoded_data