Commits

Ginés Martínez Sánchez committed 85cc9ee Draft

doing inter_event example

  • Participants
  • Parent commits 8f71f45

Comments (0)

Files changed (6)

ginsfsm/examples/inter_event/banco/banco.ini

 GSock.trace_dump = true
 GObj.trace_mach = true
 GObj.trace_creation = false
+GObj.trace_traverse = true
 
 PyramidRoot.pyramid_router_url = __pyramid_router__
 GRouter.trace_router = true

ginsfsm/examples/inter_event/banco/banco/main.py

         'GSock.trace_dump': True,
         'GObj.trace_mach': True,
         'GObj.trace_creation': False,
+        'GObj.trace_traverse': True,
+
         'GObj.logger': logging,
         'PyramidRoot.pyramid_router_url': '__pyramid_router__',
         'GRouter.trace_router': True,

ginsfsm/examples/inter_event/banco/banco/pyramid_app/__init__.py

 """
 from pyramid.config import Configurator
 
-from ginsfsm.globals import get_global_app
+from ginsfsm.globals import (
+    set_global_app,
+    get_global_app,
+)
 
 from banco.pyramid_app.pyramid_root import PyramidRoot
 
         cache_max_age=3600
     )
 
+    # Set up sockjs views
+    config.include("ginsfsm.protocols.sockjs.server")
+
     # Set up views
     config.scan("banco.pyramid_app")
 
 
 def make_root(gaplic, config):
     global app_root
-    if app_root is not None:
-        return app_root
-
-    app_root = gaplic.create_gobj(
-        'pyramid-root',
-        PyramidRoot,
-        gaplic,
-        pyramid_config=config
-    )
+    if app_root is None:
+        app_root = gaplic.create_gobj(
+            None,   # pyramid resources tree root MUST be unnamed.
+            PyramidRoot,
+            None    # and must have no parent.
+        )
+        set_global_app('banco_app', app_root)
     return app_root
 
 

ginsfsm/router.py

         tuple, range(2690, 2700), 0, None,
         'List of posible listening ports acting as localhost tcp router server'
     ],
-    'pyramid_url': [
+    'pyramid_router_url': [
         str, '__pyramid_router__', 0, None,
         'pyramid url to start the router'
     ],
         """ Initialization zone.
         """
         self.registry = GAplicRegistry(self)
-        if self.config.pyramid_url:
+        if self.config.pyramid_router_url:
             # router inside pyramid.
             self.sockjs = self.create_gobj(
-                self.config.pyramid_url,       # named gobj
+                self.config.pyramid_router_url,       # named gobj
                 GSockjsServer,          # gclass
                 self.config.pyramid_root,      # parent
                 sockjs_app_class=RouterConnection,

ginsfsm/scaffolds/simple_pyramid/+package+/main.py_tmpl

         'GSock.trace_dump': True,
         'GObj.trace_mach': True,
         'GObj.trace_creation': False,
+        'GObj.trace_traverse': True,
+
         'GObj.logger': logging,
         'PyramidRoot.pyramid_router_url': '__pyramid_router__',
         'GRouter.trace_router': True,

ginsfsm/scaffolds/simple_pyramid/+package+/pyramid_app/__init__.py_tmpl

 """
 from pyramid.config import Configurator
 
-from ginsfsm.globals import get_global_app
+from ginsfsm.globals import (
+    set_global_app,
+    get_global_app,
+)
 
 from {{package}}.pyramid_app.pyramid_root import PyramidRoot
 
         cache_max_age=3600
     )
 
+    # Set up sockjs views
+    config.include("ginsfsm.protocols.sockjs.server")
+
     # Set up views
     config.scan("{{package}}.pyramid_app")
 
 
 def make_root(gaplic, config):
     global app_root
-    if app_root is not None:
-        return app_root
-
-    app_root = gaplic.create_gobj(
-        'pyramid-root',
-        PyramidRoot,
-        gaplic,
-        pyramid_config=config
-    )
+    if app_root is None:
+        app_root = gaplic.create_gobj(
+            None,   # pyramid resources tree root MUST be unnamed.
+            PyramidRoot,
+            None    # and must have no parent.
+        )
+        set_global_app('{{package}}_app', app_root)
     return app_root