Esempio n. 1
0
    def fromUnicode(self, uc):
        """
        >>> obj = Bytes(constraint=lambda v: b('x') in v)

        >>> obj.fromUnicode(u(" foo x.y.z bat"))
        ' foo x.y.z bat'
        >>> obj.fromUnicode(u(" foo y.z bat"))
        Traceback (most recent call last):
        ...
        ConstraintNotSatisfied:  foo y.z bat

        """
        v = make_binary(uc)
        self.validate(v)
        return v
Esempio n. 2
0
 def fromUnicode(self, value):
     """ See IFromUnicode.
     """
     return self.fromBytes(make_binary(value))
Esempio n. 3
0
 def fromUnicode(self, uc):
     """ See IFromUnicode.
     """
     v = make_binary(uc)
     self.validate(v)
     return v
Esempio n. 4
0
 def fromUnicode(self, value):
     """ See IFromUnicode.
     """
     return self.fromBytes(make_binary(value))
Esempio n. 5
0
 def __init__(self, snippet=b'', name=None, parent=None):
     self.data = make_binary(snippet)
     #zope.location.ILocation
     self.__name__ = name
     self.__parent__ = parent