Thanks Sanjiv. This fix make me reallize that we likely to change the text of the deprecation message for returning widgets in the response dictionary, or even just drop it. I think returning widgets in the response dictionary is a bit odd, from an MVC standpoint, and it introduces some strangeness if you expose the method using JSON or other non-template based renderers.
What does evrybody think? ---------- Forwarded message ---------- From: <[EMAIL PROTECTED]> Date: Thu, Jun 26, 2008 at 2:38 AM Subject: [turbogears-commits] r4820 - in trunk/tg: . tests To: [EMAIL PROTECTED] Author: sanjiv Date: Thu Jun 26 01:38:54 2008 New Revision: 4820 URL: http://trac.turbogears.org/changeset/4820 Log: fixed minor typos in docstrings Modified: trunk/tg/__init__.py trunk/tg/controllers.py trunk/tg/tests/test_validation.py Modified: trunk/tg/__init__.py ============================================================================== --- trunk/tg/__init__.py (original) +++ trunk/tg/__init__.py Thu Jun 26 01:38:54 2008 @@ -13,7 +13,7 @@ TurboGears 0.5 release was just a few hundred lines of Python code, but it built on thousands of lines of code in other libraries. Those libraries had -alreay been deployed, used, and tested, and were known to be +already been deployed, used, and tested, and were known to be "production ready." TurboGears2 returns to that philosophy. It is built on Pylons, but it brings Modified: trunk/tg/controllers.py ============================================================================== --- trunk/tg/controllers.py (original) +++ trunk/tg/controllers.py Thu Jun 26 01:38:54 2008 @@ -128,7 +128,7 @@ Validation can "clean" or otherwise modify the parameters that were passed in, not just raise an exception. Validation exceptions should - be FormEncode Invalid objets. + be FormEncode Invalid objects. """ validation = getattr(controller.decoration, 'validation', None) @@ -210,13 +210,13 @@ return response # Deprecation warnings if people return a widget in the dict rather - # than setting it on tmpl_context.w + # than setting it on tmpl_context if isinstance(response, dict): for key, item in response.iteritems(): if isinstance(item, Widget): msg = "Returning a widget is deprecated, set them on pylons.widgets instead" warnings.warn(msg, DeprecationWarning) - setattr(pylons.c.w, key, item) + setattr(pylons.tmpl_context, key, item) # Prepare the engine, if it's not already been prepared. if engine_name not in _configured_engines(): Modified: trunk/tg/tests/test_validation.py ============================================================================== --- trunk/tg/tests/test_validation.py (original) +++ trunk/tg/tests/test_validation.py Thu Jun 26 01:38:54 2008 @@ -90,7 +90,7 @@ assert '{"response": 22}'in resp def test_for_other_params_after_validation(self): - "Ensrue that both validated and unvalidated data make it through" + "Ensure that both validated and unvalidated data make it through" form_values = {'a':1, 'b':"string"} resp = self.app.post('/validated_and_unvalidated', form_values) assert '"int": 1' in resp -- Mark Ramm-Christensen email: mark at compoundthinking dot com blog: www.compoundthinking.com/blog --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
