I have a method inside my class definition that I want to use to validate a field before allowing the data to be saved.


Here is the def:


class Requisition(SQLObject):

    class sqlmeta:

        style = Style(longID=True)

        idName = 'requisitionId'


    plant = ForeignKey('Plant', dbName='plantId')

    requisitionPeriod = ForeignKey('RequisitionPeriod',


    requisitionStatus = ForeignKey('RequisitionStatus')

    itemNumber = UnicodeCol(length=15)

    itemName = UnicodeCol(length=50)

    requestedBy = ForeignKey('User', dbName='requestedById')

    dateRequested = DateCol()

    quantity = IntCol()

    uom = UnicodeCol(length=20)

    quantityReceived = DecimalCol(size=12, precision=4)

    dateReceived = DateCol()

    dateCanHold = DateCol()

    dateNeeded = DateCol()

    notes = UnicodeCol()

    dateOrdered = DateCol()

    poNumber = UnicodeCol(length=50)

    orderNumber = IntCol()

    ingCost = DecimalCol(size=12, precision=2)

    frtCost = DecimalCol(size=12, precision=2)

    supplier = ForeignKey('Vendor', dbName='supplierId', cascade=False)

    carrier = ForeignKey('Vendor', dbName='carrierId', cascade=False)

    driver = ForeignKey('Driver', dbName='driverId', cascade=False)

    bolNumber = UnicodeCol(length=50)

    ingInvoice = UnicodeCol(length=20)

    prepaid = BoolCol(default=False)

    requisitionGroup = IntCol(default=0)

    createdOn = DateTimeCol(default=datetime.now)


    def _set_dateRequested(self, value):

        dateRequested = value


        requisitionPeriodId = self._SO_get_requisitionPeriod()



When I try to add a Requistion, in my debug output I get to the first debug statement, but never to the second.  I’m assuming it is because I’m specifying something wrong on – requisitionPeriodId = self._SO_get_requisitionPeriod() – but I don’t know what I’m doing wrong.  How do I specify this with a ForeignKey field?