mirror of
https://github.com/django/django.git
synced 2025-03-03 13:34:26 +00:00
Removed some u string prefixes in code comments.
This commit is contained in:
parent
e7c6a2cf9f
commit
69483e022a
@ -35,7 +35,7 @@ will be raised if the template doesn't have proper syntax.
|
|||||||
Sample code:
|
Sample code:
|
||||||
|
|
||||||
>>> from django import template
|
>>> from django import template
|
||||||
>>> s = u'<html>{% if test %}<h1>{{ varvalue }}</h1>{% endif %}</html>'
|
>>> s = '<html>{% if test %}<h1>{{ varvalue }}</h1>{% endif %}</html>'
|
||||||
>>> t = template.Template(s)
|
>>> t = template.Template(s)
|
||||||
|
|
||||||
(t is now a compiled template, and its render() method can be called multiple
|
(t is now a compiled template, and its render() method can be called multiple
|
||||||
@ -43,10 +43,10 @@ times with multiple contexts)
|
|||||||
|
|
||||||
>>> c = template.Context({'test':True, 'varvalue': 'Hello'})
|
>>> c = template.Context({'test':True, 'varvalue': 'Hello'})
|
||||||
>>> t.render(c)
|
>>> t.render(c)
|
||||||
u'<html><h1>Hello</h1></html>'
|
'<html><h1>Hello</h1></html>'
|
||||||
>>> c = template.Context({'test':False, 'varvalue': 'Hello'})
|
>>> c = template.Context({'test':False, 'varvalue': 'Hello'})
|
||||||
>>> t.render(c)
|
>>> t.render(c)
|
||||||
u'<html></html>'
|
'<html></html>'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@ -756,15 +756,15 @@ class Variable(object):
|
|||||||
be a hard-coded string (if it begins and ends with single or double quote
|
be a hard-coded string (if it begins and ends with single or double quote
|
||||||
marks)::
|
marks)::
|
||||||
|
|
||||||
>>> c = {'article': {'section':u'News'}}
|
>>> c = {'article': {'section':'News'}}
|
||||||
>>> Variable('article.section').resolve(c)
|
>>> Variable('article.section').resolve(c)
|
||||||
u'News'
|
'News'
|
||||||
>>> Variable('article').resolve(c)
|
>>> Variable('article').resolve(c)
|
||||||
{'section': u'News'}
|
{'section': 'News'}
|
||||||
>>> class AClass: pass
|
>>> class AClass: pass
|
||||||
>>> c = AClass()
|
>>> c = AClass()
|
||||||
>>> c.article = AClass()
|
>>> c.article = AClass()
|
||||||
>>> c.article.section = u'News'
|
>>> c.article.section = 'News'
|
||||||
|
|
||||||
(The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
|
(The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user