Yes, some of the params are reference type fields. Each test I want to post the results of, has it's metadata, (the reference type fields, which are all strings at their root table.) and the results themselves. (integers).
On Friday, January 31, 2014 11:44:01 PM UTC+2, Anthony wrote: > > The string field you showed was for f_platform_name, but in your > test_params, you have f_platform, which I assume must be an integer or > reference field (the str(long(obj)) code is only called for id, integer, > and reference type fields in the DAL). > > On Friday, January 31, 2014 4:18:53 PM UTC-5, Avi A wrote: >> >> Well, not sure what to check. >> You saw the tables definitions and this is the call: >> test_params = {'api_key': 'e5dcc229-906d-47f8-b6ab-d184509f4f0b', >> 'f_test': 'test', 'f_project': 'Reader', 'f_platform': 'Android', >> 'f_device': 'Toshiba', 'f_steps': '10', 'f_matches':'7', 'f_missmatches': >> '3'} >> >> >> >> >> >> >> On Friday, January 31, 2014 10:58:11 PM UTC+2, Anthony wrote: >>> >>> Doesn't look like that's going into a string field. Maybe check the call >>> being made. >>> >>> On Friday, January 31, 2014 3:20:51 PM UTC-5, Avi A wrote: >>>> >>>> return str(long(obj)) >>>> ValueError: invalid literal for long() with base 10: 'Android' >>>> >>>> and that's where Android goes to: >>>> >>>> db.define_table('t_types', >>>> Field('f_platform_name', type='string', >>>> label=T('Platform Name')), >>>> auth.signature, >>>> format='%(f_platform_name)s', >>>> migrate=settings.migrate) >>>> >>>> >>>> >>>> >>>> On Friday, January 31, 2014 10:04:05 PM UTC+2, Anthony wrote: >>>>> >>>>> Oops, this: >>>>> >>>>> t.validate_and_insert(t._filter_fields(**post_params)) >>>>> >>>>> should be: >>>>> >>>>> t.validate_and_insert(**t._filter_fields(post_params)) >>>>> >>>>> Anthony >>>>> >>>>> On Friday, January 31, 2014 2:46:23 PM UTC-5, Avi A wrote: >>>>>> >>>>>> Almost there... >>>>>> >>>>>> TypeError: _filter_fields() got an unexpected keyword argument 'f_steps' >>>>>> >>>>>> and I do have it on the model: >>>>>> >>>>>> db.define_table('t_tests_results', >>>>>> Field('f_test', type='reference t_tests', >>>>>> label=T('Test')), >>>>>> Field('f_project', type='reference t_projects', >>>>>> label=T('Project')), >>>>>> Field('f_platform', type='reference t_types', >>>>>> label=T('Platform')), >>>>>> Field('f_device', type='reference t_devices', >>>>>> label=T('Device')), >>>>>> Field('f_steps', type='integer', >>>>>> label=T('Steps')), >>>>>> Field('f_matches', type='integer', >>>>>> label=T('Matches')), >>>>>> Field('f_missmatches', type='integer', >>>>>> label=T('Missmatches')), >>>>>> auth.signature, >>>>>> format='%(f_test)s', >>>>>> migrate=settings.migrate) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Friday, January 31, 2014 9:32:06 PM UTC+2, Anthony wrote: >>>>>>> >>>>>>> Sorry, it should be post_params['api_key'] rather than >>>>>>> post_params.api_key. >>>>>>> >>>>>>> Anthony >>>>>>> >>>>>>> On Friday, January 31, 2014 2:20:57 PM UTC-5, Avi A wrote: >>>>>>>> >>>>>>>> I did, but now I see that i didn't put it left enough. >>>>>>>> Now the error I get: >>>>>>>> >>>>>>>> if db(db.auth_user.api_key == post_params.api_key).count(): >>>>>>>> >>>>>>>> AttributeError: 'dict' object has no attribute 'api_key' >>>>>>>> >>>>>>>> Maybe I should pop it out of the URL params like you suggested >>>>>>>> above? >>>>>>>> >>>>>>>> On Friday, January 31, 2014 9:09:21 PM UTC+2, Anthony wrote: >>>>>>>>> >>>>>>>>> Is that what's in r.content? If so, looks like you didn't add the >>>>>>>>> return locals() line at the bottom of your api() function. >>>>>>>>> >>>>>>>>> Anthony >>>>>>>>> >>>>>>>>> On Friday, January 31, 2014 1:23:53 PM UTC-5, Avi A wrote: >>>>>>>>>> >>>>>>>>>> rest_action = _action().get(method, None) >>>>>>>>>> AttributeError: 'NoneType' object has no attribute 'get' >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Friday, January 31, 2014 2:12:44 PM UTC+2, Anthony wrote: >>>>>>>>>>> >>>>>>>>>>> Yes, now check what is in r.content. >>>>>>>>>> >>>>>>>>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.