[pyramid] Rename make_cubicweb_application function as config_from_cwconfig
authorDenis Laxalde <denis.laxalde@logilab.fr>
Fri, 10 Feb 2017 16:33:16 +0100
changeset 11958 950ce7d9f642
parent 11957 48b8fbc88209
child 11959 ddc05ce75319
[pyramid] Rename make_cubicweb_application function as config_from_cwconfig And update its docstring. This function does not actually "make a cubicweb application", it just builds a pyramid.config.Configurator instance from a CubicWeb config object.
cubicweb/pyramid/__init__.py
cubicweb/pyramid/test/__init__.py
cubicweb/pyramid/tools.py
--- a/cubicweb/pyramid/__init__.py	Wed Feb 08 17:49:25 2017 +0100
+++ b/cubicweb/pyramid/__init__.py	Fri Feb 10 16:33:16 2017 +0100
@@ -12,11 +12,9 @@
     from ConfigParser import SafeConfigParser
 
 
-def make_cubicweb_application(cwconfig, settings=None):
-    """
-    Create a pyramid-based CubicWeb instance from a cubicweb configuration.
-
-    It is initialy meant to be used by the 'pyramid' command of cubicweb-ctl.
+def config_from_cwconfig(cwconfig, settings=None):
+    """Return a Pyramid Configurator instance built from a CubicWeb config and
+    Pyramid-specific configuration files (pyramid.ini).
 
     :param cwconfig: A CubicWeb configuration
     :returns: A Pyramid config object
@@ -74,7 +72,7 @@
 
     :returns: A fully operationnal WSGI application
     """
-    config = make_cubicweb_application(cwconfig)
+    config = config_from_cwconfig(cwconfig)
     profile = profile or asbool(config.registry.settings.get(
         'cubicweb.profile.enable', False))
     if profile:
--- a/cubicweb/pyramid/test/__init__.py	Wed Feb 08 17:49:25 2017 +0100
+++ b/cubicweb/pyramid/test/__init__.py	Fri Feb 10 16:33:16 2017 +0100
@@ -2,7 +2,7 @@
 
 from cubicweb.devtools.webtest import CubicWebTestTC
 
-from cubicweb.pyramid import make_cubicweb_application
+from cubicweb.pyramid import config_from_cwconfig
 
 
 class PyramidCWTest(CubicWebTestTC):
@@ -16,7 +16,7 @@
     def setUp(self):
         # Skip CubicWebTestTC setUp
         super(CubicWebTestTC, self).setUp()
-        config = make_cubicweb_application(self.config, self.settings)
+        config = config_from_cwconfig(self.config, self.settings)
         self.includeme(config)
         self.pyr_registry = config.registry
         self.webapp = webtest.TestApp(
--- a/cubicweb/pyramid/tools.py	Wed Feb 08 17:49:25 2017 +0100
+++ b/cubicweb/pyramid/tools.py	Fri Feb 10 16:33:16 2017 +0100
@@ -64,7 +64,7 @@
 def includeme(config):
     """Start the cache maintenance loop task.
 
-    Automatically included by :func:`cubicweb.pyramid.make_cubicweb_application`.
+    Automatically included by :mod:`cubicweb.pyramid`.
     """
     repo = config.registry['cubicweb.repository']
     interval = int(config.registry.settings.get(