1. Ralph Bean
  2. tg-dev


percious  committed 60e5bc8

pylons 0.10 support started

  • Participants
  • Parent commits 16a6272
  • Branches default

Comments (0)

Files changed (4)

File tg/configuration.py

View file
 import atexit
 import os
 import logging
+import warnings
 from copy import copy
 import mimetypes
 from UserDict import DictMixin
         #see http://trac.turbogears.org/ticket/2247
         if asbool(config['debug']):
+            warnings.simplefilter("ignore")
             config['pylons.strict_c'] = True
+            warnings.resetwarnings()
+            config['pylons.stritmpl_contextt_tmpl_context'] = True
     def after_init_config(self):
         Override this method to set up configuration variables at the application
         level.  This method will be called after your configuration object has
         been initialized on startup.  Here is how you would use it to override
-        the default setting of pylons.strict_c ::
+        the default setting of pylons.stritmpl_contextt_tmpl_context ::
             from tg.configuration import AppConfig
             from pylons import config
             class MyAppConfig(AppConfig):
                 def after_init_config(self):
-                    config['pylons.strict_c'] = False
+                    config['pylons.stritmpl_contextt_tmpl_context'] = False
             base_config = MyAppConfig()
                  [FileSystemLoader(path) for path in self.paths['templates']]),
         # Jinja's unable to request c's attributes without strict_c
+        warnings.simplefilter("ignore")
         config['pylons.strict_c'] = True
+        warnings.resetwarnings()
+        config['pylons.stritmpl_contextt_tmpl_context'] = True
         self.render_functions.jinja = render_jinja

File tg/test_stack/dispatch/controllers/root.py

View file
     def redirect_sub(self):
     def redirect_list(self):
         tg.redirect(["/sub2", "list"])
     def custom_content_type(self):
         return 'PNG'
     def custom_content_text_plain_type(self):
         return 'a<br/>bx'
     def custom_content_type2(self):
         pylons.response.headers['Content-Type'] = 'image/png'
         return 'PNG2'
     def check_params(self, *args, **kwargs):
         if not args and not kwargs:
             return "None recieved"
-            return "Controler recieved: %s, %s" %(args, kwargs) 
+            return "Controler recieved: %s, %s" %(args, kwargs)
     def test_url_sop(self):
         from tg import url
         eq_('/foo', url('/foo'))
         u = url("/foo", bar=1, baz=2)
         assert u in \
                 ["/foo?bar=1&baz=2", "/foo?baz=2&bar=1"], u

File tg/test_stack/dispatch/test_url_dispatch.py

View file
 from tg.util import no_warn
 def setup_noDB():
-    base_config = TestConfig(folder = 'dispatch', 
+    base_config = TestConfig(folder = 'dispatch',
                              values = {'use_sqlalchemy': False,
                              'ignore_parameters': ["ignore", "ignore_me"]
-    return app_from_config(base_config) 
+    return app_from_config(base_config)
 app = setup_noDB()
     resp = resp.follow()
     assert 'hello world' in resp, resp
 def test_redirect_relative():
     resp = app.get('/redirect_me?target=hello&name=abc')
     resp = resp.follow()
 def test_subcontroller_redirect_no_slash_sub2index():
     assert'hello list' in resp, resp
 def test_redirect_to_list_of_strings():
     resp = app.get('/sub/redirect_list').follow()
     assert 'hello list' in resp, resp
     assert 'text/plain; charset=utf-8' == dict(resp.headers)['Content-Type'], resp
     assert resp.body == """a<br/>bx""", resp
 def test_custom_content_type2():
     resp = app.get('/custom_content_type2')
     assert 'image/png' == dict(resp.headers)['Content-Type'], resp
     assert resp.body == 'PNG2', resp
 def test_basicurls():
     resp = app.get("/test_url_sop")
 def test_ignore_parameters():
     resp = app.get("/check_params?ignore='bar'&ignore_me='foo'")
     assert "None Recieved"
 def test_json_return_list():
     resp = app.get("/json_return_list")
     assert "None Recieved"
 def test_https_redirect():
     resp = app.get("/test_https?foo=bar&baz=bat")
     assert 'https://' in resp, resp
     params = variable_encode(dict(obj=obj), add_repetitions=False)
     resp = app.get('/test_vardec', params=params)
     assert resp.json['obj'] == obj, (resp.json['obj'], obj)

File tg/tests/base.py

View file
 import os, shutil
 from unittest import TestCase
 from xmlrpclib import loads, dumps
+import warnings
 import webob
 import beaker
         'pylons.request_options': pylons.configuration.request_defaults.copy(),
         'pylons.response_options': pylons.configuration.response_defaults.copy(),
         'pylons.strict_c': False,
+        'pylons.stritmpl_contextt_tmpl_context':False,
         'pylons.c_attach_args': True,
         'pylons.tmpl_context_attach_args': True,
         'buffet.template_engines': [],
         tmpl_options['genshi.search_path'] = ['tests']
         self._ctx = ContextObj()
+        warnings.simplefilter("ignore")
+        warnings.resetwarnings()
     def tearDown(self):
+        pylons.config.pop_thread_config()