blob: 06ab1f05e2b0b59c77f4c768a4bf95a71b47d911 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 03bd5cb77c54033857810bb17562859eefa41221 Mon Sep 17 00:00:00 2001
Patrick Williamsb48b7b42016-08-17 15:04:38 -05002From: Simon Busch <simon.busch@lge.com>
3Date: Wed, 9 Apr 2014 13:20:33 +0200
Brad Bishop316dfdd2018-06-25 12:45:53 -04004Subject: [PATCH] Add possibility to import templates from packages
Patrick Williamsb48b7b42016-08-17 15:04:38 -05005
6Does not have any unit tests yet.
7
8Signed-off-by: Simon Busch <simon.busch@lge.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -04009
Patrick Williamsb48b7b42016-08-17 15:04:38 -050010---
Brad Bishop316dfdd2018-06-25 12:45:53 -040011 dbusmock/mockobject.py | 3 +++
Patrick Williamsb48b7b42016-08-17 15:04:38 -050012 1 file changed, 3 insertions(+)
13
14diff --git a/dbusmock/mockobject.py b/dbusmock/mockobject.py
Brad Bishop316dfdd2018-06-25 12:45:53 -040015index e4f130f..389df70 100644
Patrick Williamsb48b7b42016-08-17 15:04:38 -050016--- a/dbusmock/mockobject.py
17+++ b/dbusmock/mockobject.py
Brad Bishop316dfdd2018-06-25 12:45:53 -040018@@ -46,6 +46,9 @@ def load_module(name):
19 exec(f.read(), mod.__dict__, mod.__dict__)
20 return mod
Patrick Williamsb48b7b42016-08-17 15:04:38 -050021
22+ if '.' in name:
23+ return importlib.import_module(name)
24+
25 return importlib.import_module('dbusmock.templates.' + name)
26
27