richardphibel / rpms / systemd

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