Exemplo n.º 1
0
 def __setitem__(self, key, value):
     if not _is_schema_element(self.struct._schema[key]):
         raise TypeError(
             "Property '%s.%s' of type %s cannot be referenced with an URL"
             % (type(self.struct).__name__, key,
                self.struct._schema[key].__name__))
     setattr(self.struct, key, value)
Exemplo n.º 2
0
def _single_element( seq ):
	if seq is None or schema._is_schema_element( type(seq) ):	return seq
	first = True
	for elt in seq:
		if not first: raise ValueError( "Sequence contains more than one element" )
		first = False
	if first: raise ValueError( "Sequence contains no elements" )
	return elt
Exemplo n.º 3
0
def _single_element(seq):
    if seq is None or schema._is_schema_element(type(seq)): return seq
    first = True
    for elt in seq:
        if not first:
            raise ValueError("Sequence contains more than one element")
        first = False
    if first: raise ValueError("Sequence contains no elements")
    return elt
Exemplo n.º 4
0
	def __setitem__( self, key, value ):
		if not _is_schema_element( self.struct._schema[key] ):
			raise TypeError( "Property '%s.%s' of type %s cannot be referenced with an URL" % ( type(self.struct).__name__, key, self.struct._schema[key].__name__ ) )
		setattr( self.struct, key, value )