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
def fromUnicode(self, value): """ See IFromUnicode. """ return self.fromBytes(make_binary(value))
def fromUnicode(self, uc): """ See IFromUnicode. """ v = make_binary(uc) self.validate(v) return v
def fromUnicode(self, value): """ See IFromUnicode. """ return self.fromBytes(make_binary(value))
def __init__(self, snippet=b'', name=None, parent=None): self.data = make_binary(snippet) #zope.location.ILocation self.__name__ = name self.__parent__ = parent