Changeset 4542
- Timestamp:
- 04/29/08 06:04:01 (3 months ago)
- Files:
-
- projects/ToscaWidgets/trunk/CHANGELOG.txt (modified) (5 diffs)
- projects/ToscaWidgets/trunk/tw/core/resource_injector.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
projects/ToscaWidgets/trunk/CHANGELOG.txt
r4518 r4542 4 4 0.8.6 (unrealeased) 5 5 ------------------- 6 6 7 * injector_middleware now properly handles wrapped apps that use the write 7 8 func returned by start_response 8 9 10 * Docs are finally hitting the repository! 11 12 * :func:`tw.core.resource_injector.inject_resources` has changed it's 13 signature making ``resources`` an optional parameter and switched places 14 with ``html``. 15 9 16 0.8.5 (Ap3, 25 2008) 10 17 ------------------- 18 11 19 * PylonsHostFramework no longer adds the extra_vars_func by default which 12 20 made available Pylons's SOPs in every widget template namespace since some … … 18 26 0.8.[1,2,3,4] (Apr, 19 2008): 19 27 ----------------------------- 28 20 29 * Fixed various import bugs introduced in 0.8 21 30 22 31 0.8 (Apr. 19 2008): 23 32 ------------------- 33 24 34 * Changed the name of the "toscawidgets" namespace to "tw" and moved all the 25 35 core stuff to tw.core. Now external widget eggs packages get grafted (via … … 29 39 0.3 (Apr. 19 2008): 30 40 ----------------- 41 31 42 * Removed lxml dependency for resource injection. Now using simple 32 43 regular expressions. … … 34 45 0.2 (Jan. 25 2008): 35 46 ------------------- 47 36 48 * Configured apydia to generate API docs. 37 49 * Links now add a v=%(mtime)d parameter to the URL to help against IEs … … 40 52 0.2rc2 (Nov. 19 2007): 41 53 ---------------------- 54 42 55 * Reworded docs/index.txt 43 56 projects/ToscaWidgets/trunk/tw/core/resource_injector.py
r4518 r4542 18 18 import re 19 19 import logging 20 20 21 try: 21 22 from cStringIO import StringIO 22 23 except ImportError: 23 24 from StringIO import StringIO 25 26 from tw import framework 24 27 from tw.core.util import MultipleReplacer 25 28 … … 34 37 """ 35 38 def _injector(environ, start_response): 36 from tw import framework37 39 context = {'inject':False, 'fileobj':StringIO()} 38 40 def determine_response_type(status, headers, exc_info = None): … … 58 60 if hasattr(app_iter, 'close'): 59 61 app_iter.close() 60 # Must try to retrieve resources after consuming app_iter 61 resources = framework.pop_resources() 62 html = inject_resources(resources, html, context['charset']) 62 # Must try to inject resources after consuming app_iter 63 html = inject_resources(html, encoding=context['charset']) 63 64 # Set updated content-length 64 65 headers = [h for h in context['headers'] … … 89 90 return inject 90 91 91 def __call__(self, resources, html, encoding=None):92 def __call__(self, html, resources=None, encoding=None): 92 93 """Injects resources, if any, into html string. 93 94 … … 100 101 empty dict. 101 102 """ 103 if resources is None: 104 resources = framework.pop_resources() 102 105 if resources: 103 106 encoding = encoding or _find_charset(html) or 'ascii'