Yarko,

Let me step through your queries then I will go twiddle with your
suggestion.

a) The file pathing ss best I know is 'right out of the box'. Web2Py
root is loaded at /home/rootuser/Helix. The assets.py controller is
at ../applications/Helix/controllers.
b) Yes, following SOP for the connection string. By the way it is
sqlite DB.
c) The table definition is the following:

assets.define_table('bonds',
                assets.Field('symbl','string'),
                assets.Field('basis','boolean'),
                assets.Field('basisprice','double'),
                assets.Field('basisqty','double'),
                assets.Field('action','string'),
                assets.Field('qrydate','datetime',default=stamp),
                assets.Field('price','double'),
                assets.Field('coupon','double'),
                assets.Field('maturitydate','string'),
                assets.Field('ytm','double'),
                assets.Field('curyld','double'),
                assets.Field('fitchrat','string'),
                assets.Field('curpayfreq','string'),
                assets.Field('btype','string'),
                assets.Field('callable','string'),
                assets.Field('fstcpndt','string'),
                assets.Field('company','string')
                )

assets.bonds.symbl.requires = IS_NOT_EMPTY(error_message='Must not be
empty')
assets.bonds.price.requires = IS_NOT_EMPTY(error_message='Must not be
empty')
assets.bonds.action.requires = IS_IN_SET
(['buy','sell','hold','trade','gift'])
assets.bonds.btype.requires = IS_IN_SET
(['Municipal','Corporate','Treasury','Treasury Zero Coupon'])
assets.bonds.curpayfreq.requires = IS_IN_SET
(['Monthly','Quarterly','Semi-Annual','Annual','NA'])
assets.bonds.callable.requires = IS_IN_SET(['No','Yes'])

Though there are several fields that will hold a date string, it is
only a string. The data is coming off the web page as a string and as
I will not manipulate most of these fields as a date, saw no use to
convert them. The only real date field is qrydate.

Permit me to go run some tests in ipython see if I can find anything.

Thanks for the assist.

JohnMc


On Jul 14, 6:52 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> On Tue, Jul 14, 2009 at 6:27 PM, JohnMc <maruadventu...@gmail.com> wrote:
>
> > Alright, been staring at this problem off an on all day. I receive the
> > following traceback on a ticket.
>
> > Traceback (most recent call last):
> >  File "/home/rootuser/New/gluon/restricted.py", line 107, in
> > restricted
> >  File "/home/rootuser/Helix/applications/Helix/controllers/
> > assets.py", line 311, in <module>
>
> this inconsistency in paths is confusing me... what's this about?  You have
> applications somewhere else than web2py?  Do you have a link back to your
> web2py applications directory?
>
>
>
> >  File "/home/rootuser/New/gluon/globals.py", line 97, in <lambda>
> >  File "/home/rootuser/Helix/applications/Helix/controllers/
> > assets.py", line 291, in bond_auto
>
> >    callable = data['callable'],fstcpndt = data['fstcpndt'],company =
> > data['company'] )
>
> >  File "/home/rootuser/New/gluon/sql.py", line 1445, in insert
> >  File "/home/rootuser/New/gluon/sql.py", line 1421, in _insert
> > SyntaxError: invalid field name
>
> > Here is the entire insert
>
> Suggest you do this incrementally, exploring manually thru the shell is a
> good option,
>
> e.g.   python web2py.py -S my_app -M
>
> and then try small things until you figure out what's up (ipython would be
> useful for this);
> Alternative is to step through with WingIDE and inspect the values of what
> you are trying to assign from / to to get to your "aha!", but either way
> will get you there.
>
>
>
> > # update the database with a new entry for the asset
> > assets.bonds.insert
> > (symbl=lsymbl,basis=False,basisprce=0.0,basisqty=0.0,action='hold',qrydate
> > = stamp,
> > price = data['price'],coupon  = data['coupon'],maturitydate = data
> > ['maturitydate'],ytm = data['ytm'],
> > curyld = data['curyld'],fitchrat = data['fitchrat'],curpayfreq = data
> > ['curpayfreq'],btype = data['btype'],
> > callable = data['callable'],fstcpndt = data['fstcpndt'],company = data
> > ['company'] )
>
> So - I'm seeing this, and assuming you must have somewhere something like:
>
> assets = SQLDB( your_db_connection_string )
> ...
> assets.define_table( 'bonds',
>    Field('price'),
>    Field('coupon'),
>    Field('maturitydate'),  # of course these fields have more in them;
> perhaps this is a datetime filed)
>    Field('curyid'),
> ..... # etc.)
>
> How are we doing so far?
>
>
>
> > ---------------------------------------------------------------------------------------------------------
>
> > What I am doing is pulling data off a webpage, and placing the
> > findings in a python dictionary which is returned back to bond_auto().
> > bond_auto() does the actual insert above. I have checked that there
> > are the appropriate number of fields are being handled, the contents
> > are the right type, spelling of all the field names, even a truncate.
> > I still keep getting that 'invalid field name'.
>
> > Any suggestions?
>
> > JohnMc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to