Source

pyramid_perfstat / pyramid_perfstat / __init__.py

Diff from to

File pyramid_perfstat/__init__.py

 def perf_tween_factory(handler, registry):
     """
     """
-    
     PerfDbManager(None).init_db()
     
     def perf_tween(request, getLogger=logging.getLogger):
         """
-        TODO : should avoid it's own url
-        TODO : get route_name
-        TODO : get view name (or full path,function name ...)
         """
         t0=time.time()
         result = handler(request)
     config.add_route('pyramid_perfstat.reporting.url_detail', '/stat/{id_session}/{id_view}/{id_route}',
                      custom_predicates=(to_int('id_session', 'id_view', 'id_route'),))
     
-    config.add_view('pyramid_perfstat.views.reporting',
-                    route_name='pyramid_perfstat.reporting',
-                    renderer='pyramid_perfstat:templates/reporting.mako')
-
-    config.add_view('pyramid_perfstat.views.reporting',
-                    route_name='pyramid_perfstat.reporting.session_detail',
-                    renderer='pyramid_perfstat:templates/reporting.mako')
-
-    config.add_view('pyramid_perfstat.views.reporting',
-                    route_name='pyramid_perfstat.reporting.view_detail',
-                    renderer='pyramid_perfstat:templates/reporting.mako')
-
-    config.add_view('pyramid_perfstat.views.reporting',
-                    route_name='pyramid_perfstat.reporting.url_detail',
-                    renderer='pyramid_perfstat:templates/reporting.mako')
-
-    config.add_view('pyramid_perfstat.views.reset_db',
-                    route_name='pyramid_perfstat.reset')
     
-
 def includeme(config):
     """
     Set up am implicit :term:`tween` to log performance information of each
     config.add_tween('pyramid_perfstat.perf_tween_factory', under=EXCVIEW)
     config.include(include_perf_routes, route_prefix=ROUTE_PREFIX)
 
+    # scan views
+    config.scan('pyramid_perfstat.views')
+