Django

Code

Changeset 4502

Show
Ignore:
Timestamp:
02/13/07 09:44:04 (2 years ago)
Author:
adrian
Message:

Renamed date_to_format function in docs/templates_python.txt example so as to make it not sound like a conversion function. Thanks, linoj

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/templates_python.txt

    r4477 r4502  
    830830        try: 
    831831            # split_contents() knows not to split quoted strings. 
    832             tag_name, date_to_format, format_string = token.split_contents() 
     832            tag_name, date_to_be_formatted, format_string = token.split_contents() 
    833833        except ValueError: 
    834834            raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents[0] 
    835835        if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")): 
    836836            raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name 
    837         return FormatTimeNode(date_to_format, format_string[1:-1]) 
     837        return FormatTimeNode(date_to_be_formatted, format_string[1:-1]) 
    838838 
    839839You also have to change the renderer to retrieve the actual contents of the 
     
    847847    import datetime 
    848848    class FormatTimeNode(template.Node): 
    849         def __init__(self, date_to_format, format_string): 
    850             self.date_to_format = date_to_format 
     849        def __init__(self, date_to_be_formatted, format_string): 
     850            self.date_to_be_formatted = date_to_be_formatted 
    851851            self.format_string = format_string 
    852852         
    853853        def render(self, context): 
    854854            try: 
    855                 actual_date = resolve_variable(self.date_to_format, context) 
     855                actual_date = resolve_variable(self.date_to_be_formatted, context) 
    856856                return actual_date.strftime(self.format_string) 
    857857            except VariableDoesNotExist: