Commits

Ginés Martínez Sánchez committed 2d75e84 Draft

reviewing scaffolds

Comments (0)

Files changed (9)

ginsfsm/scaffolds/multi_pyramid_wsgi/+package+.ini_tmpl

 
 [composite:wsgi-application]
 use = call:ginsfsm.protocols.wsgi.common.urlmap:urlmap_factory
-/ = admin
-/applic10 = applic10
-/applic20 = applic20
+/ = applic10
+/admin = admin
+/app = applic20
 
 [app:wsgi-server]
 #use = call:{{package}}.main:main

ginsfsm/scaffolds/multi_pyramid_wsgi/+package+/__init__.py_tmpl

 # -*- encoding: utf-8 -*-
 
 __version__ = '0.0.0'
-
-
-# Set default logging handler to avoid "No handler found" warnings.
-import logging
-try:  # Python 2.7+
-    from logging import NullHandler
-except ImportError:
-    class NullHandler(logging.Handler):
-        def emit(self, record):
-            pass
-
-logging.getLogger(__name__).addHandler(NullHandler())

ginsfsm/scaffolds/multi_pyramid_wsgi/+package+/applic10/__init__.py_tmpl

         'applic10',
         GApplic10,
         gaplic,
-        config=config
+        pyramid_config=config
     )
     return applic10_root
 

ginsfsm/scaffolds/multi_pyramid_wsgi/+package+/applic10/applic10_root.py_tmpl

 #               Actions
 #-------------------------------------------#
 def ac_timeout(self, event):
-    self.counter += 1
-    self.send_event(self.timer, 'EV_SET_TIMER', seconds=self.seconds)
+    self.config.counter += 1
+    self.send_event(self.timer, 'EV_SET_TIMER', seconds=self.config.seconds)
 
 
 GAPPLIC10_FSM = {
         """ Initialization zone.
 
         # You could use declarative:
-        self.pyramid_config.add_view(
+        self.config.pyramid_config.add_view(
             default_view,
             context=GApplic1,
             permission='view',
             GTimer,     # gclass
             self        # parent
         )
-        self.send_event(self.timer, 'EV_SET_TIMER', seconds=self.seconds)
+        self.send_event(self.timer, 'EV_SET_TIMER', seconds=self.config.seconds)
 
 
 #-------------------------------------------#
 #-------------------------------------------#
 @view_config(context=GApplic10, permission='view')
 def default_view(self, request):
-    return Response('Counter = %d! <br/> Refresh me, please!!'% self.counter)
+    return Response('Counter = %d! <br/> Refresh me, please!!'% self.config.counter)

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

     """
     def admin_wsgi(environ, start_response):
         start_response('200 OK', [('Content-Type', 'text/plain')])
-        yield 'Hello Admin!\n'
+        yield b'Hello Admin!\n'
 
     return admin_wsgi
 
     """
     def applic20_wsgi(environ, start_response):
         start_response('200 OK', [('Content-Type', 'text/plain')])
-        yield 'Hello applic20!\n'
+        yield b'Hello applic20!\n'
     return applic20_wsgi
 
 
         'gaplic': 'main_gaplic'
     }
     route_apps = {
-        '/': admin_paste_factory({}),
-        '/applic10': applic10_paste_factory({}, **applic10_settings),
-        '/applic20': applic20_paste_factory({})
+        '/': applic10_paste_factory({}, **applic10_settings),
+        '/admin': admin_paste_factory({}),
+        '/app': applic20_paste_factory({})
     }
 
     urlmap = URLMap()

ginsfsm/scaffolds/multiple_wsgi/+package+/__init__.py_tmpl

 
 __version__ = '0.0.0'
 
-
-# Set default logging handler to avoid "No handler found" warnings.
-import logging
-try:  # Python 2.7+
-    from logging import NullHandler
-except ImportError:
-    class NullHandler(logging.Handler):
-        def emit(self, record):
-            pass
-
-logging.getLogger(__name__).addHandler(NullHandler())

ginsfsm/scaffolds/multiple_wsgi/+package+/apps.py_tmpl

 
 def application1(environ, start_response):
     start_response('200 OK', [('Content-Type', 'text/plain')])
-    yield 'Hello World ONE!\n'
+    yield b'Hello World ONE!\n'
 
 
 def application2(environ, start_response):
     start_response('200 OK', [('Content-Type', 'text/plain')])
-    yield 'Hello World TWO!\n'
+    yield b'Hello World TWO!\n'
 
 
 def application3(environ, start_response):
     start_response('200 OK', [('Content-Type', 'text/plain')])
-    yield 'Hello World THREE!\n'
+    yield b'Hello World THREE!\n'

ginsfsm/scaffolds/simple_wsgi/+package+/__init__.py_tmpl

 # -*- encoding: utf-8 -*-
 
 __version__ = '0.0.0'
-
-
-# Set default logging handler to avoid "No handler found" warnings.
-import logging
-try:  # Python 2.7+
-    from logging import NullHandler
-except ImportError:
-    class NullHandler(logging.Handler):
-        def emit(self, record):
-            pass
-
-logging.getLogger(__name__).addHandler(NullHandler())

ginsfsm/scaffolds/simple_wsgi/+package+/app.py_tmpl

 
 def wsgi_application(environ, start_response):
     start_response('200 OK', [('Content-Type', 'text/plain')])
-    yield 'Hello World\n'
+    yield b'Hello World\n'
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.