Esempio n. 1
0
    def __init__(self, app=None, validator=None, mime_type=None,
                    tmp_dir=None, tmp_delete_on_close=True, ignore_uncap=False,
                                                            parse_cookie=False):
        FlatDictDocument.__init__(self, app, validator, mime_type,
                                                      ignore_uncap=ignore_uncap)

        self.tmp_dir = tmp_dir
        self.tmp_delete_on_close = tmp_delete_on_close
        self.parse_cookie = parse_cookie
Esempio n. 2
0
    def test_serialization_to_simple_dict(self):
        class CM(ComplexModel):
            i = Integer
            s = String

        class CCM(ComplexModel):
            c = CM
            i = Integer
            s = String

        val = CCM(i=5, s='a', c=CM(i=7, s='b'))

        d = FlatDictDocument.object_to_flat_dict(CCM, val)

        assert d['i'] == 5
        assert d['s'] == 'a'
        assert d['c_i'] == 7
        assert d['c_s'] == 'b'

        assert len(d) == 4