Can anybody help me - I've noticed a problem adding rows that contain at least one compulsory DateTimeCol or DateCol field. Strangely enough, the exception is raised AFTER the row has been added to the table. It's as if there is some kind of post-add validation that is validating a string representation of the object, rather than the object that I added.
 
Can anybody suggest what might be going wrong? I've attached my type defintions and the stack-trace below
 
Thanks,
 
Sal
 
=========== Code Example =============
 
NOW = datetime.datetime.now()
TODAY = datetime.date.today()
 
def test():
    fod = types.Portfolio( c1id=43243, name="testpofo" )
    fub = types.Tranche( Portfolio=fod, Name="ffofof", GroupName="boo", Attach=0.78, Detach=9.2223, ProtectionType="blah", Maturity=TODAY , AsOf=NOW )
test()
 
# formencode.api.Invalid: expected an date/time string of the '%Y-%m-%d' format in
# the DateTimeCol 'Maturity', got <type 'DateTimeType'> instead
 
============ Types ===========
 
class Portfolio( sqlobject.SQLObject ):
    """
    Represents a colletion of
    """
    c1id = sqlobject.IntCol()
    name = sqlobject.StringCol( length=64 )
    Notionals = sqlobject.MultipleJoin('PortfolioNotional')
    Tranches = sqlobject.MultipleJoin('Tranche')
   
 
class Tranche( sqlobject.SQLObject ):
    Portfolio = sqlobject.ForeignKey('Portfolio')
    Name = sqlobject.StringCol( length=64 )
    GroupName = sqlobject.StringCol( length=64 )
    Attach = sqlobject.FloatCol()
    Detach = sqlobject.FloatCol()
    ProtectionType = sqlobject.StringCol( length=64 )
   
    Maturity = sqlobject.DateCol( default=None )
    AsOf = sqlobject.DateTimeCol( default=None )
   
    asofIndex = sqlobject.DatabaseIndex( 'AsOf' )
 
============ STACKTRACE ===========
 
  File "C:\dev\fid\iron\infra\dev\src\py\aurora\importer.py", line 62, in load_m
odule
    imp.load_module(fullname, *item)
  File "C:\dev\fid\iron\cpg\dev\src\py\iron\cpg\fegdatadumper\__init__.py", line
 24, in ?
    test()
  File "C:\dev\fid\iron\cpg\dev\src\py\iron\cpg\fegdatadumper\__init__.py", line
 22, in test
    fub = types.Tranche( Portfolio=fod, Name="ffofof", GroupName="boo", Attach=0
.78, Detach=9.2223, ProtectionType="blah", Maturity=TODAY , AsOf=NOW )
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/main.py", line 1183, i
n __init__
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/main.py", line 1210, i
n _create
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/main.py", line 1237, i
n _SO_finishCreate
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/main.py", line 947, in
 _init
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/main.py", line 1135, i
n _SO_selectInit
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/col.py", line 943, in
to_python
  File "/ms/dev/python/PROJ/sqlobject/0.7.0/lib/sqlobject/col.py", line 845, in
to_python
formencode.api.Invalid: expected an date/time string of the '%Y-%m-%d' format in
 the DateTimeCol 'Maturity', got <type 'DateTimeType'> instead
 
Salim Fadhley
Morgan Stanley | Fixed Income
20 Cabot Square | Canary Wharf | Floor 02
London, E14 4QW
Phone: +44 20 7677-7029
Mobile: +44 79737-10574
Sal.Fadhley@morganstanley.com
 
 

This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation.  Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers.  This is not research and is not from MS Research but it may refer to a research analyst/research report.  Unless indicated, these views are the author’s and may differ from those of Morgan Stanley research or others in the Firm.  We do not represent this is accurate or complete and we may not update this.  Past performance is not indicative of future returns.  For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls.  You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions.  We cannot guarantee that any such requests received via e-mail will be processed in a timely manner.  This communication is solely for the addressee(s) and may contain confidential information.  We do not waive confidentiality by mistransmission.  Contact me if you do not wish to receive these communications.  In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority’s rules).