For å installere bokmerker, dra linken til verktøylinja\n"
+"for bokmerker, eller høyreklikk og legg til i bokmerker. Nå kan du du velge\n"
+"bokmerket fra hvilken som helst side på nettstedet. Noen av disse\n"
+"bokmerkene krever at datamaskinen du bruker er markert som \"intern\"\n"
+"(kontakt din systemadministrator hvis du er usikker på om maskinen din er \"intern\").
\n"
#: contrib/admin/templates/admin_doc/bookmarklets.html:19
msgid "Documentation for this page"
@@ -1033,8 +1020,7 @@ msgstr "Endre dette objektet (åpnes i dette vinduet)"
#: contrib/admin/templates/admin_doc/bookmarklets.html:26
msgid "Jumps to the admin page for pages that represent a single object."
-msgstr ""
-"Hopp til administrasjonsiden for sidene som representerer et enkelt objekt."
+msgstr "Hopp til administrasjonsiden for sidene som representerer et enkelt objekt."
#: contrib/admin/templates/admin_doc/bookmarklets.html:28
msgid "Edit this object (new window)"
@@ -1069,7 +1055,7 @@ msgid ""
"This should be an absolute path, excluding the domain name. Example: '/"
"events/search/'."
msgstr ""
-"Denne burde vær en fullstendig sti, uten domene navnet. Foreksempel: '/"
+"Dette burde vært en fullstendig sti, uten domene navnet. Foreksempel: '/"
"nyheter/les/"
#: contrib/redirects/models.py:9
@@ -1081,7 +1067,7 @@ msgid ""
"This can be either an absolute path (as above) or a full URL starting with "
"'http://'."
msgstr ""
-"Denne kan enten være en fullstendig sti (som over), eller en hel "
+"Dette kan enten være en fullstendig sti (som over), eller en hel "
"internettadresse som starter med 'http://'"
#: contrib/redirects/models.py:12
@@ -1093,10 +1079,8 @@ msgid "redirects"
msgstr "omadresserelser"
#: contrib/flatpages/models.py:8
-msgid ""
-"Example: '/about/contact/'. Make sure to have leading and trailing slashes."
-msgstr ""
-"Eksempel: '/om/kontakt/'. Vær sikker på at du har en skråstrek forran og bak."
+msgid "Example: '/about/contact/'. Make sure to have leading and trailing slashes."
+msgstr "Eksempel: '/om/kontakt/'. Vær sikker på at du har en skråstrek forran og bak."
#: contrib/flatpages/models.py:9
msgid "title"
@@ -1186,7 +1170,7 @@ msgstr "passord"
#: contrib/auth/models.py:59
msgid "Use '[algo]$[salt]$[hexdigest]'"
-msgstr ""
+msgstr "Bruk '[algo]$[salt]$[hexdigest]'"
#: contrib/auth/models.py:60
msgid "staff status"
@@ -1256,7 +1240,7 @@ msgstr "Melding"
msgid ""
"Your Web browser doesn't appear to have cookies enabled. Cookies are "
"required for logging in."
-msgstr ""
+msgstr "Din nettleser ser ikkeut til å støtte informasjonskapsler (cookies). Informasjonskapsler er påkrevd for å logge inn."
#: contrib/contenttypes/models.py:25
msgid "python model class name"
@@ -1698,8 +1682,7 @@ msgstr "Internettadressen %s peker ikke til et godkjent bilde."
#: core/validators.py:159
#, python-format
msgid "Phone numbers must be in XXX-XXX-XXXX format. \"%s\" is invalid."
-msgstr ""
-"Telefon nummeret må være i XXX-XXX-XXXX format. \"%s\" er ikke godkjent."
+msgstr "Telefon nummeret må være i XXX-XXX-XXXX format. \"%s\" er ikke godkjent."
#: core/validators.py:167
#, python-format
@@ -1784,30 +1767,26 @@ msgstr "Vennligst skriv inn et godkjent desimal tall."
#: core/validators.py:349
#, python-format
msgid "Please enter a valid decimal number with at most %s total digit."
-msgid_plural ""
-"Please enter a valid decimal number with at most %s total digits."
+msgid_plural "Please enter a valid decimal number with at most %s total digits."
msgstr[0] "Skriv inn et desimal tall med maksimum %s total antall tall."
msgstr[1] "Skriv inn et desimal tall med maksimum %s total antall tall."
#: core/validators.py:352
#, python-format
msgid "Please enter a valid decimal number with at most %s decimal place."
-msgid_plural ""
-"Please enter a valid decimal number with at most %s decimal places."
+msgid_plural "Please enter a valid decimal number with at most %s decimal places."
msgstr[0] "Skriv inn et desimal tall med maksimum %s tall bak komma. "
msgstr[1] "Skriv inn et desimal tall med maksimum %s tall bak komma. "
#: core/validators.py:362
#, python-format
msgid "Make sure your uploaded file is at least %s bytes big."
-msgstr ""
-"Vær sikker på at fila du prøver å laste opp er minimum %s bytes stor."
+msgstr "Vær sikker på at fila du prøver å laste opp er minimum %s bytes stor."
#: core/validators.py:363
#, python-format
msgid "Make sure your uploaded file is at most %s bytes big."
-msgstr ""
-"Vær sikker på at fila du prøver å laste opp er maksimum %s bytes stor."
+msgstr "Vær sikker på at fila du prøver å laste opp er maksimum %s bytes stor."
#: core/validators.py:376
msgid "The format for this field is wrong."
@@ -1824,8 +1803,7 @@ msgstr "Klarte ikke å motta noe fra %s."
#: core/validators.py:429
#, python-format
-msgid ""
-"The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'."
+msgid "The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'."
msgstr ""
"Internettadressen %(url)s returnerte en ikke godkjent Content-Type '%"
"(contenttype)s'."
@@ -1926,16 +1904,13 @@ msgid "Separate multiple IDs with commas."
msgstr "Separer Id-ene med kommaer."
#: db/models/fields/related.py:581
-msgid ""
-"Hold down \"Control\", or \"Command\" on a Mac, to select more than one."
-msgstr ""
-"Hold nede \"Control\", eller \"Command\" på en Mac, for å velge mere enn en."
+msgid "Hold down \"Control\", or \"Command\" on a Mac, to select more than one."
+msgstr "Hold nede \"Control\", eller \"Command\" på en Mac, for å velge mere enn en."
#: db/models/fields/related.py:625
#, python-format
msgid "Please enter valid %(self)s IDs. The value %(value)r is invalid."
-msgid_plural ""
-"Please enter valid %(self)s IDs. The values %(value)r are invalid."
+msgid_plural "Please enter valid %(self)s IDs. The values %(value)r are invalid."
msgstr[0] "Skriv inn gyldige %(self)s ID-er. Verdien %(value)r er ikke gyldig."
msgstr[1] "Skriv inn gyldige %(self)s ID-er. Verdiene %(value)r er ikke gyldige."
diff --git a/django/conf/locale/no/LC_MESSAGES/djangojs.mo b/django/conf/locale/no/LC_MESSAGES/djangojs.mo
index 4b23aba4e0013b2c5fce91d32d64172297a67f4a..da2854f72e52e166ab19361fe14fa7757377ea91 100644
GIT binary patch
delta 718
zcmZ9}O>5Lp6vpv8Gif{R)KBk6bIE%wLhjqN`<`?l4M_yXfI-Try_cyyZfLj@-mC
zs?kqW;}cY2-SlAuRp2_#VjER>4OOQ=HQvIjEMnKqf8ZrbnSDHqAF)n<^MwmF`sOAM
zPz8>$fxnQ$^wUMpHBb$koECA+jh{N#k)Gzc8^1s;Up`0{(|PT<%)BpwpYJPMfIHCQH+om$N>%hi}P-L8nt?b78P9Nq_1g`3T@FSc}4?5
zJE2|p8)c<>bD&pPKTgxV`RcVweR(y`lHO`jKC3-gm<+?2AZ!PdGk!STnTjSt?hM_J
zi;bY0$61la8@;^ab0iN3_{efAoaKOuWkmjD0&
delta 673
zcmXxhO-ma=7{KvKvc{OCzNUH+x}|tfi6AIQ6m@Nv7_6pEqM!$5(YOj`BY8RJq6a}J
zxcCJ;cx(@fH$6z{p^#hXMeyLs&rm%0f68>&XMQ{L?94N}dlYZQ8jrokxuOjagG7sX
zN1O)eXpx{&VeG&Vc4Hh97{T{CKZ0)l^A?CvH&++@loy
zg|cB2O?*Jv;032Jz{9d}3gsa4D1|dP$>H-lf5IY`sBhSZXDH8KVwn2shfdsJjKpu`
zQh(^=AP*>oo-l{cdOXdf%v*HSQfWP2LOJ+X9KtP>{4q}83391Bx(M~vPi~}86XmOS
z6LJt~U4)!gHtZp&{jc?F6IyxmC?UV5laM!+qSB;TJJCx>owtNE`Q?&RL4P=CUDbm_
zfvzvs$0aLmn`?G1pUJNH7oq&lx^3l>%h}{7%UsN+mNTOp*%dqb*{Rl&g^J@<51d-L
zk}~b;VbL?wm3?n#AlSOi?Dr-2W5vZpqm{7~3wFW?AgHb;m6x3q_}tGQF}tWlV, 2006.
#
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: djangojs\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-12-09 11:51+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Espen Grindhaug \n"
-"Language-Team: no\n"
+"PO-Revision-Date: 2007-04-27 06:51+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
+"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
@@ -21,7 +22,6 @@ msgid "Available %s"
msgstr "%s er tilgjengelige"
#: contrib/admin/media/js/SelectFilter2.js:41
-#, fuzzy
msgid "Choose all"
msgstr "Velg alle"
@@ -116,3 +116,4 @@ msgstr "I går"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:164
msgid "Tomorrow"
msgstr "I morgen"
+
diff --git a/django/core/management.py b/django/core/management.py
index d696794fc6..4a08b1e54d 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -173,6 +173,8 @@ def _get_sql_model_create(model, known_models=set()):
for f in opts.fields:
if isinstance(f, (models.ForeignKey, models.OneToOneField)):
rel_field = f.rel.get_related_field()
+ while isinstance(rel_field, (models.ForeignKey, models.OneToOneField)):
+ rel_field = rel_field.rel.get_related_field()
data_type = get_rel_data_type(rel_field)
else:
rel_field = f
@@ -1377,6 +1379,8 @@ def load_data(fixture_labels, verbosity=1):
from django.conf import settings
import sys
+ disable_termcolors()
+
# Keep a count of the installed objects and fixtures
count = [0,0]
models = set()
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index 3df7a9e834..9fafd20787 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -122,7 +122,14 @@ class BaseForm(StrAndUnicode):
else:
if errors_on_separate_row and bf_errors:
output.append(error_row % bf_errors)
- label = bf.label and bf.label_tag(escape(bf.label + ':')) or ''
+ if bf.label:
+ label = escape(bf.label)
+ # Only add a colon if the label does not end in punctuation.
+ if label[-1] not in ':?.!':
+ label += ':'
+ label = bf.label_tag(label) or ''
+ else:
+ label = ''
if field.help_text:
help_text = help_text_html % field.help_text
else:
diff --git a/django/template/__init__.py b/django/template/__init__.py
index a592765db6..6478636889 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -193,18 +193,27 @@ class Lexer(object):
def tokenize(self):
"Return a list of tokens from a given template_string"
- # remove all empty strings, because the regex has a tendency to add them
- bits = filter(None, tag_re.split(self.template_string))
- return map(self.create_token, bits)
+ in_tag = False
+ result = []
+ for bit in tag_re.split(self.template_string):
+ if bit:
+ result.append(self.create_token(bit, in_tag))
+ in_tag = not in_tag
+ return result
- def create_token(self,token_string):
- "Convert the given token string into a new Token object and return it"
- if token_string.startswith(VARIABLE_TAG_START):
- token = Token(TOKEN_VAR, token_string[len(VARIABLE_TAG_START):-len(VARIABLE_TAG_END)].strip())
- elif token_string.startswith(BLOCK_TAG_START):
- token = Token(TOKEN_BLOCK, token_string[len(BLOCK_TAG_START):-len(BLOCK_TAG_END)].strip())
- elif token_string.startswith(COMMENT_TAG_START):
- token = Token(TOKEN_COMMENT, '')
+ def create_token(self, token_string, in_tag):
+ """
+ Convert the given token string into a new Token object and return it.
+ If tag is True, we are processing something that matched a tag,
+ otherwise it should be treated as a literal string.
+ """
+ if in_tag:
+ if token_string.startswith(VARIABLE_TAG_START):
+ token = Token(TOKEN_VAR, token_string[len(VARIABLE_TAG_START):-len(VARIABLE_TAG_END)].strip())
+ elif token_string.startswith(BLOCK_TAG_START):
+ token = Token(TOKEN_BLOCK, token_string[len(BLOCK_TAG_START):-len(BLOCK_TAG_END)].strip())
+ elif token_string.startswith(COMMENT_TAG_START):
+ token = Token(TOKEN_COMMENT, '')
else:
token = Token(TOKEN_TEXT, token_string)
return token
@@ -215,21 +224,21 @@ class DebugLexer(Lexer):
def tokenize(self):
"Return a list of tokens from a given template_string"
- token_tups, upto = [], 0
+ result, upto = [], 0
for match in tag_re.finditer(self.template_string):
start, end = match.span()
if start > upto:
- token_tups.append( (self.template_string[upto:start], (upto, start)) )
+ result.append(self.create_token(self.template_string[upto:start], (upto, start), False))
upto = start
- token_tups.append( (self.template_string[start:end], (start,end)) )
+ result.append(self.create_token(self.template_string[start:end], (start, end), True))
upto = end
last_bit = self.template_string[upto:]
if last_bit:
- token_tups.append( (last_bit, (upto, upto + len(last_bit))) )
- return [self.create_token(tok, (self.origin, loc)) for tok, loc in token_tups]
+ result.append(self.create_token(last_bit, (upto, upto + len(last_bit)), False))
+ return result
- def create_token(self, token_string, source):
- token = super(DebugLexer, self).create_token(token_string)
+ def create_token(self, token_string, source, in_tag):
+ token = super(DebugLexer, self).create_token(token_string, in_tag)
token.source = source
return token
diff --git a/docs/email.txt b/docs/email.txt
index 1f4ce4ef42..cbe909c03c 100644
--- a/docs/email.txt
+++ b/docs/email.txt
@@ -19,13 +19,23 @@ In two lines::
send_mail('Subject here', 'Here is the message.', 'from@example.com',
['to@example.com'], fail_silently=False)
-
+
+Mail will be sent using the SMTP host and port specified in the `EMAIL_HOST`_
+and `EMAIL_PORT`_ settings. The `EMAIL_HOST_USER`_ and `EMAIL_HOST_PASSWORD`_
+settings, if set, will be used to authenticate to the
+SMTP server.
+
.. note::
The character set of email sent with ``django.core.mail`` will be set to
the value of your `DEFAULT_CHARSET setting`_.
-
+
.. _DEFAULT_CHARSET setting: ../settings/#DEFAULT_CHARSET
+.. _EMAIL_HOST: ../settings/#EMAIL_HOST
+.. _EMAIL_PORT: ../settings/#EMAIL_PORT
+.. _EMAIL_HOST_USER: ../settings/#EMAIL_HOST_USER
+.. _EMAIL_HOST_PASSWORD: ../settings/#EMAIL_HOST_PASSWORD
+
send_mail()
===========
diff --git a/docs/forms.txt b/docs/forms.txt
index 144b70f13b..329e84a1b1 100644
--- a/docs/forms.txt
+++ b/docs/forms.txt
@@ -517,7 +517,7 @@ to put punctuation at the end of your validation messages.
When are validators called?
---------------------------
-After a form has been submitted, Django validates each field in turn. First,
+After a form has been submitted, Django validates each field in turn. First,
if the field is required, Django checks that it is present and non-empty. Then,
if that test passes *and the form submission contained data* for that field, all
the validators for that field are called in turn. The emphasized portion in the
@@ -615,15 +615,19 @@ fails. If no message is passed in, a default message is used.
``other_value``, then the validators in ``validator_list`` are all run
against the current field.
+``RequiredIfOtherFieldGiven``
+ Takes a field name of the current field is only required if the other
+ field has a value.
+
+``RequiredIfOtherFieldsGiven``
+ Similar to ``RequiredIfOtherFieldGiven``, except that it takes a list of
+ field names and if any one of the supplied fields has a value provided,
+ the current field being validated is required.
+
``RequiredIfOtherFieldNotGiven``
Takes the name of the other field and this field is only required if the
other field has no value.
-``RequiredIfOtherFieldsNotGiven``
- Similar to ``RequiredIfOtherFieldNotGiven``, except that it takes a list
- of field names and if any one of the supplied fields does not have a value
- provided, the field being validated is required.
-
``RequiredIfOtherFieldEquals`` and ``RequiredIfOtherFieldDoesNotEqual``
Each of these validator classes takes a field name and a value (in that
order). If the given field does (or does not have, in the latter case) the
@@ -650,8 +654,8 @@ fails. If no message is passed in, a default message is used.
``NumberIsInRange``
Takes two boundary numbers, ``lower`` and ``upper``, and checks that the
field is greater than ``lower`` (if given) and less than ``upper`` (if
- given).
-
+ given).
+
Both checks are inclusive. That is, ``NumberIsInRange(10, 20)`` will allow
values of both 10 and 20. This validator only checks numeric values
(e.g., float and integer values).
diff --git a/docs/settings.txt b/docs/settings.txt
index 9ab5f5ff82..583c258bd3 100644
--- a/docs/settings.txt
+++ b/docs/settings.txt
@@ -395,8 +395,9 @@ EMAIL_HOST_PASSWORD
Default: ``''`` (Empty string)
-Username to use for the SMTP server defined in ``EMAIL_HOST``. If empty,
-Django won't attempt authentication.
+Password to use for the SMTP server defined in ``EMAIL_HOST``. This setting is
+used in conjunction with EMAIL_HOST_USER when authenticating to the SMTP server.
+If either of these settings is empty, Django won't attempt authenticaion.
See also ``EMAIL_HOST_USER``.
diff --git a/tests/regressiontests/forms/localflavor.py b/tests/regressiontests/forms/localflavor.py
index 0efec8cfa8..f725fb38b7 100644
--- a/tests/regressiontests/forms/localflavor.py
+++ b/tests/regressiontests/forms/localflavor.py
@@ -874,6 +874,60 @@ ValidationError: [u'This field requires only numbers.']
>>> f.clean('')
u''
+# BRCPFField #################################################################
+
+>>> from django.contrib.localflavor.br.forms import BRCPFField
+>>> f = BRCPFField()
+>>> f.clean('')
+Traceback (most recent call last):
+...
+ValidationError: [u'This field is required.']
+>>> f.clean(None)
+Traceback (most recent call last):
+...
+ValidationError: [u'This field is required.']
+>>> f.clean('489.294.654-54')
+Traceback (most recent call last):
+...
+ValidationError: [u'Invalid CPF number.']
+>>> f.clean('295.669.575-98')
+Traceback (most recent call last):
+...
+ValidationError: [u'Invalid CPF number.']
+>>> f.clean('539.315.127-22')
+Traceback (most recent call last):
+...
+ValidationError: [u'Invalid CPF number.']
+>>> f.clean('663.256.017-26')
+u'663.256.017-26'
+>>> f.clean('66325601726')
+u'66325601726'
+>>> f.clean('375.788.573-20')
+u'375.788.573-20'
+>>> f.clean('84828509895')
+u'84828509895'
+>>> f.clean('375.788.573-XX')
+Traceback (most recent call last):
+...
+ValidationError: [u'This field requires only numbers.']
+>>> f.clean('375.788.573-000')
+Traceback (most recent call last):
+...
+ValidationError: [u'Ensure this value has at most 14 characters.']
+>>> f.clean('123.456.78')
+Traceback (most recent call last):
+...
+ValidationError: [u'Ensure this value has at least 11 characters.']
+>>> f.clean('123456789555')
+Traceback (most recent call last):
+...
+ValidationError: [u'This field requires at most 11 digits or 14 characters.']
+>>> f = BRCPFField(required=False)
+>>> f.clean('')
+u''
+>>> f.clean(None)
+u''
+
# BRPhoneNumberField #########################################################
>>> from django.contrib.localflavor.br.forms import BRPhoneNumberField
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py
index e0d05a2c89..0d3a65277c 100644
--- a/tests/regressiontests/forms/tests.py
+++ b/tests/regressiontests/forms/tests.py
@@ -2601,6 +2601,27 @@ underscores converted to spaces, and the initial letter capitalized.
Password1:
Password (again):
+Labels for as_* methods will only end in a colon if they don't end in other
+punctuation already.
+>>> class Questions(Form):
+... q1 = CharField(label='The first question')
+... q2 = CharField(label='What is your name?')
+... q3 = CharField(label='The answer to life is:')
+... q4 = CharField(label='Answer this question!')
+... q5 = CharField(label='The last question. Period.')
+>>> print Questions(auto_id=False).as_p()
+
The first question:
+
What is your name?
+
The answer to life is:
+
Answer this question!
+
The last question. Period.
+>>> print Questions().as_p()
+
+
+
+
+
+
A label can be a Unicode object or a bytestring with special characters.
>>> class UserRegistration(Form):
... username = CharField(max_length=10, label='ŠĐĆŽćžšđ')
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index f996f63049..4e321b2d2b 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -127,6 +127,18 @@ class Templates(unittest.TestCase):
# Fail silently when accessing a non-simple method
'basic-syntax20': ("{{ var.method2 }}", {"var": SomeClass()}, ("","INVALID")),
+ # Don't get confused when parsing something that is almost, but not
+ # quite, a template tag.
+ 'basic-syntax21': ("a {{ moo %} b", {}, "a {{ moo %} b"),
+ 'basic-syntax22': ("{{ moo #}", {}, "{{ moo #}"),
+
+ # Will try to treat "moo #} {{ cow" as the variable. Not ideal, but
+ # costly to work around, so this triggers an error.
+ 'basic-syntax23': ("{{ moo #} {{ cow }}", {"cow": "cow"}, template.TemplateSyntaxError),
+
+ # Embedded newlines make it not-a-tag.
+ 'basic-syntax24': ("{{ moo\n }}", {}, "{{ moo\n }}"),
+
# List-index syntax allows a template to access a certain item of a subscriptable object.
'list-index01': ("{{ var.1 }}", {"var": ["first item", "second item"]}, "second item"),
@@ -151,60 +163,61 @@ class Templates(unittest.TestCase):
'list-index07': ("{{ var.1 }}", {"var": {'1': "hello", 1: "world"}}, "hello"),
# Basic filter usage
- 'basic-syntax21': ("{{ var|upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),
+ 'filter-syntax01': ("{{ var|upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),
# Chained filters
- 'basic-syntax22': ("{{ var|upper|lower }}", {"var": "Django is the greatest!"}, "django is the greatest!"),
+ 'filter-syntax02': ("{{ var|upper|lower }}", {"var": "Django is the greatest!"}, "django is the greatest!"),
# Raise TemplateSyntaxError for space between a variable and filter pipe
- 'basic-syntax23': ("{{ var |upper }}", {}, template.TemplateSyntaxError),
+ 'filter-syntax03': ("{{ var |upper }}", {}, template.TemplateSyntaxError),
# Raise TemplateSyntaxError for space after a filter pipe
- 'basic-syntax24': ("{{ var| upper }}", {}, template.TemplateSyntaxError),
+ 'filter-syntax04': ("{{ var| upper }}", {}, template.TemplateSyntaxError),
# Raise TemplateSyntaxError for a nonexistent filter
- 'basic-syntax25': ("{{ var|does_not_exist }}", {}, template.TemplateSyntaxError),
+ 'filter-syntax05': ("{{ var|does_not_exist }}", {}, template.TemplateSyntaxError),
# Raise TemplateSyntaxError when trying to access a filter containing an illegal character
- 'basic-syntax26': ("{{ var|fil(ter) }}", {}, template.TemplateSyntaxError),
+ 'filter-syntax06': ("{{ var|fil(ter) }}", {}, template.TemplateSyntaxError),
# Raise TemplateSyntaxError for invalid block tags
- 'basic-syntax27': ("{% nothing_to_see_here %}", {}, template.TemplateSyntaxError),
+ 'filter-syntax07': ("{% nothing_to_see_here %}", {}, template.TemplateSyntaxError),
# Raise TemplateSyntaxError for empty block tags
- 'basic-syntax28': ("{% %}", {}, template.TemplateSyntaxError),
+ 'filter-syntax08': ("{% %}", {}, template.TemplateSyntaxError),
# Chained filters, with an argument to the first one
- 'basic-syntax29': ('{{ var|removetags:"b i"|upper|lower }}', {"var": "Yes"}, "yes"),
+ 'filter-syntax09': ('{{ var|removetags:"b i"|upper|lower }}', {"var": "Yes"}, "yes"),
# Escaped string as argument
- 'basic-syntax30': (r'{{ var|default_if_none:" endquote\" hah" }}', {"var": None}, ' endquote" hah'),
+ 'filter-syntax10': (r'{{ var|default_if_none:" endquote\" hah" }}', {"var": None}, ' endquote" hah'),
# Variable as argument
- 'basic-syntax31': (r'{{ var|default_if_none:var2 }}', {"var": None, "var2": "happy"}, 'happy'),
+ 'filter-syntax11': (r'{{ var|default_if_none:var2 }}', {"var": None, "var2": "happy"}, 'happy'),
# Default argument testing
- 'basic-syntax32': (r'{{ var|yesno:"yup,nup,mup" }} {{ var|yesno }}', {"var": True}, 'yup yes'),
+ 'filter-syntax12': (r'{{ var|yesno:"yup,nup,mup" }} {{ var|yesno }}', {"var": True}, 'yup yes'),
- # Fail silently for methods that raise an exception with a "silent_variable_failure" attribute
- 'basic-syntax33': (r'1{{ var.method3 }}2', {"var": SomeClass()}, ("12", "1INVALID2")),
+ # Fail silently for methods that raise an exception with a
+ # "silent_variable_failure" attribute
+ 'filter-syntax13': (r'1{{ var.method3 }}2', {"var": SomeClass()}, ("12", "1INVALID2")),
- # In methods that raise an exception without a "silent_variable_attribute" set to True,
- # the exception propagates
- 'basic-syntax34': (r'1{{ var.method4 }}2', {"var": SomeClass()}, SomeOtherException),
+ # In methods that raise an exception without a
+ # "silent_variable_attribute" set to True, the exception propagates
+ 'filter-syntax14': (r'1{{ var.method4 }}2', {"var": SomeClass()}, SomeOtherException),
# Escaped backslash in argument
- 'basic-syntax35': (r'{{ var|default_if_none:"foo\bar" }}', {"var": None}, r'foo\bar'),
+ 'filter-syntax15': (r'{{ var|default_if_none:"foo\bar" }}', {"var": None}, r'foo\bar'),
# Escaped backslash using known escape char
- 'basic-syntax35': (r'{{ var|default_if_none:"foo\now" }}', {"var": None}, r'foo\now'),
+ 'filter-syntax16': (r'{{ var|default_if_none:"foo\now" }}', {"var": None}, r'foo\now'),
# Empty strings can be passed as arguments to filters
- 'basic-syntax36': (r'{{ var|join:"" }}', {'var': ['a', 'b', 'c']}, 'abc'),
+ 'filter-syntax17': (r'{{ var|join:"" }}', {'var': ['a', 'b', 'c']}, 'abc'),
- # If a variable has a __str__() that returns a Unicode object, the value
- # will be converted to a bytestring.
- 'basic-syntax37': (r'{{ var }}', {'var': UnicodeInStrClass()}, '\xc5\xa0\xc4\x90\xc4\x86\xc5\xbd\xc4\x87\xc5\xbe\xc5\xa1\xc4\x91'),
+ # If a variable has a __str__() that returns a Unicode object, the
+ # value will be converted to a bytestring.
+ 'basic-syntax18': (r'{{ var }}', {'var': UnicodeInStrClass()}, '\xc5\xa0\xc4\x90\xc4\x86\xc5\xbd\xc4\x87\xc5\xbe\xc5\xa1\xc4\x91'),
### COMMENT SYNTAX ########################################################
'comment-syntax01': ("{# this is hidden #}hello", {}, "hello"),