[Elisa-commits] [MERGE] resource providers API and manager
Florian Boucault
florian at fluendo.com
Wed Apr 9 16:28:59 CEST 2008
Le mardi 08 avril 2008 à 17:53 +0200, Benjamin Kampmann a écrit :
> The Resource Providers API is considered stable and the resource manager
> works relieable now. We should merge both into the main rest branch.
>
> This patch contains the resource_manager for core, a test for it with a
> coverage of 100%, the resource_provider base component and a modified
> application to hold the resource_manager.
=== added file 'elisa-core/elisa/base_components/resource_provider.py'
+
+"""
+Provides access to resources
+"""
+
Useless noise to me.
=== added file 'elisa-core/elisa/core/resource_manager.py'
+ def unregister_component(self, component):
+ Manager.unregister_component(self, component)
+ components = [component for reguexp, component
+ in self._providers_uri_regexps]
+ index = components.index(component)
+ self._providers_uri_regexps.pop(index)
'reguexp' is not consistent with 'regexps' that you use everywhere else.
Indentation is not following the PEP 257 I guess.
+ def _get_resource_provider(self, uri):
+ """
+ Retrieve the ResourceProvider able to handle L{uri}.
+ If multiple ResourceProviders support it, the first found is
returned.
+
"the first _one_ found" sounds more english.
Does not document the potential exception raised
(ResourceProviderNotFound). This documentation should probably be part
of the public API (put, get, delete, post). What do you think?
+ @param source_model: Often the resource behind the source_uri
is
+ already existing as a
model-representation. To
+ prevent from doing a 'get' for the given
+ source_uri this model can also be given
to the
+ put request.
Rephrasing:
"Often the resource behind the L{source_uri} already exists as a Model.
In order to avoid retrieving the resource pointed by L{source_uri} that
model can be passed to the put request."
+ def delete(self, uri):
+ """
+ Delete a Resource represented by a URI.
Phrasing not consistent with documentation of the other calls.
Rephrasing:
"Delete the resource that L{uri} is pointing to."
As discussed tests need to be improved.
Finally for the extra source_model to the put method, I'm completely
fine with it.
Thanks,
Florian
More information about the Elisa-commits
mailing list