Commits

Ginés Martínez Sánchez  committed 8eeabc1

review of the examples and the scaffolds

  • Participants
  • Parent commits b7f96f2

Comments (0)

Files changed (7)

File ginsfsm/__init__.py

 """
 A python library to do development based in Finite State Machines.
 """
-__version__ = '0.4.1'
+__version__ = '0.4.2'
 __title__ = 'ginsfsm'
 __author__ = 'Ginés Martínez'
 __license__ = 'MIT License'

File ginsfsm/examples/wsgi/multiple_wsgi_server.py

 logging.basicConfig(level=logging.DEBUG)
 
 from ginsfsm.gaplic import GAplic
-from ginsfsm.globals import get_global_app, set_global_app
+from ginsfsm.globals import (
+    set_global_app,
+    set_global_main_gaplic,
+)
 from ginsfsm.protocols.wsgi.server.c_wsgi_server import GWsgiServer
 #from ginsfsm.protocols.wsgi.common.urlmap import URLMap
 
         application = local_conf.pop('application')
     else:
         raise Exception('You must supply an wsgi application.')
-    application = get_global_app(application)
 
     ga = GAplic('Wsgi-Example', **local_conf)
+    set_global_main_gaplic(ga)
     ga.create_gobj(
         'wsgi-server',
         GWsgiServer,

File ginsfsm/examples/wsgi/simple_wsgi_server.py

 logging.basicConfig(level=logging.DEBUG)
 
 from ginsfsm.gaplic import GAplic
-from ginsfsm.globals import get_global_app, set_global_app
+from ginsfsm.globals import (
+    set_global_app,
+    set_global_main_gaplic,
+)
 from ginsfsm.protocols.wsgi.server.c_wsgi_server import GWsgiServer
 
 
         application = local_conf.pop('application')
     else:
         raise Exception('You must supply an wsgi application.')
-    application = get_global_app(application)
     ga = GAplic('Wsgi-Example', **local_conf)
+    set_global_main_gaplic(ga)
     ga.create_gobj(
         'wsgi-server',
         GWsgiServer,

File ginsfsm/scaffolds/multi_pyramid_wsgi/+package+/main.py_tmpl

     if 'application' in local_conf:
         application = local_conf.pop('application')
     else:
-        raise Exception('You must supply a wsgi application in ini file.')
+        raise Exception('You must supply a wsgi application in local_conf.')
 
     if 'gaplic_name' in local_conf:
         gaplic_name = local_conf.pop('gaplic_name')
     else:
-        raise Exception('You must supply a gaplic name in ini file.')
+        raise Exception('You must supply a gaplic name in local_conf.')
 
     if 'wsgi_server_name' in local_conf:
         wsgi_server_name = local_conf.pop('wsgi_server_name')
     else:
-        raise Exception('You must supply a wsgi server name in ini file.')
+        raise Exception('You must supply a wsgi server name in local_conf.')
 
     ga = GAplic(gaplic_name, **local_conf)
     set_global_main_gaplic(ga)
         parse_path_expression,
     )
 
+    local_conf = {
+        'GObj.trace_mach': True,
+        'GObj.logger': logging,
+        'GSock.trace_dump': True,
+        'wsgi-server.host': '0.0.0.0',
+        'wsgi-server.port': 8000,
+        'application': 'wsgi-application',
+        'gaplic_name': 'main_gaplic',
+        'wsgi_server_name': 'wsgi-server',
+    }
+
+    ga = main({}, **local_conf)
+
     applic10_settings = {
         'pyramid.reload_templates': True,
         'pyramid.debug_authorization': False,
         'pyramid.debug_routematch': False,
         'pyramid.debug_templates': True,
         'pyramid.default_locale_name': 'en',
+        'gaplic': 'main_gaplic'
     }
     route_apps = {
         '/': admin_paste_factory({}),
         urlmap,
     )
 
-    local_conf = {
-        'GObj.trace_mach': True,
-        'GObj.logger': logging,
-        'GSock.trace_dump': True,
-        'host': '0.0.0.0',
-        'port': 8002,
-        'application': 'wsgi-application',
-    }
-
-    ga = main({}, **local_conf)
-
     try:
         ga.mt_process()
     except (KeyboardInterrupt, SystemExit):

File ginsfsm/scaffolds/multiple_wsgi/+package+.ini_tmpl

 main = wsgi-server
 wsgi = wsgi-application
 
+[composite:wsgi-application]
+use = call:ginsfsm.protocols.wsgi.common.urlmap:urlmap_factory
+/ = application1
+/app2 = application2
+/app3 = application3
+
 [app:wsgi-server]
 use = call:{{package}}.main:main
 wsgi-server.host = 0.0.0.0
 GSock.trace_dump = true
 GObj.trace_mach = true
 
-[composite:wsgi-application]
-use = call:ginsfsm.protocols.wsgi.common.urlmap:urlmap_factory
-/ = application1
-/app2 = application2
-/app3 = application3
-
 [app:application1]
 use = call:{{package}}.main:paste_app_factory1
 

File ginsfsm/scaffolds/multiple_wsgi/+package+/main.py_tmpl

 """
 
 from ginsfsm.gaplic import GAplic
-from ginsfsm.globals import get_global_app, set_global_app
+from ginsfsm.globals import (
+    set_global_app,
+    set_global_main_gaplic,
+)
 from ginsfsm.protocols.wsgi.server.c_wsgi_server import GWsgiServer
 
 
         application = local_conf.pop('application')
     else:
         raise Exception('You must supply an wsgi application.')
-    application = get_global_app(application)
     ga = GAplic('Wsgi-Example', **local_conf)
+    set_global_main_gaplic(ga)
     ga.create_gobj(
         'wsgi-server',
         GWsgiServer,

File ginsfsm/scaffolds/simple_wsgi/+package+/main.py_tmpl

 """
 
 from ginsfsm.gaplic import GAplic
-from ginsfsm.globals import get_global_app, set_global_app
+from ginsfsm.globals import (
+    set_global_app,
+    set_global_main_gaplic,
+)
 from ginsfsm.protocols.wsgi.server.c_wsgi_server import GWsgiServer
 
 
         application = local_conf.pop('application')
     else:
         raise Exception('You must supply an wsgi application.')
-    application = get_global_app(application)
     ga = GAplic('Wsgi-Example', **local_conf)
+    set_global_main_gaplic(ga)
     ga.create_gobj(
         'wsgi-server',
         GWsgiServer,
         'GSock.trace_dump': True,
         'wsgi-server.host': '0.0.0.0',
         'wsgi-server.port': 8002,
-        'wsgi-server.application': 'wsgi-application',
+        'application': 'wsgi-application',
     }
     set_global_app(
         'wsgi-application',