Merge lp:~zyga/checkbox/fixes into lp:checkbox

Proposed by Zygmunt Krynicki
Status: Merged
Approved by: Maciej Kisielewski
Approved revision: 3413
Merged at revision: 3421
Proposed branch: lp:~zyga/checkbox/fixes
Merge into: lp:checkbox
Diff against target: 80 lines (+37/-5)
1 file modified
checkbox-touch/py/embedded_providers.py (+37/-5)
To merge this branch: bzr merge lp:~zyga/checkbox/fixes
Reviewer Review Type Date Requested Status
Maciej Kisielewski Approve
Review via email: mp+241761@code.launchpad.net

Description of the change

78c4913 checkbox-touch: fix embedded provider loader after API changes

To post a comment you must log in.
lp:~zyga/checkbox/fixes updated
3413. By Zygmunt Krynicki

checkbox-touch: fix embedded provider loader after API changes

This patch fixes the embedded provider plug-in to adhere to the extended
plug-in API.

Signed-off-by: Zygmunt Krynicki <email address hidden>

Revision history for this message
Maciej Kisielewski (kissiel) wrote :

+1, Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox-touch/py/embedded_providers.py'
--- checkbox-touch/py/embedded_providers.py 2014-11-13 23:14:59 +0000
+++ checkbox-touch/py/embedded_providers.py 2014-11-14 07:09:51 +0000
@@ -22,16 +22,16 @@
2222
23This module contains custom providers used by Checkbox-touch23This module contains custom providers used by Checkbox-touch
24"""24"""
25# NOTE: this is python 3.3 only
25from importlib.machinery import SourceFileLoader26from importlib.machinery import SourceFileLoader
26import logging
27import os27import os
2828
29from plainbox.abc import IProvider1, IProviderBackend129from plainbox.impl.secure.config import Unset
30from plainbox.impl.secure.plugins import FsPlugInCollection30from plainbox.impl.secure.plugins import FsPlugInCollection
31from plainbox.impl.secure.plugins import now
31from plainbox.impl.secure.providers.v1 import Provider132from plainbox.impl.secure.providers.v1 import Provider1
32from plainbox.impl.secure.providers.v1 import Provider1Definition33from plainbox.impl.secure.providers.v1 import Provider1Definition
33from plainbox.impl.secure.providers.v1 import Provider1PlugIn34from plainbox.impl.secure.providers.v1 import Provider1PlugIn
34from plainbox.impl.secure.config import Unset
3535
3636
37class ManagePyProvider1PlugIn(Provider1PlugIn):37class ManagePyProvider1PlugIn(Provider1PlugIn):
@@ -39,15 +39,16 @@
39 Provider1PlugIn that is built from manage.py file.39 Provider1PlugIn that is built from manage.py file.
40 """40 """
4141
42 def __init__(self, filename, file_contents, plugin_load_time, *, validate=None,42 def __init__(self, filename, file_contents, load_time, *, validate=None,
43 validation_kwargs=None, check=None, context=None):43 validation_kwargs=None, check=None, context=None):
44 """44 """
45 Initialize plug-in and create provider from definition extracted45 Initialize plug-in and create provider from definition extracted
46 from manage.py pointed by `filename`46 from manage.py pointed by `filename`
47 """47 """
4848 self._load_time = load_time
49 # override provider_manager.setup() to capture setup's parameters49 # override provider_manager.setup() to capture setup's parameters
50 setup_kwargs = []50 setup_kwargs = []
51 start_time = now()
5152
52 def fake_setup(**kwargs):53 def fake_setup(**kwargs):
53 setup_kwargs.append(kwargs)54 setup_kwargs.append(kwargs)
@@ -74,6 +75,37 @@
74 self._provider = Provider1.from_definition(75 self._provider = Provider1.from_definition(
75 definition, secure=False, validate=validate,76 definition, secure=False, validate=validate,
76 validation_kwargs=validation_kwargs, check=check, context=context)77 validation_kwargs=validation_kwargs, check=check, context=context)
78 self._wrap_time = now() - start_time
79
80 @property
81 def plugin_name(self):
82 """
83 plugin name, the namespace of the provider
84 """
85 return self._provider.name
86
87 @property
88 def plugin_object(self):
89 """
90 plugin object, the actual Provider1 instance
91 """
92 return self._provider
93
94 @property
95 def plugin_load_time(self) -> float:
96 """
97 time, in fractional seconds, that was needed to load the provider
98 definition file from the file system
99 """
100 return self._load_time
101
102 @property
103 def plugin_wrap_time(self) -> float:
104 """
105 time, in fractional seconds, that was needed to load the provider from
106 the definition text
107 """
108 return self._wrap_time
77109
78110
79class EmbeddedProvider1PlugInCollection(FsPlugInCollection):111class EmbeddedProvider1PlugInCollection(FsPlugInCollection):

Subscribers

People subscribed via source and target branches