mirror of https://github.com/pallets/flask.git
				
				
				
			Fixed a documentation error. This fixes #143
This commit is contained in:
		
							parent
							
								
									858806da69
								
							
						
					
					
						commit
						2ac1b7d438
					
				|  | @ -81,16 +81,23 @@ context are appended to it. | ||||||
| Additionally there is a convenient helper method | Additionally there is a convenient helper method | ||||||
| (:meth:`~blinker.base.Signal.connected_to`).  that allows you to | (:meth:`~blinker.base.Signal.connected_to`).  that allows you to | ||||||
| temporarily subscribe a function to a signal with is a context manager on | temporarily subscribe a function to a signal with is a context manager on | ||||||
| its own which simplifies the example above:: | its own.  Because the return value of the context manager cannot be | ||||||
|  | specified that way one has to pass the list in as argument:: | ||||||
| 
 | 
 | ||||||
|     from flask import template_rendered |     from flask import template_rendered | ||||||
| 
 | 
 | ||||||
|     def captured_templates(app): |     def captured_templates(app, recorded): | ||||||
|         recorded = [] |  | ||||||
|         def record(sender, template, context): |         def record(sender, template, context): | ||||||
|             recorded.append((template, context)) |             recorded.append((template, context)) | ||||||
|         return template_rendered.connected_to(record, app) |         return template_rendered.connected_to(record, app) | ||||||
| 
 | 
 | ||||||
|  | The example above would then look like this:: | ||||||
|  | 
 | ||||||
|  |     templates = [] | ||||||
|  |     with captured_templates(app, templates): | ||||||
|  |         ... | ||||||
|  |         template, context = templates[0] | ||||||
|  | 
 | ||||||
| .. admonition:: Blinker API Changes | .. admonition:: Blinker API Changes | ||||||
| 
 | 
 | ||||||
|    The :meth:`~blinker.base.Signal.connected_to` method arrived in Blinker |    The :meth:`~blinker.base.Signal.connected_to` method arrived in Blinker | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue