html patch, thanks Jonathan, but TRHEAD commented

This commit is contained in:
mdipierro
2013-07-11 11:28:12 -05:00
parent 5ec22132a3
commit 6566b2d2ed
3 changed files with 25 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.07.11.09.13.54
Version 2.6.0-development+timestamp.2013.07.11.11.27.25
+20 -4
View File
@@ -98,6 +98,7 @@ __all__ = [
'TFOOT',
'TITLE',
'TR',
# 'TRHEAD',
'TT',
'URL',
'XHTML',
@@ -1198,12 +1199,12 @@ def TAG_pickler(data):
return (TAG_unpickler, (marshal_dump,))
class __tag__(DIV):
class __tag_div__(DIV):
def __init__(self,name,*a,**b):
DIV.__init__(self,*a,**b)
self.tag = name
copy_reg.pickle(__tag__, TAG_pickler, TAG_unpickler)
copy_reg.pickle(__tag_div__, TAG_pickler, TAG_unpickler)
class __TAG__(XmlComponent):
@@ -1223,7 +1224,7 @@ class __TAG__(XmlComponent):
name = name[:-1] + '/'
if isinstance(name, unicode):
name = name.encode('utf-8')
return lambda *a,**b: __tag__(name,*a,**b)
return lambda *a,**b: __tag_div__(name,*a,**b)
def __call__(self, html):
return web2pyHTMLParser(decoder.decoder(html)).tree
@@ -1640,12 +1641,27 @@ class TR(DIV):
self._wrap_components((TD, TH), TD)
class TRHEAD(DIV):
"""
TRHEAD Component.
If subcomponents are not TD/TH-components they will be wrapped in a TH
see also :class:`DIV`
"""
tag = 'tr'
def _fixup(self):
self._wrap_components((TD, TH), TH)
class THEAD(DIV):
tag = 'thead'
def _fixup(self):
self._wrap_components(TR, TR)
self._wrap_components((TRHEAD, TR), TRHEAD)
class TBODY(DIV):
+4
View File
@@ -188,6 +188,10 @@ class TestBareHelpers(unittest.TestCase):
def testTHEAD(self):
self.assertEqual(THEAD('<>', _a='1', _b='2').xml(),
'<thead a="1" b="2"><tr><th>&lt;&gt;</th></tr></thead>')
#self.assertEqual(THEAD(TRHEAD('<>'), _a='1', _b='2').xml(),
# '<thead a="1" b="2"><tr><th>&lt;&gt;</th></tr></thead>')
self.assertEqual(THEAD(TR('<>'), _a='1', _b='2').xml(),
'<thead a="1" b="2"><tr><td>&lt;&gt;</td></tr></thead>')
def testTITLE(self):