Logo Search packages:      
Sourcecode: sqlalchemy version File versions  Download package

def sqlalchemy::orm::mapper::Mapper::_compile_property (   self,
  key,
  prop,
  init = True,
  skipmissing = False,
  setparent = True 
) [private]

add a MapperProperty to this or another Mapper, including configuration of the property.

The properties' parent attribute will be set, and the property will also be 
copied amongst the mappers which inherit from this one.

if the given prop is a Column or list of Columns, a ColumnProperty will be created.

Definition at line 656 of file mapper.py.

00656                                                                                         :
        """add a MapperProperty to this or another Mapper, including configuration of the property.
        
        The properties' parent attribute will be set, and the property will also be 
        copied amongst the mappers which inherit from this one.
        
        if the given prop is a Column or list of Columns, a ColumnProperty will be created.
        """
        self.__log("_compile_property(%s, %s)" % (key, prop.__class__.__name__))

        if not isinstance(prop, MapperProperty):
            prop = self._create_prop_from_column(prop, skipmissing=skipmissing)
            if prop is None:
                raise exceptions.ArgumentError("'%s' is not an instance of MapperProperty or Column" % repr(prop))

        self.__props[key] = prop
        if setparent:
            prop.set_parent(self)
            
        if isinstance(prop, ColumnProperty):
            col = self.select_table.corresponding_column(prop.columns[0], keys_ok=True, raiseerr=False)
            if col is None:
                col = prop.columns[0]
            self.columns[key] = col
            for col in prop.columns:
                proplist = self.columntoproperty.setdefault(col, [])
                proplist.append(prop)

        if init:
            prop.init(key, self)

        for mapper in self._inheriting_mappers:
            prop.adapt_to_inherited(key, mapper)

    def __str__(self):


Generated by  Doxygen 1.6.0   Back to index