示例#1
0
def text_importer(node, zipfile):
    children = node.getchildren()
    assert len(children) == 1 and children[0].tag == "text"
    path = children[0].get("src")
    body = zipfile.read(path)
    b = TextBlock(body=body)
    b.save()
    return b
示例#2
0
def text_importer(node, zipfile):
    children = node.getchildren()
    assert len(children) == 1 and children[0].tag == "text"
    path = children[0].get("src")
    body = zipfile.read(path)
    b = TextBlock(body=body)
    b.save()
    return b
示例#3
0
 def test_create_from_dict(self):
     d = dict(body='foo')
     tb = TextBlock.create_from_dict(d)
     self.assertEqual(tb.body, 'foo')
示例#4
0
 def test_add_form(self):
     f = TextBlock.add_form()
     self.assertTrue('body' in f.fields)