From 37a0551ca2f4406c0c39dd55dd879a67b207b9e6 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Fri, 12 Jun 2015 16:35:01 -0400 Subject: [PATCH] Add package importing, examples to README --- README.rst | 15 +++++++++++++++ sprockets/cli/__init__.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 542a5ef..c7b2f08 100644 --- a/README.rst +++ b/README.rst @@ -82,6 +82,21 @@ Plugin API Summary: plugin.on_start(controller_module) # optional plugin.on_shutdown(controller_module) # optional +Example Entrypoints +------------------- + +Controller: + +```python +{'sprockets.controller': ['http=sprockets.controllers.http:None']}, +``` + +Application: + +```python +{'sprockets.http.app': ['name=package.or.module:None']} +``` + Applications ------------ diff --git a/sprockets/cli/__init__.py b/sprockets/cli/__init__.py index f1f95a0..b0aa2c6 100644 --- a/sprockets/cli/__init__.py +++ b/sprockets/cli/__init__.py @@ -292,7 +292,7 @@ class CLI(object): """ for pkg in self._get_applications(controller): if pkg.name == application: - return pkg.module_name + return importlib.import_module(pkg.module_name) return importlib.import_module(application) @staticmethod