Commits

Ginés Martínez Sánchez  committed 7041582 Draft

developing wsgi server

  • Participants
  • Parent commits e302c0c

Comments (0)

Files changed (2)

File ginsfsm/gaplic.py

     return worker
 
 
-def gaplic_factory(loader, global_config, main,
-                   threads=None, subprocesses=None, others=None):
+def gaplic_factory(loader, global_conf, **local_conf):
     """ To use with PasteDeploy in composite, example::
 
         [composite:main]
         [app:wsgi-application]
         use = call:ginsfsm.examples.wsgi.simple_wsgi_server:paste_app_factory
 
+        # TODO: check
         [composite:urlmap]
         use = call:ginsfsm.protocols.wsgi.common.urlmap:urlmap_factory
         / = home
 
     The prototype for ``others`` (paste app factory) is::
 
-        def paste_app_factory(global_config, **local_conf):
+        def paste_app_factory(global_conf, **local_conf):
             return wsgi-application
 
     The prototype for ``main``, ``threads`` and ``subprocesses`` is:
 
-        def main(global_config, **settings):
+        def main(global_conf, **settings):
             return gaplic-instance
 
     """
-    others = others.split()
-    threads = threads.split()
-    subprocesses = subprocesses.split()
+    main = local_conf.get('main')
+    others = local_conf.get('others', []).split()
+    threads = local_conf.get('threads', []).split()
+    subprocesses = local_conf.get('subprocesses', []).split()
 
     for other in others:
         app = loader.get_app(other)

File ginsfsm/protocols/wsgi/common/urlmap.py

 Map URL prefixes to WSGI applications.  See ``URLMap``
 """
 
-from UserDict import DictMixin
+try:
+    from UserDict import DictMixin
+except ImportError:  # pragma: no cover
+    # py3
+    from collections.UserDict import DictMixin
+
 import re
 import os
 import cgi