Exemple #1
0
    def deserialize(self, field, pstruct):
        if pstruct is null:
            return null
        else:
            try:
                validated = self._pstruct_schema.deserialize(pstruct)
            except Invalid as exc:
                raise Invalid(field.schema, text_("Invalid pstruct: %s" % exc))
            minx = validated['minx']
            miny = validated['miny']
            maxx = validated['maxx']
            maxy = validated['maxy']

            if not minx and not minx and not maxx and not maxy:
                return null

            result = ','.join([minx, miny, maxx, maxy])

            if not minx or not miny or not maxx or not maxy:
                raise Invalid(field.schema, 'Incomplete bbox', result)

            return result
Exemple #2
0
 def test_normalizes_css_class(self):
     schema = DummySchema()
     schema.name = text_(b"a b\xc3\xb1[] c", "utf-8")
     field = self._makeOne(schema)
     self.assertEqual(field.widget.item_css_class, "item-a-bn-c")
Exemple #3
0
 def test_normalizes_css_class(self):
     schema = DummySchema()
     schema.name = text_(b'a b\xc3\xb1[] c', 'utf-8')
     field = self._makeOne(schema)
     self.assertEqual(field.widget.item_css_class, 'item-a-bn-c')