chiark / gitweb /
systemd-python: convert keyword value to string
authorRichard Marko <rmarko@fedoraproject.org>
Tue, 5 Nov 2013 14:41:20 +0000 (15:41 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 7 Nov 2013 06:23:54 +0000 (01:23 -0500)
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)

Before this commit this results in
TypeError: cannot concatenate 'str' and 'int' objects
and requires passing PRIORITY value as string to work.

src/python-systemd/journal.py

index d0bcd24d1501aa8b800083259947c9320dd4ae36..9c7e0045e5fddce2a9c354894e009b2f51d23c1e 100644 (file)
@@ -352,6 +352,8 @@ def get_catalog(mid):
 def _make_line(field, value):
         if isinstance(value, bytes):
                 return field.encode('utf-8') + b'=' + value
+        elif isinstance(value, int):
+                return field + '=' + str(value)
         else:
                 return field + '=' + value