Hello,

I've defined these classes (heavily edited to show only the relevant parts):

class MergeableSQLObject(sqlobject.SQLObject):
        @classmethod
        def merge(cls, **attributes):
                print "attributes:", attributes
                instance = cls(**attributes)
                print
                print "instance:", instance
                return instance

class CashTransaction(MergeableSQLObject):
        portfolio = sqlobject.ForeignKey('Portfolio', notNone=True)
        date = sqlobject.DateCol(notNone=True)
        number = sqlobject.IntCol(notNone=True)
        type = sqlobject.ForeignKey('TransactionType', notNone=True)
        security = sqlobject.ForeignKey('Security', default=None)
        quantity = sqlobject.DecimalCol(size=21, precision=6, default=None)
        price = sqlobject.DecimalCol(size=21, precision=6, default=None)
        grossAmount = sqlobject.DecimalCol(size=21, precision=6, default=None)
        brokerFees = sqlobject.DecimalCol(size=21, precision=6, default=None)
        otherFees = sqlobject.DecimalCol(size=21, precision=6, default=None)
        netAmount = sqlobject.DecimalCol(size=21, precision=6, default=None)
        isFlow = sqlobject.BoolCol(notNone=True, default=False)
        squelchFlow = sqlobject.BoolCol(notNone=True, default=False)
        memo = sqlobject.StringCol(length=256, default=None)

When I pass some attribute information into Cash.Transaction.merge, it works 
fine up to a certain date.  Starting on that date, when instantiating a new 
CashTransaction object, it replaces the "number" attribute with some other 
number... the same one every time, in fact.

Here's sample output:
====
attributes: {'otherFees': 0, 'brokerFees': None, 'netAmount': 
Decimal("164.1"), 'price': Decimal("16.41"), 'grossAmount': None, 'number': 
2157578935L, 'date': datetime.date(2006, 1, 25), 'portfolio': <Portfolio 8L 
ledgerID=5L dateOpened=None dateFunded=None dateClosed=None 
notes=None>, 'security': <Security 7L >, 'type': <TransactionType 18L 
code='DIV' description='Cash Dividend'>, 'memo': '10 shares STOCK PRICE 
@$16.41', 'quantity': Decimal("10")}

instance: <CashTransaction 26L portfolioID=8L date='datetime.date(200...)' 
number=2147483647L typeID=18L securityID=7L quantity=Decimal("10.000000") 
price=Decimal("16.410000") grossAmount=None brokerFees=None 
otherFees=Decimal("0.000000") netAmount='Decimal("164.1000...)' isFlow=False 
squelchFlow=False memo="'10 shares STOCK ...'">
=====
Notice how the "number" has changed, but all other attributes remain the same.

Anybody have any idea what is going wrong here?
I'm using SQLObject-0.8dev_r1840-py2.4

Thanks,
cs

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to