def __init__(self, id_=None, label=None,
                 allowed_values=None, datatype=None,
                 dialect=None, domain=None):
        """A single dimension.

        If allowed_values are specified, they will override any
        allowed values for the datatype
        """
        if id_ is None:
            id_ = "default"
        if id_ == VALUE_KEY:
            raise InvalidID("'%s' is not a valid Dimension id." % VALUE_KEY)
        self.id = id_
        self._allowed_values = None
        self.datatype = None
        if label is None:
            self.label = id_
        else:
            self.label = label
        if datatype:
            self.datatype = Datatype(datatype)
            self._allowed_values = self.datatype.allowed_values
        self.dialect = dialect
        if allowed_values:
            # Override allowed values from datatype, if any
            #
            # If allowed values is given as a list of values, create
            # value objects using an empty dimension.
            self._allowed_values = ValueList()
            for val in allowed_values:
                if isinstance(val, DimensionValue):
                    self._allowed_values.append(val)
                else:
                    self._allowed_values.append(DimensionValue(val,
                                                               Dimension())
                                                )
def __init__ ( self , id_ = None , label = None , allowed_values = None , datatype = None , dialect = None , domain = None ) : if id_ is None : id_ = "default" if id_ == VALUE_KEY : raise InvalidID ( "'%s' is not a valid Dimension id." % VALUE_KEY ) self . id = id_ self . _allowed_values = None self . datatype = None if label is None : self . label = id_ else : self . label = label if datatype : self . datatype = Datatype ( datatype ) self . _allowed_values = self . datatype . allowed_values self . dialect = dialect if allowed_values : self . _allowed_values = ValueList ( ) for val in allowed_values : if isinstance ( val , DimensionValue ) : self . _allowed_values . append ( val ) else : self . _allowed_values . append ( DimensionValue ( val , Dimension ( ) ) )
A single dimension.

        If allowed_values are specified, they will override any
        allowed values for the datatype