Ejemplo n.º 1
0
    def __new__(cls, index):
        """Verify the given index is valid and store base attributes."""
        # Get the given indexes edict
        edict = edict_from_index(index, False)

        # Is the edict valid?
        if edict is None or edict.get_unknown() is None:

            # If not raise an error
            raise ValueError(
                'Index "{0}" is not a proper entity index.'.format(index))

        # Create the object
        self = BaseEntity.__new__(cls)

        # Set the entity's base attributes
        self._index = index
        self._edict = edict
        self._pointer = pointer_from_edict(edict)

        # Return the instance
        return self