Skip to content

Commit

Permalink
Enable literal_false option.
Browse files Browse the repository at this point in the history
  • Loading branch information
malthe committed Aug 19, 2011
1 parent 581ff5e commit 84adc04
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
@@ -1,6 +1,11 @@
Changelog
=========

In next release ...

- Enable option ``literal_false`` to get the behavior that a value of
``False`` does not drop an attribute.

2.1.1 (2011-08-11)
~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import sys

version = '2.1.1'
version = '2.1.2-dev'

install_requires = [
'setuptools',
Expand All @@ -10,7 +10,7 @@
'zope.i18n >= 3.5',
'zope.traversing',
'zope.contentprovider',
'Chameleon >= 2.3.1',
'Chameleon >= 2.3.7',
]

setup(name='z3c.pt',
Expand Down
2 changes: 2 additions & 0 deletions src/z3c/pt/pagetemplate.py
Expand Up @@ -67,6 +67,8 @@ class BaseTemplate(template.PageTemplate):

default_expression = "path"

literal_false = True

@property
def builtins(self):
builtins = {
Expand Down
3 changes: 3 additions & 0 deletions src/z3c/pt/tests/false.pt
@@ -0,0 +1,3 @@
<form>
<input type="input" tal:attributes="checked False" />
</form>
6 changes: 6 additions & 0 deletions src/z3c/pt/tests/test_templates.py
Expand Up @@ -29,6 +29,12 @@ def dont_call():
result = template(callable=dont_call)
self.failUnless('ok' in result)

def test_false(self):
from z3c.pt.pagetemplate import PageTemplateFile
template = PageTemplateFile("false.pt")
result = template()
self.failUnless('False' in result)

def test_path(self):
from z3c.pt.pagetemplate import PageTemplateFile
template = PageTemplateFile("path.pt")
Expand Down

0 comments on commit 84adc04

Please sign in to comment.