diff --git a/transport/__init__.py b/transport/__init__.py index 6062453..16a2467 100644 --- a/transport/__init__.py +++ b/transport/__init__.py @@ -81,13 +81,15 @@ def instance (**_args): if not registry.isloaded () : if ('path' in _args and registry.exists(_args['path'] )) or registry.exists(): registry.load() if 'path' not in _args else registry.load(_args['path']) + _info = {} if 'label' in _args and registry.isloaded(): _info = registry.get(_args['label']) - - if _info : - # - # _args = dict(_args,**_info) - _args = dict(_info,**_args) #-- we can override the registry parameters with our own arguments + else: + _info = registry.get() + if _info : + # + # _args = dict(_args,**_info) + _args = dict(_info,**_args) #-- we can override the registry parameters with our own arguments if 'provider' in _args and _args['provider'] in PROVIDERS : _info = PROVIDERS[_args['provider']] @@ -132,7 +134,7 @@ class get : """ @staticmethod def reader (**_args): - if not _args : + if not _args or 'provider' not in _args: _args['label'] = 'default' _args['context'] = 'read' return instance(**_args) diff --git a/transport/iowrapper.py b/transport/iowrapper.py index d6cba1c..e3abf6c 100644 --- a/transport/iowrapper.py +++ b/transport/iowrapper.py @@ -52,6 +52,13 @@ class IO: if hasattr(self._agent,'apply') : return self._agent.apply(_query) return None + def submit(self,_query): + return self.delegate('submit',_query) + def delegate(self,_name,_query): + if hasattr(self._agent,_name) : + pointer = getattr(self._agent,_name) + return pointer(_query) + return None class IReader(IO): """ This is a wrapper for read functionalities