Commits

Anonymous committed 16a6272

pylons 0.10 support started

  • Participants
  • Parent commits e206b69

Comments (0)

Files changed (5)

tg/configuration.py

         for key, value in lookup.iteritems():
             mimetypes.add_type(value, key)
 
-    def setup_persistance(self):
-        """Override this method to define how your application configures it's persistance model.
+    def setup_persistence(self):
+        """Override this method to define how your application configures it's persistence model.
            the default is to setup sqlalchemy from the cofiguration file, but you might choose
-           to set up a persistance system other than sqlalchemy, or add an additional persistance
-           layer.  Here is how you would go about setting up a ming (mongo) persistance layer::
+           to set up a persistence system other than sqlalchemy, or add an additional persistence
+           layer.  Here is how you would go about setting up a ming (mongo) persistence layer::
 
             class MingAppConfig(AppConfig):
-                def setup_persistance(self):
+                def setup_persistence(self):
                     self.ming_ds = DataStore(config['mongo.url'])
                     session = Session.by_name('main')
                     session.bind = self.ming_ds
             if self.use_legacy_renderer:
                 self.setup_default_renderer()
 
-            self.setup_persistance()
+            self.setup_persistence()
 
         return load_environment
 

tg/test_stack/__init__.py

 class TestConfig(AppConfig):
 
     def __init__(self, folder, values=None):
-        if values is None: 
+        if values is None:
             values = {}
         AppConfig.__init__(self)
         #First we setup some base values that we know will work
         self.use_dotted_templatenames = False
         self.serve_static = False
 
-
-
         root = "."
         test_base_path = os.path.join(root,'tg', 'test_stack',)
         test_config_path = os.path.join(test_base_path, folder)

tg/test_stack/config/test_config.py

 from webtest import TestApp
 
 def setup_noDB():
-    base_config = TestConfig(folder = 'config', 
-                             values = {'use_sqlalchemy': False}
+    base_config = TestConfig(folder = 'config',
+                             values = {'use_sqlalchemy': False,
+                                       'pylons.tmpl_context_attach_args': False
+                                       }
                              )
-    return app_from_config(base_config) 
+    return app_from_config(base_config)
 
 def test_basic_stack():
     app = setup_noDB()

tg/test_stack/rendering/test_rendering.py

                                        # this is specific to mako
                                        # to make sure inheritance works
                                        'use_dotted_templatenames': False,
+                                       'pylons.tmpl_context_attach_args': False
+
                                        }
                              )
     return app_from_config(base_config)
                                        # this is specific to mako
                                        # to make sure inheritance works
                                        'use_dotted_templatenames': True,
+                                       'pylons.tmpl_context_attach_args': False
                                        }
                              )
     app = app_from_config(base_config)
     # it should yield the old result
     r = app.get('/template_override')
     assert "Not overridden" in r, r
-    
+
 def test_template_override_wts():
 #    app = setup_noDB()
     base_config = TestConfig(folder = 'rendering',
                                        # this is specific to mako
                                        # to make sure inheritance works
                                        'use_dotted_templatenames': True,
+                                       'pylons.tmpl_context_attach_args': False
                                        }
                              )
     app = app_from_config(base_config)
     # it should yield the old result
     r = app.get('/template_override_wts/')
     assert "Not overridden" in r, r
-    
+
 def setup_session_dir():
     if not os.path.exists(session_dir):
         os.makedirs(session_dir)
-    
+
 def teardown_session_dir():
     shutil.rmtree(session_dir, ignore_errors=True)
 
                          'templates': [],
                          'static_files': None},
         'pylons.db_engines': {},
-        'pylons.environ_config': dict(session='beaker.session', 
+        'pylons.environ_config': dict(session='beaker.session',
                                       cache='beaker.cache'),
         'pylons.g': None,
         'pylons.h': None,
         'pylons.response_options': pylons.configuration.response_defaults.copy(),
         'pylons.strict_c': False,
         'pylons.c_attach_args': True,
+        'pylons.tmpl_context_attach_args': True,
         'buffet.template_engines': [],
         'buffet.template_options': {},
         'default_renderer':'genshi',
     environ['pylons.routes_dict'] = {}
     environ['pylons.routes_dict']['action'] = "routes_placeholder"
 
-    
+
     if controller_klass is None:
         controller_klass = TGController
 
     app = ControllerWrap(controller_klass)
-    app = SetupCacheGlobal(app, environ, setup_cache=True, setup_session=True)    
+    app = SetupCacheGlobal(app, environ, setup_cache=True, setup_session=True)
     app = RegistryManager(app)
     app = beaker.middleware.SessionMiddleware(app, {}, data_dir=session_dir)
     app = CacheMiddleware(app, {}, data_dir=os.path.join(data_dir, 'cache'))
 
     # setup pylons.request to point to our Registry
     reg.register(pylons.request, req)
-    
-    
+
+
     # setup tmpl context
     tmpl_context._push_object(ContextObj())
     url._push_object(URLGenerator(default_map, environ))
         tmpl_context._pop_object(self._ctx)
         pylons.config.pop_process_config()
         teardown_session_dir()
-        
+
     def get_response(self, **kargs):
         url = kargs.pop('_url', '/')
         self.environ['pylons.routes_dict'].update(kargs)