Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed some formatting bugs in [625]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@626 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit adae680c737eedbf0edd073c886ea42052ea7d02 1 parent f9f0ea9
Adrian Holovaty authored September 06, 2005

Showing 1 changed file with 10 additions and 9 deletions. Show diff stats Hide diff stats

  1. 19  docs/templates_python.txt
19  docs/templates_python.txt
@@ -213,7 +213,7 @@ dictionary syntax::
213 213
 
214 214
 A ``Context`` object is a stack. That is, you can ``push()`` and ``pop()`` it.
215 215
 If you ``pop()`` too much, it'll raise
216  
-``django.core.template.ContextPopException``.
  216
+``django.core.template.ContextPopException``::
217 217
 
218 218
     >>> c = Context()
219 219
     >>> c['foo'] = 'first level'
@@ -258,8 +258,8 @@ instance has the following two extra variables:
258 258
     * ``debug`` -- ``True``. You can use this in templates to test whether
259 259
       you're in ``DEBUG`` mode.
260 260
     * ``sql_queries`` -- A list of ``{'sql': ..., 'time': ...}`` dictionaries,
261  
-      representing every SQL query that has happened so far during the request.
262  
-      The list is in order by query.
  261
+      representing every SQL query that has happened so far during the request
  262
+      and how long it took. The list is in order by query.
263 263
 
264 264
 Feel free to subclass ``Context`` yourself if you find yourself wanting to give
265 265
 each template something "automatically." For instance, if you want to give
@@ -277,8 +277,8 @@ This technique has two caveats:
277 277
     * You'll have to remember to use ``TimeContext`` instead of ``Context`` in
278 278
       your template-loading code.
279 279
 
280  
-    * You'll have to be careful not to set the variable ``current_time`` within
281  
-      your templates. If you do, you'll override the other one.
  280
+    * You'll have to be careful not to set the variable ``current_time`` when
  281
+      you populate this context. If you do, you'll override the other one.
282 282
 
283 283
 Loading templates
284 284
 -----------------
@@ -411,7 +411,7 @@ Custom filters are just Python functions that take two arguments:
411 411
 
412 412
 Filter functions should always return something. They shouldn't raise
413 413
 exceptions. They should fail silently. In case of error, they should return
414  
-either the original input or the empty string -- whichever makes more sense.
  414
+either the original input or an empty string -- whichever makes more sense.
415 415
 
416 416
 Here's an example filter definition::
417 417
 
@@ -428,13 +428,13 @@ definition. Example::
428 428
         return value.lower()
429 429
 
430 430
 When you've written your filter definition, you need to register it, to make it
431  
-available to Django's template language.
  431
+available to Django's template language::
432 432
 
433 433
     from django.core import template
434 434
     template.register_filter('cut', cut, True)
435 435
     template.register_filter('lower', lower, False)
436 436
 
437  
-``register_filter`` takes three arguments::
  437
+``register_filter`` takes three arguments:
438 438
 
439 439
     1. The name of the filter -- a string
440 440
     2. The Python function
@@ -460,6 +460,7 @@ When Django compiles a template, it splits the raw template text into
460 460
 a ``render()`` method. A compiled template is, simply, a list of ``Node``
461 461
 objects. When you call ``render()`` on a compiled template object, the template
462 462
 calls ``render()`` on each ``Node`` in its node list, with the given context.
  463
+The results are all concatenated together to form the output of the template.
463 464
 
464 465
 Thus, to define a custom template tag, you specify how the raw template tag is
465 466
 converted into a ``Node`` (the compilation function), and what the node's
@@ -576,7 +577,7 @@ you allow template authors to reuse the values that your template tags create.
576 577
 To set a variable in the context, just use dictionary assignment on the context
577 578
 object in the ``render()`` method. Here's an updated version of
578 579
 ``CurrentTimeNode`` that sets a template variable ``current_time`` instead of
579  
-outputting it.
  580
+outputting it::
580 581
 
581 582
     class CurrentTimeNode2(template.Node):
582 583
         def __init__(self, format_string):

0 notes on commit adae680

Please sign in to comment.
Something went wrong with that request. Please try again.