On Wed, Dec 23, 2009 at 2:21 PM, Victor Subervi <victorsube...@gmail.com>wrote:
> I've isolated the problem in the print-out at the bottom of this post. It > occurs when these values are passed: > > ['LastDatePrice', 'date', '10', 'yyyy/mm/dd', None], > > Since this is the first datetime that is passed, it would appear to be > associated with such values, which are processed thus: > > elif typeName == 'datetime': > print "<input type='text' width='%s' maxlength='%s' name='%s' > value='%s' /> " \ > "<i>This field takes a datetime up to %s alphanumeric characters > inclusive.</i>" \ > % (shortNum, str(typeNum), colName, theVal, str(typeNum)) > > colName == 'LastDatePrice' > typeNum = 10 > > elif 10 < int(typeNum) < 20: > shortNum = '10' > > Therefore... > shortNum = '10' > > if whatDo == 'insert': > theVal = defaultVal > val = defaultVal > > Since whatDo == 'insert'... > and > val = 'yyyy/mm/dd' > therefore > theVal = None > > Now, this value of None doesn't cause any problems with the other values > printed out. This is the code: > > print 'printTheForm: ', descrProds, '<br />' > for value in descrProds: > print 'value: ', value, '<br />' > > that produces this print-out: > > printTheForm: [['ID', 'tinyint', '5', '0', None], ['SKU', 'varchar', '40', > '', None], ['Category', 'varchar', '40', '', None], ['Name', 'varchar', > '50', '', None], ['Title', 'varchar', '100', '', None], ['Description', > 'mediumtext', '100', '', None], ['Price', 'float', '8', '0.0', None], > ['SortFactor', 'int', '4', '0', None], ['Availability', 'tinyint', '1', '0', > '1'], ['OutOfStock', 'tinyint', '1', '0', '0'], ['ShipFlatFee', 'float', > '5', '0.0', '0.00'], ['ShipPercentPrice', 'tinyint', '2', '0', '0'], > ['ShipPercentWeight', 'tinyint', '2', '0', '0'], ['Associations', 'varchar', > '40', '', None], ['TempPrice', 'tinyint', '1', '0', None], ['LastDatePrice', > 'date', '10', 'yyyy/mm/dd', None], ['Weight', 'float', '7', '0.0', None], > ['Metal', 'enum', ['14k gold', '18k gold', 'white gold', 'silver', > 'tungsten', 'titanium'], '', None], ['PercentMetal', 'tinyint', '2', '0', > None], ['colorsShadesNumbersShort', 'set', [''], '', None]] > value: ['ID', 'tinyint', '5', '0', None] > value: ['SKU', 'varchar', '40', '', None] > value: ['Category', 'varchar', '40', '', None] > value: ['Name', 'varchar', '50', '', None] > value: ['Title', 'varchar', '100', '', None] > value: ['Description', 'mediumtext', '100', '', None] > value: ['Price', 'float', '8', '0.0', None] > value: ['SortFactor', 'int', '4', '0', None] > value: ['Availability', 'tinyint', '1', '0', '1'] > value: ['OutOfStock', 'tinyint', '1', '0', '0'] > value: ['ShipFlatFee', 'float', '5', '0.0', '0.00'] > value: ['ShipPercentPrice', 'tinyint', '2', '0', '0'] > value: ['ShipPercentWeight', 'tinyint', '2', '0', '0'] > value: ['Associations', 'varchar', '40', '', None] > value: ['TempPrice', 'tinyint', '1', '0', None] > value: ['LastDatePrice', 'date', '10', 'yyyy/mm/dd', None] > > If in fact the problem has to do with the None value, how can I easily > substitute a different value? I tried: > > if theVal == None: > theVal = '' > > but that didn't capture it. > Update: It's a date value (not datetime). I updated the database to default to the value "2000-01-01" but that didn't help (gave the same print-out as above). > TIA, > beno >
-- http://mail.python.org/mailman/listinfo/python-list