gnucash maint: Multiple changes pushed

Frank H.Ellenberger fell at code.gnucash.org
Wed Aug 4 14:52:23 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/b31b8dbd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5f721614 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3ed6b4da (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ba4852a9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ad3895fa (commit)
	from  https://github.com/Gnucash/gnucash/commit/a5edacf0 (commit)



commit b31b8dbd1eaf461f4471fcfa055562b6566d3511
Merge: a5edacf0f 5f721614a
Author: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>
Date:   Wed Aug 4 20:15:39 2021 +0200

    Merge PR #1103 into maint


commit 5f721614ad08ee10d1f102382cb4fd252dfbf99b
Author: Steven Walter <stevenrwalter at gmail.com>
Date:   Sun Aug 1 22:29:00 2021 -0400

    Remove unneeded .decode() from Invoice*.tex.templ
    
    These values are already str's, don't decode them

diff --git a/bindings/python/example_scripts/Invoice.tex.tmpl b/bindings/python/example_scripts/Invoice.tex.tmpl
index a5248cca9..a16b03743 100644
--- a/bindings/python/example_scripts/Invoice.tex.tmpl
+++ b/bindings/python/example_scripts/Invoice.tex.tmpl
@@ -130,13 +130,13 @@
 \Euro
 %---------------------------------------------------------------------------
 \begin{letter}{% {% endraw %}
-{{ invoice.GetOwner().GetName().decode("UTF-8") }} \\ 
-{{ invoice.GetOwner().GetAddr().GetAddr1().decode("UTF-8") }} \\ 
-{{ invoice.GetOwner().GetAddr().GetAddr2().decode("UTF-8") }} \\ 
-{{ invoice.GetOwner().GetAddr().GetAddr3().decode("UTF-8") }} 
+{{ invoice.GetOwner().GetName() }} \\ 
+{{ invoice.GetOwner().GetAddr().GetAddr1() }} \\ 
+{{ invoice.GetOwner().GetAddr().GetAddr2() }} \\ 
+{{ invoice.GetOwner().GetAddr().GetAddr3() }} 
 {# if Addr4 is declared put a linebreak here #}
 {% if invoice.GetOwner().GetAddr().GetAddr4() %} \\ {% endif %} 
-{{ invoice.GetOwner().GetAddr().GetAddr4().decode("UTF-8") }} {% raw %}
+{{ invoice.GetOwner().GetAddr().GetAddr4() }} {% raw %}
 }
 %---------------------------------------------------------------------------
 % Weitere Optionen
@@ -156,7 +156,7 @@ Ich erlaube mir, Ihnen folgende Beträge in Rechnung zu stellen:
 {%- for ent in invoice.GetEntries() -%}
  {{- '\Artikel' -}} 
  {{- '{' -}} {{- ent.GetQuantity() -}} {{- '}' -}} 
- {{- '{' -}} {{- ent.GetDescription().decode("UTF-8") -}} {{- '}' -}} 
+ {{- '{' -}} {{- ent.GetDescription() -}} {{- '}' -}} 
  {{- '{' -}} {{- ent.GetInvPrice().to_double() -}} {{- '}' -}}
 {%- endfor -%}
 {#- **************** JINJA2 Entries END ********************** -#}
diff --git a/bindings/python/example_scripts/Invoice_2.tex.tmpl b/bindings/python/example_scripts/Invoice_2.tex.tmpl
index 0c94fc7e1..ea2e7e33e 100644
--- a/bindings/python/example_scripts/Invoice_2.tex.tmpl
+++ b/bindings/python/example_scripts/Invoice_2.tex.tmpl
@@ -134,13 +134,13 @@
 \Euro
 %---------------------------------------------------------------------------
 \begin{letter}{ {%- endraw -%}
-{{- invoice.GetOwner().GetName().decode("UTF-8") -}} \\ 
-{{- invoice.GetOwner().GetAddr().GetAddr1().decode("UTF-8") -}} \\ 
-{{- invoice.GetOwner().GetAddr().GetAddr2().decode("UTF-8") -}} \\ 
-{{- invoice.GetOwner().GetAddr().GetAddr3().decode("UTF-8") -}} 
+{{- invoice.GetOwner().GetName() -}} \\ 
+{{- invoice.GetOwner().GetAddr().GetAddr1() -}} \\ 
+{{- invoice.GetOwner().GetAddr().GetAddr2() -}} \\ 
+{{- invoice.GetOwner().GetAddr().GetAddr3() -}} 
 {# if Addr4 is declared put a linebreak here #}
 {%- if invoice.GetOwner().GetAddr().GetAddr4() -%} \\ {%- endif -%} 
-{{- invoice.GetOwner().GetAddr().GetAddr4().decode("UTF-8") -}} {%- raw -%}
+{{- invoice.GetOwner().GetAddr().GetAddr4() -}} {%- raw -%}
 }
 %---------------------------------------------------------------------------
 % Weitere Optionen
@@ -167,7 +167,7 @@ Ich erlaube mir, Ihnen folgende Beträge in Rechnung zu stellen:
  {%- for ent in invoice.GetEntries() %}
  {{ loop.index }} & 
  {{- locale.format("%.2f", ent.GetQuantity().to_double()) -}} & 
- {{- ent.GetDescription().decode("UTF-8") -}} &
+ {{- ent.GetDescription() -}} &
  \EUR{ {{- locale.format("%.2f", ent.GetInvPrice().to_double()) -}} } &
  \EUR{ {{- locale.format("%.2f", ent.GetInvPrice().to_double() * ent.GetQuantity().to_double()) -}} } \\ \hline
  {%- endfor -%}

commit 3ed6b4dab9d8635c4e7616e2c135af683e29f768
Author: Steven Walter <stevenrwalter at gmail.com>
Date:   Sun Aug 1 22:17:41 2021 -0400

    latex_invoices.py: write takes string not bytes
    
    write() fails if you give it bytes, so don't encode

diff --git a/bindings/python/example_scripts/latex_invoices.py b/bindings/python/example_scripts/latex_invoices.py
index 84fd5d216..f494fb131 100644
--- a/bindings/python/example_scripts/latex_invoices.py
+++ b/bindings/python/example_scripts/latex_invoices.py
@@ -160,7 +160,7 @@ def invoice_to_lco(invoice):
         n = ent.GetQuantity()
 
         uprice = locale.currency(price).rstrip(" EUR")
-        un = unicode(
+        un = str(
             int(float(n.num()) / n.denom())
         )  # choose best way to format numbers according to locale
 
@@ -288,7 +288,6 @@ def main(argv=None):
 
         # Opening output file
         f = open(output_file_name, "w")
-        lco_str = lco_str.encode("latin1")
         f.write(lco_str)
         f.close()
 

commit ba4852a9da5912af5441facc7c7e5e7684332c2c
Author: Steven Walter <stevenrwalter at gmail.com>
Date:   Sun Aug 1 22:17:11 2021 -0400

    latex_invoices.py: use default locale
    
    Don't hardcode a locale.  Empty string means to use the user's locale
    (e.g. $LANG)

diff --git a/bindings/python/example_scripts/latex_invoices.py b/bindings/python/example_scripts/latex_invoices.py
index 52755da3d..84fd5d216 100644
--- a/bindings/python/example_scripts/latex_invoices.py
+++ b/bindings/python/example_scripts/latex_invoices.py
@@ -147,7 +147,7 @@ def invoice_to_lco(invoice):
 
     # Write the entries
     ent_str = u""
-    locale.setlocale(locale.LC_ALL, "de_DE")
+    locale.setlocale(locale.LC_ALL, "")
     for n, ent in enumerate(invoice.GetEntries()):
 
         line_str = u""

commit ad3895fa07a6c7cd8ce1d16d88dbeef6e5fc6cff
Author: Steven Walter <stevenrwalter at gmail.com>
Date:   Sun Aug 1 22:16:33 2021 -0400

    latex_invoices.py: don't decode() a str
    
    These functions all return str's not bytes.  Therefore there is no need
    to decode them.

diff --git a/bindings/python/example_scripts/latex_invoices.py b/bindings/python/example_scripts/latex_invoices.py
index 829021adf..52755da3d 100644
--- a/bindings/python/example_scripts/latex_invoices.py
+++ b/bindings/python/example_scripts/latex_invoices.py
@@ -115,19 +115,19 @@ def invoice_to_lco(invoice):
     add_str = u""
     owner = invoice.GetOwner()
     if owner.GetName() != "":
-        add_str += owner.GetName().decode("UTF-8") + "\n"
+        add_str += owner.GetName() + "\n"
 
     addr = owner.GetAddr()
     if addr.GetName() != "":
-        add_str += addr.GetName().decode("UTF-8") + "\n"
+        add_str += addr.GetName() + "\n"
     if addr.GetAddr1() != "":
-        add_str += addr.GetAddr1().decode("UTF-8") + "\n"
+        add_str += addr.GetAddr1() + "\n"
     if addr.GetAddr2() != "":
-        add_str += addr.GetAddr2().decode("UTF-8") + "\n"
+        add_str += addr.GetAddr2() + "\n"
     if addr.GetAddr3() != "":
-        add_str += addr.GetAddr3().decode("UTF-8") + "\n"
+        add_str += addr.GetAddr3() + "\n"
     if addr.GetAddr4() != "":
-        add_str += addr.GetAddr4().decode("UTF-8") + "\n"
+        add_str += addr.GetAddr4() + "\n"
 
     lco_out += write_variable("toaddress2", add_str)
 
@@ -167,7 +167,7 @@ def invoice_to_lco(invoice):
         line_str = u"\Artikel{"
         line_str += un
         line_str += u"}{"
-        line_str += descr.decode("UTF-8")
+        line_str += descr
         line_str += u"}{"
         line_str += uprice
         line_str += u"}"



Summary of changes:
 bindings/python/example_scripts/Invoice.tex.tmpl   | 12 ++++++------
 bindings/python/example_scripts/Invoice_2.tex.tmpl | 12 ++++++------
 bindings/python/example_scripts/latex_invoices.py  | 19 +++++++++----------
 3 files changed, 21 insertions(+), 22 deletions(-)



More information about the gnucash-changes mailing list