a52f674
From 395932dfebaa4d9b4ef91857802d222484fd610e Mon Sep 17 00:00:00 2001
930e1b8
From: Richard Marko <rmarko@fedoraproject.org>
930e1b8
Date: Tue, 5 Nov 2013 15:41:20 +0100
930e1b8
Subject: [PATCH] systemd-python: convert keyword value to string
930e1b8
930e1b8
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)
930e1b8
930e1b8
Before this commit this results in
930e1b8
TypeError: cannot concatenate 'str' and 'int' objects
930e1b8
and requires passing PRIORITY value as string to work.
930e1b8
---
930e1b8
 src/python-systemd/journal.py | 2 ++
930e1b8
 1 file changed, 2 insertions(+)
930e1b8
930e1b8
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
930e1b8
index d0bcd24..9c7e004 100644
930e1b8
--- a/src/python-systemd/journal.py
930e1b8
+++ b/src/python-systemd/journal.py
930e1b8
@@ -352,6 +352,8 @@ def get_catalog(mid):
930e1b8
 def _make_line(field, value):
930e1b8
         if isinstance(value, bytes):
930e1b8
                 return field.encode('utf-8') + b'=' + value
930e1b8
+        elif isinstance(value, int):
930e1b8
+                return field + '=' + str(value)
930e1b8
         else:
930e1b8
                 return field + '=' + value
930e1b8