[web2py] Reserved key error (expires)

2014-12-27 Thread Avi A
Hi,
Need some help with setting cookies.
While basically setting cookies works, when I add this line :
response.cookies['expires'] = 3600 * 24
returns:

CookieError: Attempt to set a reserved key: expires

Thanks,

Avi.



-- 
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/d/optout.


[web2py] Re: utf8 problem

2014-12-08 Thread Avi A
It's OK..

On Monday, December 8, 2014 7:51:39 AM UTC+2, Avi A wrote:
>
> Hi,
> On some translations fields I am using Hebrew characters.
> While they are displayed OK on the Form view and on the admin db view, on 
> the view page it self they are rendered as:
>  'f_category_t': 
> '\xd7\xa8\xd7\x90\xd7\xa9\xd7\x95\xd7\xa0\xd7\x95\xd7\xaa'}
> and Angularjs displays it as jibberish, for example:
> Cold drinks ×ž×©×§× ×•×ª ×§×œ×™× 
> so my goal is to display this as expected:
>
> $scope.rest_categories={{=XML(rest_categories)}};
>
>
> Thanks.
>
>
>

-- 
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/d/optout.


[web2py] utf8 problem

2014-12-07 Thread Avi A
Hi,
On some translations fields I am using Hebrew characters.
While they are displayed OK on the Form view and on the admin db view, on 
the view page it self they are rendered as:
 'f_category_t': '\xd7\xa8\xd7\x90\xd7\xa9\xd7\x95\xd7\xa0\xd7\x95\xd7\xaa'}
and Angularjs displays it as jibberish, for example:
Cold drinks ×ž×©×§× ×•×ª ×§×œ×™× 
so my goal is to display this as expected:

$scope.rest_categories={{=XML(rest_categories)}};


Thanks.


-- 
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/d/optout.


[web2py] signup and login with ajax.

2014-12-04 Thread Avi A
Hi,
Is it possible to replace the default signup and login forms with a 
customized ajax post?  like:

ajax(some_sign_upcontroller.load?email=a...@gmail.com&name=name&password=password,
 
'', 'welcome')

ajax(some_log_in_controller.load?email=a...@gmail.com&password=somepassword,'', 
'welcome again')


If so, to which controller should I send it? (all the process should remain the 
same except for the form/widget itself.)


Thanks.




-- 
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/d/optout.


[web2py] Re: openshift

2014-11-09 Thread Avi A
Great, thanks.

On Sunday, November 9, 2014 6:15:11 PM UTC+2, Massimo Di Pierro wrote:
>
> You can set the password with:
>
> sudo -u www-data python -c "from gluon.main import save_password; import 
> getpass; save_password(getpass.getpass('password:'),443)"
>
> or with
>
> python web2py.py -S welcome -a yourpassword -p 443
>
> then [ctrl]+D to exit.
>
>
>
> On Saturday, 8 November 2014 12:22:07 UTC-6, Avi A wrote:
>>
>> Hi,
>> Maybe someone can help with that,
>> how do I start the openshift web2py version localy ?
>> Also how do I set the admin password? I mean this is what i have on the 
>> parameters_80 file:
>> password="pbkdf2(1000,20,sha512)$b7328c..205b"
>>
>> thanks,
>> Avi.
>>
>

-- 
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/d/optout.


[web2py] openshift

2014-11-08 Thread Avi A
Hi,
Maybe someone can help with that,
how do I start the openshift web2py version localy ?
Also how do I set the admin password? I mean this is what i have on the 
parameters_80 file:
password="pbkdf2(1000,20,sha512)$b7328c..205b"

thanks,
Avi.

-- 
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/d/optout.


[web2py] Re: Send data to print.

2014-08-10 Thread Avi A
I think this is what i need or something similar:
https://pypi.python.org/pypi/pycups

On Sunday, August 10, 2014 3:45:02 PM UTC+3, Avi A wrote:
>
> I want the users to open the app from mobile devices, andriod and ios, and 
> i want the process to be transparent for them. I mean they shoudn't install 
> a print app and they shouldn't define/associate a printer to the device, as 
> opposed to clicking "share", letting the server/controller handle printing 
> and setting. the printer would be connected the to the server with cable.
>
> On Sunday, August 10, 2014 3:01:44 PM UTC+3, LightDot wrote:
>>
>> What is the location of the printer? If this is going to be on the client 
>> side, then you'll need to open the browser print dialog. You can use 
>> javascript to do so, plenty of examples can be found on the web.
>>
>> Regards
>>
>> On Sunday, August 10, 2014 1:20:05 PM UTC+2, Avi A wrote:
>>>
>>> Hi,
>>> I need help with something like that: I want to create a simple print 
>>> app, where a user picks some options, presses "print", it is sent to the 
>>> controller, then the controller print the string directly to the printer.
>>> Any suggestions/directions?
>>> Thanks,
>>> Avi.
>>>
>>>

-- 
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/d/optout.


[web2py] Re: Send data to print.

2014-08-10 Thread Avi A
I want the users to open the app from mobile devices, andriod and ios, and 
i want the process to be transparent for them. I mean they shoudn't install 
a print app and they shouldn't define/associate a printer to the device, as 
opposed to clicking "share", letting the server/controller handle printing 
and setting. the printer would be connected the to the server with cable.

On Sunday, August 10, 2014 3:01:44 PM UTC+3, LightDot wrote:
>
> What is the location of the printer? If this is going to be on the client 
> side, then you'll need to open the browser print dialog. You can use 
> javascript to do so, plenty of examples can be found on the web.
>
> Regards
>
> On Sunday, August 10, 2014 1:20:05 PM UTC+2, Avi A wrote:
>>
>> Hi,
>> I need help with something like that: I want to create a simple print 
>> app, where a user picks some options, presses "print", it is sent to the 
>> controller, then the controller print the string directly to the printer.
>> Any suggestions/directions?
>> Thanks,
>> Avi.
>>
>>

-- 
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/d/optout.


[web2py] Send data to print.

2014-08-10 Thread Avi A
Hi,
I need help with something like that: I want to create a simple print app, 
where a user picks some options, presses "print", it is sent to the 
controller, then the controller print the string directly to the printer.
Any suggestions/directions?
Thanks,
Avi.

-- 
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/d/optout.


[web2py] Re: web2py with google visualisation app.

2014-08-06 Thread Avi A
When ever you change an option in one of the dropdown filtering options 
above, the attached function runs, which sends two of the built in web2py 
Ajax load function, to two different controllers, and the data is rendered 
back on the page:

   
 $(document).ready(function(){
   $("#filter_options").on('change', function(){
  platform=$( "#filter_platform" ).val();
  project=$( "#filter_project" ).val();
  device=$( "#filter_device" ).val();
  milestone=$( "#filter_milestone" ).val();
  env=$( "#filter_env" ).val();
  url_graphs = 'eco_graph.load?platform=' + platform + 
'&project=' + project + '&device=' + device + '&milestone=' + milestone +
   '&env=' + env;
  ajax(url_graphs, '', 'visualization');
  url_tests = 'eco_tests.load?platform=' + platform + 
'&project=' + project + '&device=' + device + '&milestone=' + milestone +
   '&env=' + env;
  ajax(url_tests, '', 'tests_list')


  });


});
  




 

On Wednesday, August 6, 2014 8:51:40 PM UTC+3, lyn2py wrote:
>
> Thank you for sharing the short clip!
>
> I was wondering how you did the auto-loading of the content within each 
> drop down menu at the top?
> I always thought that to be difficult and have not ventured far in that 
> area yet. I hope you can share how you did it! Thanks :)
>
> On Wednesday, August 6, 2014 7:23:56 PM UTC+8, Avi A wrote:
>>
>> Hi,
>> I just wanted to share  a short video of an app I made.
>> What it does in short;
>> I do mobile automated tests locally. I use selenium/appium and applitools 
>> (awesome startup) which does screenshots comparison for me and when the 
>> test ends, they send a json with failed/passed counts info.
>> when tests end, I post the data to the web2py app, (post api) where i 
>> save the tests' data, and display it with google visualisation api and 
>> allow saving the results as a report on excel file, for each given 
>> view/filter.
>> Thank you all for the support, special thanks to Anthony and Niplod.
>> http://goo.gl/LOaAhs
>>
>>
>>

-- 
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/d/optout.


[web2py] web2py with google visualisation app.

2014-08-06 Thread Avi A
Hi,
I just wanted to share  a short video of an app I made.
What it does in short;
I do mobile automated tests locally. I use selenium/appium and applitools 
(awesome startup) which does screenshots comparison for me and when the 
test ends, they send a json with failed/passed counts info.
when tests ends, I post the data to the web2py app, (post api) where i save 
the tests' data, and display it with google visualisation api and allow 
saving the results as a report on excel file, for each given view/filter.
Thank you all for the support, special thanks to Anthony and Niplod.
http://goo.gl/LOaAhs


-- 
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/d/optout.


[web2py] Re: posting a dict on ajax load vars

2014-06-08 Thread Avi A
Thanks,
i guess I am not a tabble bit js fluent. 
So I have to turn the dict to json, post it and use the @request.restful() 
service and POST in the eco_report()?

Is there also a way to keep the "graph_data" as a global dict/list and use 
it like that:?
def eco_report():
create_report(graph_data):
..



On Monday, June 9, 2014 1:02:00 AM UTC+3, Avi A wrote:
>
> Hi,
> I want to pass a dict in ajax function like that:
> $("#create_report").click(function(){
>url_report = 'eco_reports?graph_data={{=graph_data}}';
>ajax(url_report, '', 'save_as_link');
>
> and the controller starts with something like that:
> def eco_reports()::
>for item in (request.vars.graph_data):
> something item.f_test_name
> ..
>
> The error I get:
>
> AttributeError: 'str' object has no attribute 'f_test_name'
>
> what's the way to do what I Want?
>
> thanks
>
>
>
>
>
>
>

-- 
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/d/optout.


[web2py] posting a dict on ajax load vars

2014-06-08 Thread Avi A
Hi,
I want to pass a dict in ajax function like that:
$("#create_report").click(function(){
   url_report = 'eco_reports?graph_data={{=graph_data}}';
   ajax(url_report, '', 'save_as_link');

and the controller starts with something like that:
def eco_reports()::
   for item in (request.vars.graph_data):
something item.f_test_name
..

The error I get:

AttributeError: 'str' object has no attribute 'f_test_name'

what's the way to do what I Want?

thanks






-- 
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/d/optout.


[web2py] Re: boolean field type in a query.

2014-03-27 Thread Avi A
thanks.

On Thursday, March 27, 2014 6:28:31 PM UTC+2, Niphlod wrote:
>
> NULLs are NULL. They are nothing. Like in a suspended state. Dust in the 
> wind. Completely untraceable unless IS NULL or IS NOT NULL are specified as 
> WHERE clauses.
>
> Not True means False. 
> Not False means True.
>
> If you need to fetch False OR NULL records
>
> db(
>  (db.t_tests.f_test_is_a_clone == False) | 
>   (db.t_tests.f_test_is_a_clone == None)
> ).select()
>
> or (hidden gem)
>
> db(db.t_tests.f_test_is_a_clone.belongs((False, None), 
> null=True)).select()
>
> On Thursday, March 27, 2014 12:46:18 PM UTC+1, Avi A wrote:
>>
>> i checked all items as clones, then unchecked those i wanted,, and it's 
>> all fine now.
>> thanks.
>>
>> On Thursday, March 27, 2014 1:20:28 PM UTC+2, Mandar Vaze wrote:
>>>
>>> Which DB are you using ? The generated SQL seems correct (For MySQL - 
>>> is_active is set to 'T' for True and 'F' for False) 
>>>
>>> Can you run the (modified, if needed) raw SQL query on the DB ? Just 
>>> examine various values under the f_test_is_a_clone column.
>>> That will give you idea as to what should be the "raw" SQL query - based 
>>> on which you'll be able to figure out what you may be doing wrong in DAL 
>>> query
>>>
>>> You can also try 
>>>
>>> (db.t_tests.f_test_is_a_clone != True)
>>>
>>> -Mandar
>>>
>>>
>>> On Thursday, March 27, 2014 1:58:16 AM UTC+5:30, Avi A wrote:
>>>>
>>>> Now I use:
>>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (db.
>>>> t_tests.f_test_is_a_clone == False) ).select()
>>>>
>>>>
>>>>
>>>> and the list is still emply. 
>>>>
>>>> SELECT t_tests.id, t_tests.f_test_name, t_tests.f_test_project, t_tests
>>>> .f_test_platform, t_tests.f_test_device, t_tests.f_test_milestone,t_tests
>>>> .f_test_env, t_tests.f_test_description, t_tests.f_test_case_link,t_tests
>>>> .f_test_is_a_clone, t_tests.is_active, t_tests.created_on, t_tests.
>>>> created_by, t_tests.modified_on, t_tests.modified_by FROM t_tests 
>>>> WHERE ((t_tests.created_by = 1) AND (t_tests.f_test_is_a_clone = 'F')); 
>>>>
>>>>
>>>>
>>>> thanks. 
>>>>
>>>>
>>>>
>>>> On Wednesday, March 26, 2014 8:53:10 PM UTC+2, Avi A wrote:
>>>>>
>>>>> Thanks you all and for the debugging tip. :)
>>>>>
>>>>> On Wednesday, March 26, 2014 7:57:28 PM UTC+2, Anthony wrote:
>>>>>>
>>>>>> In DAL queries, you must use &, |, ==, and ~ rather than "and", "or", 
>>>>>> "is", and "not". This is because in Python, the former operators can be 
>>>>>> overloaded (in the case of the DAL, via the Expression class) but the 
>>>>>> latter cannot.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>> On Tuesday, March 25, 2014 8:08:40 PM UTC-4, Avi A wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> i have a table with a boolean field:
>>>>>>>
>>>>>>> Field('f_test_is_a_clone', type='boolean',
>>>>>>>   label=T('Test is a clone')),
>>>>>>>
>>>>>>> And this is the query, where I don't want to return cloned tests:
>>>>>>>
>>>>>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db
>>>>>>> .t_tests.f_test_is_a_clone)).select()
>>>>>>>
>>>>>>> but it returns empty list. 
>>>>>>> What should i fix?
>>>>>>> thanks.
>>>>>>>
>>>>>>

-- 
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/d/optout.


[web2py] Re: boolean field type in a query.

2014-03-27 Thread Avi A
i checked all items as clones, then unchecked those i wanted,, and it's all 
fine now.
thanks.

On Thursday, March 27, 2014 1:20:28 PM UTC+2, Mandar Vaze wrote:
>
> Which DB are you using ? The generated SQL seems correct (For MySQL - 
> is_active is set to 'T' for True and 'F' for False) 
>
> Can you run the (modified, if needed) raw SQL query on the DB ? Just 
> examine various values under the f_test_is_a_clone column.
> That will give you idea as to what should be the "raw" SQL query - based 
> on which you'll be able to figure out what you may be doing wrong in DAL 
> query
>
> You can also try 
>
> (db.t_tests.f_test_is_a_clone != True)
>
> -Mandar
>
>
> On Thursday, March 27, 2014 1:58:16 AM UTC+5:30, Avi A wrote:
>>
>> Now I use:
>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & 
>> (db.t_tests.f_test_is_a_clone 
>> == False) ).select()
>>
>>
>>
>> and the list is still emply. 
>>
>> SELECT t_tests.id, t_tests.f_test_name, t_tests.f_test_project, t_tests.
>> f_test_platform, t_tests.f_test_device, t_tests.f_test_milestone, t_tests
>> .f_test_env, t_tests.f_test_description, t_tests.f_test_case_link,t_tests
>> .f_test_is_a_clone, t_tests.is_active, t_tests.created_on, t_tests.
>> created_by, t_tests.modified_on, t_tests.modified_by FROM t_tests WHERE 
>> ((t_tests.created_by = 1) AND (t_tests.f_test_is_a_clone = 'F')); 
>>
>>
>>
>> thanks. 
>>
>>
>>
>> On Wednesday, March 26, 2014 8:53:10 PM UTC+2, Avi A wrote:
>>>
>>> Thanks you all and for the debugging tip. :)
>>>
>>> On Wednesday, March 26, 2014 7:57:28 PM UTC+2, Anthony wrote:
>>>>
>>>> In DAL queries, you must use &, |, ==, and ~ rather than "and", "or", 
>>>> "is", and "not". This is because in Python, the former operators can be 
>>>> overloaded (in the case of the DAL, via the Expression class) but the 
>>>> latter cannot.
>>>>
>>>> Anthony
>>>>
>>>> On Tuesday, March 25, 2014 8:08:40 PM UTC-4, Avi A wrote:
>>>>
>>>>> Hi,
>>>>> i have a table with a boolean field:
>>>>>
>>>>> Field('f_test_is_a_clone', type='boolean',
>>>>>   label=T('Test is a clone')),
>>>>>
>>>>> And this is the query, where I don't want to return cloned tests:
>>>>>
>>>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db.
>>>>> t_tests.f_test_is_a_clone)).select()
>>>>>
>>>>> but it returns empty list. 
>>>>> What should i fix?
>>>>> thanks.
>>>>>
>>>>

-- 
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/d/optout.


[web2py] Re: boolean field type in a query.

2014-03-26 Thread Avi A
I tried to add NULL to the query, if that what you meant, but it says that 
NULL is undefined.

On Wednesday, March 26, 2014 11:43:11 PM UTC+2, Niphlod wrote:
>
> Maybe (but just maybe) you need to fetch ALSO records that have a 
> f_test_is_a_clone that is NULL ?
>
> On Wednesday, March 26, 2014 9:28:16 PM UTC+1, Avi A wrote:
>>
>> Now I use:
>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & 
>> (db.t_tests.f_test_is_a_clone 
>> == False) ).select()
>>
>>
>>
>> and the list is still emply. 
>>
>> SELECT t_tests.id, t_tests.f_test_name, t_tests.f_test_project, t_tests.
>> f_test_platform, t_tests.f_test_device, t_tests.f_test_milestone, t_tests
>> .f_test_env, t_tests.f_test_description, t_tests.f_test_case_link,t_tests
>> .f_test_is_a_clone, t_tests.is_active, t_tests.created_on, t_tests.
>> created_by, t_tests.modified_on, t_tests.modified_by FROM t_tests WHERE 
>> ((t_tests.created_by = 1) AND (t_tests.f_test_is_a_clone = 'F')); 
>>
>>
>>
>> thanks. 
>>
>>
>>
>> On Wednesday, March 26, 2014 8:53:10 PM UTC+2, Avi A wrote:
>>>
>>> Thanks you all and for the debugging tip. :)
>>>
>>> On Wednesday, March 26, 2014 7:57:28 PM UTC+2, Anthony wrote:
>>>>
>>>> In DAL queries, you must use &, |, ==, and ~ rather than "and", "or", 
>>>> "is", and "not". This is because in Python, the former operators can be 
>>>> overloaded (in the case of the DAL, via the Expression class) but the 
>>>> latter cannot.
>>>>
>>>> Anthony
>>>>
>>>> On Tuesday, March 25, 2014 8:08:40 PM UTC-4, Avi A wrote:
>>>>
>>>>> Hi,
>>>>> i have a table with a boolean field:
>>>>>
>>>>> Field('f_test_is_a_clone', type='boolean',
>>>>>   label=T('Test is a clone')),
>>>>>
>>>>> And this is the query, where I don't want to return cloned tests:
>>>>>
>>>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db.
>>>>> t_tests.f_test_is_a_clone)).select()
>>>>>
>>>>> but it returns empty list. 
>>>>> What should i fix?
>>>>> thanks.
>>>>>
>>>>

-- 
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/d/optout.


[web2py] Re: boolean field type in a query.

2014-03-26 Thread Avi A
Now I use:
my_tests_list = db((db.t_tests.created_by == auth.user.id) & 
(db.t_tests.f_test_is_a_clone 
== False) ).select()



and the list is still emply. 

SELECT t_tests.id, t_tests.f_test_name, t_tests.f_test_project, t_tests.
f_test_platform, t_tests.f_test_device, t_tests.f_test_milestone, t_tests.
f_test_env, t_tests.f_test_description, t_tests.f_test_case_link, t_tests.
f_test_is_a_clone, t_tests.is_active, t_tests.created_on, t_tests.created_by
, t_tests.modified_on, t_tests.modified_by FROM t_tests WHERE 
((t_tests.created_by 
= 1) AND (t_tests.f_test_is_a_clone = 'F')); 



thanks. 



On Wednesday, March 26, 2014 8:53:10 PM UTC+2, Avi A wrote:
>
> Thanks you all and for the debugging tip. :)
>
> On Wednesday, March 26, 2014 7:57:28 PM UTC+2, Anthony wrote:
>>
>> In DAL queries, you must use &, |, ==, and ~ rather than "and", "or", 
>> "is", and "not". This is because in Python, the former operators can be 
>> overloaded (in the case of the DAL, via the Expression class) but the 
>> latter cannot.
>>
>> Anthony
>>
>> On Tuesday, March 25, 2014 8:08:40 PM UTC-4, Avi A wrote:
>>
>>> Hi,
>>> i have a table with a boolean field:
>>>
>>> Field('f_test_is_a_clone', type='boolean',
>>>   label=T('Test is a clone')),
>>>
>>> And this is the query, where I don't want to return cloned tests:
>>>
>>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db.
>>> t_tests.f_test_is_a_clone)).select()
>>>
>>> but it returns empty list. 
>>> What should i fix?
>>> thanks.
>>>
>>

-- 
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/d/optout.


[web2py] Re: boolean field type in a query.

2014-03-26 Thread Avi A
Thanks you all and for the debugging tip. :)

On Wednesday, March 26, 2014 7:57:28 PM UTC+2, Anthony wrote:
>
> In DAL queries, you must use &, |, ==, and ~ rather than "and", "or", 
> "is", and "not". This is because in Python, the former operators can be 
> overloaded (in the case of the DAL, via the Expression class) but the 
> latter cannot.
>
> Anthony
>
> On Tuesday, March 25, 2014 8:08:40 PM UTC-4, Avi A wrote:
>
>> Hi,
>> i have a table with a boolean field:
>>
>> Field('f_test_is_a_clone', type='boolean',
>>   label=T('Test is a clone')),
>>
>> And this is the query, where I don't want to return cloned tests:
>>
>> my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db.
>> t_tests.f_test_is_a_clone)).select()
>>
>> but it returns empty list. 
>> What should i fix?
>> thanks.
>>
>

-- 
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/d/optout.


[web2py] boolean field type in a query.

2014-03-25 Thread Avi A
Hi,
i have a table with a boolean field:

Field('f_test_is_a_clone', type='boolean',
  label=T('Test is a clone')),

And this is the query, where I don't want to return cloned tests:

my_tests_list = db((db.t_tests.created_by == auth.user.id) & (not db.t_tests
.f_test_is_a_clone)).select()

but it returns empty list. 
What should i fix?
thanks.

-- 
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/d/optout.


[web2py] Re: Creating a background task script on models, db is not defined.

2014-03-23 Thread Avi A

Yes I **do**.
If I write the function on the default.py and run it via 
default/import_catalog it works.
On Sunday, March 23, 2014 7:34:20 PM UTC+2, Niphlod wrote:
>
> very very strange. 
> just for completeness sake, you **do** have models/db.py with
>
> db = DAL(.)
>
> right ?
>
> On Saturday, March 22, 2014 8:49:11 PM UTC+1, Avi A wrote:
>>
>> Same.
>> /models/z_import_catalog.py", line 13, in 
>> item = db(db.t_items.unfi_product == row[5]).select().first()
>> NameError: name 'db' is not defined
>>
>>
>>
>> On Saturday, March 22, 2014 9:20:03 PM UTC+2, Niphlod wrote:
>>>
>>> try calling it z_whatever.py and see. 
>>>
>>> On Saturday, March 22, 2014 3:34:48 PM UTC+1, Avi A wrote:
>>>>
>>>> Sorry, I'm still getting the same error.
>>>> I called that file:
>>>> db_wizard_catalog_insert.py , so it's located after the db_wizard.py 
>>>> and I just run the file.
>>>> Is that what you meant?
>>>>
>>>> On Saturday, March 22, 2014 4:05:03 PM UTC+2, Avi A wrote:
>>>>>
>>>>> Yes I tried that too, it didn't help. but now for some reason I'm not 
>>>>> getting the error any longer. Thanks.
>>>>>
>>>>> On Saturday, March 22, 2014 3:12:32 PM UTC+2, Niphlod wrote:
>>>>>>
>>>>>> make sure the model is run AFTER the one holding the db 
>>>>>> definition.models are executed alphabetically.
>>>>>>
>>>>>> On Friday, March 21, 2014 9:28:14 PM UTC+1, Avi A wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>> I'm trying to create a background job/function. I'm locating the 
>>>>>>> file on the models directory, as I read on the book.
>>>>>>> When I try to run the script manually, I get an error saying that db 
>>>>>>> is not defined.
>>>>>>> This is part of the code where I get the error:
>>>>>>> ..
>>>>>>> ..
>>>>>>> catalog = csv.reader(webpage)
>>>>>>> for row in catalog:
>>>>>>> item = db(db.t_items.unfi_product_== row[5]).select().first()
>>>>>>> if row > 0 and not item:
>>>>>>> ..
>>>>>>>
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>>

-- 
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/d/optout.


[web2py] Re: Creating a background task script on models, db is not defined.

2014-03-22 Thread Avi A
Same.
/models/z_import_catalog.py", line 13, in 
item = db(db.t_items.unfi_product == row[5]).select().first()
NameError: name 'db' is not defined



On Saturday, March 22, 2014 9:20:03 PM UTC+2, Niphlod wrote:
>
> try calling it z_whatever.py and see. 
>
> On Saturday, March 22, 2014 3:34:48 PM UTC+1, Avi A wrote:
>>
>> Sorry, I'm still getting the same error.
>> I called that file:
>> db_wizard_catalog_insert.py , so it's located after the db_wizard.py and 
>> I just run the file.
>> Is that what you meant?
>>
>> On Saturday, March 22, 2014 4:05:03 PM UTC+2, Avi A wrote:
>>>
>>> Yes I tried that too, it didn't help. but now for some reason I'm not 
>>> getting the error any longer. Thanks.
>>>
>>> On Saturday, March 22, 2014 3:12:32 PM UTC+2, Niphlod wrote:
>>>>
>>>> make sure the model is run AFTER the one holding the db 
>>>> definition.models are executed alphabetically.
>>>>
>>>> On Friday, March 21, 2014 9:28:14 PM UTC+1, Avi A wrote:
>>>>>
>>>>> Hi,
>>>>> I'm trying to create a background job/function. I'm locating the file 
>>>>> on the models directory, as I read on the book.
>>>>> When I try to run the script manually, I get an error saying that db 
>>>>> is not defined.
>>>>> This is part of the code where I get the error:
>>>>> ..
>>>>> ..
>>>>> catalog = csv.reader(webpage)
>>>>> for row in catalog:
>>>>> item = db(db.t_items.unfi_product_== row[5]).select().first()
>>>>> if row > 0 and not item:
>>>>> ..
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>>

-- 
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/d/optout.


[web2py] Re: Creating a background task script on models, db is not defined.

2014-03-22 Thread Avi A
Sorry, I'm still getting the same error.
I called that file:
db_wizard_catalog_insert.py , so it's located after the db_wizard.py and I 
just run the file.
Is that what you meant?

On Saturday, March 22, 2014 4:05:03 PM UTC+2, Avi A wrote:
>
> Yes I tried that too, it didn't help. but now for some reason I'm not 
> getting the error any longer. Thanks.
>
> On Saturday, March 22, 2014 3:12:32 PM UTC+2, Niphlod wrote:
>>
>> make sure the model is run AFTER the one holding the db 
>> definition.models are executed alphabetically.
>>
>> On Friday, March 21, 2014 9:28:14 PM UTC+1, Avi A wrote:
>>>
>>> Hi,
>>> I'm trying to create a background job/function. I'm locating the file on 
>>> the models directory, as I read on the book.
>>> When I try to run the script manually, I get an error saying that db is 
>>> not defined.
>>> This is part of the code where I get the error:
>>> ..
>>> ..
>>> catalog = csv.reader(webpage)
>>> for row in catalog:
>>> item = db(db.t_items.unfi_product_== row[5]).select().first()
>>> if row > 0 and not item:
>>> ..
>>>
>>>
>>> Thanks.
>>>
>>>
>>>

-- 
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/d/optout.


[web2py] Re: Creating a background task script on models, db is not defined.

2014-03-22 Thread Avi A
Yes I tried that too, it didn't help. but now for some reason I'm not 
getting the error any longer. Thanks.

On Saturday, March 22, 2014 3:12:32 PM UTC+2, Niphlod wrote:
>
> make sure the model is run AFTER the one holding the db 
> definition.models are executed alphabetically.
>
> On Friday, March 21, 2014 9:28:14 PM UTC+1, Avi A wrote:
>>
>> Hi,
>> I'm trying to create a background job/function. I'm locating the file on 
>> the models directory, as I read on the book.
>> When I try to run the script manually, I get an error saying that db is 
>> not defined.
>> This is part of the code where I get the error:
>> ..
>> ..
>> catalog = csv.reader(webpage)
>> for row in catalog:
>> item = db(db.t_items.unfi_product_== row[5]).select().first()
>> if row > 0 and not item:
>> ..
>>
>>
>> Thanks.
>>
>>
>>

-- 
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/d/optout.


[web2py] Creating a background task script on models, db is not defined.

2014-03-21 Thread Avi A
Hi,
I'm trying to create a background job/function. I'm locating the file on 
the models directory, as I read on the book.
When I try to run the script manually, I get an error saying that db is not 
defined.
This is part of the code where I get the error:
..
..
catalog = csv.reader(webpage)
for row in catalog:
item = db(db.t_items.unfi_product_== row[5]).select().first()
if row > 0 and not item:
..


Thanks.


-- 
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/d/optout.


[web2py] Re: Great summary of web2py

2014-03-05 Thread Avi A
I think that there on the features list, frameworks seekers would love to 
hear about the amazing web2py ajax and component functions and all the eco 
method as part of the awesome mvc system.

On Wednesday, March 5, 2014 6:23:14 PM UTC+2, Jorge Pereira wrote:
>
> VP  writes: 
>
> > 
> > 
>
> > 
> > Specifically, to attract newbies, I would recommend making Chapter 3 
> > of the book to be better than it currently is.   Right now, it's very 
> > good.  But I think there are places that can be improved.  This 
> > chapter is where web2py can be/should be showcased to attract the 
> > newbies.   This comes from my experience when I first learned about 
> > web2py. 
> > 
> > 
>
>
> I agree with VP about making chapter 3 and the rest of the book better 
> than 
> it is now, I'm learning Python and Web2Py coming from PHP/Symfony2... I 
> would recomend taking a look at Symfony's 2 documentantion its well 
> organized and looks great for programmers like me who want to learn a new 
> language and framework. 
>
> Greetings to everybody. 
>
>

-- 
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.


Re: [web2py] Re: How to render a returned json

2014-03-04 Thread Avi A
Yes, got it now, many thanks.

On Tuesday, March 4, 2014 7:42:28 PM UTC+2, Jonathan Lundell wrote:
>
> On 4 Mar 2014, at 9:19 AM, Avi A > wrote:
>
> I do the same I get:
>
> TypeError: string indices must be integers, not str
>
>
> Try catching that exception and printing the object you're working with.
>
> It sounds like you're indexing the json string (r.content) rather than the 
> result of json.loads.
>
>
> On Tuesday, March 4, 2014 3:35:31 PM UTC+2, Avi A wrote:
>>
>> Hi,
>> I'm getting on a controller a json response as expected, and I didn't 
>> find a way how to parse it yet:
>>
>> r = requests.post(url, data=json.dumps(payload), headers=headers)
>> r.content returns something like that:
>> {
>>   "owner_ids": [
>>
>>   ],
>>   "labels": [
>> {
>>   "id": 7864106,
>>   "created_at": "2014-03-04T10:39:27Z",
>>   "project_id": 941736,
>>   "name": "label",
>>   "kind": "label",
>>   "updated_at": "2014-03-04T10:39:27Z"
>> }
>>   ],
>>   "current_state": "unscheduled",
>>   "id": 66856110,
>>   "created_at": "2014-03-04T13:31:33Z",
>>   "story_type": "bug",
>>   "project_id": 941736,
>>   "name": "title",
>>   "url": "http://www.pivotaltracker.com/story/show/66856110";,
>>   "kind": "story",
>>   "updated_at": "2014-03-04T13:31:33Z",
>>   "requested_by_id": 735355,
>>   "description": "story http://google.com/105";
>> }
>>
>> Thanks.
>>
>>
> -- 
> 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+un...@googlegroups.com .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>

-- 
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.


[web2py] Re: How to render a returned json

2014-03-04 Thread Avi A
I do the same I get:

TypeError: string indices must be integers, not str

On Tuesday, March 4, 2014 3:35:31 PM UTC+2, Avi A wrote:
>
> Hi,
> I'm getting on a controller a json response as expected, and I didn't find 
> a way how to parse it yet:
>
> r = requests.post(url, data=json.dumps(payload), headers=headers)
> r.content returns something like that:
> {
>   "owner_ids": [
>
>   ],
>   "labels": [
> {
>   "id": 7864106,
>   "created_at": "2014-03-04T10:39:27Z",
>   "project_id": 941736,
>   "name": "label",
>   "kind": "label",
>   "updated_at": "2014-03-04T10:39:27Z"
> }
>   ],
>   "current_state": "unscheduled",
>   "id": 66856110,
>   "created_at": "2014-03-04T13:31:33Z",
>   "story_type": "bug",
>   "project_id": 941736,
>   "name": "title",
>   "url": "http://www.pivotaltracker.com/story/show/66856110";,
>   "kind": "story",
>   "updated_at": "2014-03-04T13:31:33Z",
>   "requested_by_id": 735355,
>   "description": "story http://google.com/105";
> }
>
> Thanks.
>
>

-- 
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.


Re: [web2py] How to render a returned json

2014-03-04 Thread Avi A
thanks,
i've tried it but I am not able to parse it:
I tried both:
pivotal = json.loads(r.content)

session.flash(pivotal['url'])
session.flash(pivotal[0].url)



On Tuesday, March 4, 2014 5:18:02 PM UTC+2, Jonathan Lundell wrote:
>
> On 4 Mar 2014, at 5:35 AM, Avi A > wrote:
>
> Hi,
> I'm getting on a controller a json response as expected, and I didn't find 
> a way how to parse it yet:
>
>
> json.loads(r.content) will convert it to a dict.
>
>
> r = requests.post(url, data=json.dumps(payload), headers=headers)
> r.content returns something like that:
> {
>   "owner_ids": [
>
>   ],
>   "labels": [
> {
>   "id": 7864106,
>   "created_at": "2014-03-04T10:39:27Z",
>   "project_id": 941736,
>   "name": "label",
>   "kind": "label",
>   "updated_at": "2014-03-04T10:39:27Z"
> }
>   ],
>   "current_state": "unscheduled",
>   "id": 66856110,
>   "created_at": "2014-03-04T13:31:33Z",
>   "story_type": "bug",
>   "project_id": 941736,
>   "name": "title",
>   "url": "http://www.pivotaltracker.com/story/show/66856110";,
>   "kind": "story",
>   "updated_at": "2014-03-04T13:31:33Z",
>   "requested_by_id": 735355,
>   "description": "story http://google.com/105";
> }
>
> Thanks.
>
>
> -- 
> 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+un...@googlegroups.com .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>

-- 
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.


[web2py] How to render a returned json

2014-03-04 Thread Avi A
Hi,
I'm getting on a controller a json response as expected, and I didn't find 
a way how to parse it yet:

r = requests.post(url, data=json.dumps(payload), headers=headers)
r.content returns something like that:
{
  "owner_ids": [

  ],
  "labels": [
{
  "id": 7864106,
  "created_at": "2014-03-04T10:39:27Z",
  "project_id": 941736,
  "name": "label",
  "kind": "label",
  "updated_at": "2014-03-04T10:39:27Z"
}
  ],
  "current_state": "unscheduled",
  "id": 66856110,
  "created_at": "2014-03-04T13:31:33Z",
  "story_type": "bug",
  "project_id": 941736,
  "name": "title",
  "url": "http://www.pivotaltracker.com/story/show/66856110";,
  "kind": "story",
  "updated_at": "2014-03-04T13:31:33Z",
  "requested_by_id": 735355,
  "description": "story http://google.com/105";
}

Thanks.

-- 
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.


[web2py] Re: using requests library ques

2014-03-03 Thread Avi A
Lol, that works. thanks.

On Monday, March 3, 2014 6:20:55 PM UTC+2, Anthony wrote:
>
> Try just doing:
>
> import requests
>
> Anthony
>
> On Monday, March 3, 2014 11:15:33 AM UTC-5, Avi A wrote:
>>
>> Hi,
>> I need some help with implementing "requests" library.
>> What I did:
>> I have cloned the requests library to my app modules app. (didn't 
>> "install" anything)
>> I tried these both options I found, one at a time:
>> requests = local_import('requests')
>> from modules import requests
>> And in both cases I got:
>>
>> ImportError: No module named modules
>>
>>
>> Thanks.
>>
>>
>>
>>

-- 
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.


[web2py] using requests library ques

2014-03-03 Thread Avi A
Hi,
I need some help with implementing "requests" library.
What I did:
I have cloned the requests library to my app modules app. (didn't "install" 
anything)
I tried these both options I found, one at a time:
requests = local_import('requests')
from modules import requests
And in both cases I got:

ImportError: No module named modules


Thanks.



-- 
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.


[web2py] Re: How to pre filter a table I want to join.

2014-02-24 Thread Avi A
Yep, this way it work:
  if request.vars.platform != 'ALL':
platform_query = db.t_tests.f_test_platform == request.vars.platform
graph_query = graph_query & (platform_query)
if request.vars.project != 'ALL':
project_query = db.t_tests.f_test_project == request.vars.project
graph_query = graph_query & (project_query)
if request.vars.device != 'ALL':
device_query = db.t_tests.f_test_device == request.vars.device
graph_query = graph_query & (device_query)
if request.vars.milestone != 'ALL':
milestone_query = db.t_tests.f_test_milestone == 
request.vars.milestone
graph_query = graph_query & (milestone_query)
if request.vars.env !='ALL':
env_query = db.t_tests.f_tests_env == request.vars.env
graph_query = graph_query & (env_query)

Many thanks.  :).

On Monday, February 24, 2014 4:51:31 PM UTC+2, Avi A wrote:
>
> Hi,
> I want to join t_a  and t_b:
> rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_y 
> == db.t_b.id))
> that works,
> But  first I want to filter out t_b, for example: t_b to include only 
> records where f_x == 3.
> what I tried did not work, it just "ignored" it, nothing was filtered:
>
> t_b = db.t_b.f_x ==3
> rows = db(db.t_a.created_by == 
> auth.user.id).select(join=db.t_b.on(db.t_a.f_test 
> == db.t_b.id))
>
> So what is the way to do it?
> thanks.
>
>
>

-- 
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.


[web2py] Re: How to pre filter a table I want to join.

2014-02-24 Thread Avi A
I'll try to filter the t_tests only first.

On Monday, February 24, 2014 4:51:31 PM UTC+2, Avi A wrote:
>
> Hi,
> I want to join t_a  and t_b:
> rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_y 
> == db.t_b.id))
> that works,
> But  first I want to filter out t_b, for example: t_b to include only 
> records where f_x == 3.
> what I tried did not work, it just "ignored" it, nothing was filtered:
>
> t_b = db.t_b.f_x ==3
> rows = db(db.t_a.created_by == 
> auth.user.id).select(join=db.t_b.on(db.t_a.f_test 
> == db.t_b.id))
>
> So what is the way to do it?
> thanks.
>
>
>

-- 
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.


[web2py] Re: How to pre filter a table I want to join.

2014-02-24 Thread Avi A
I tried the below syntex. It works, throughs no errors but the list is not 
being filtered, (when selecting a value other than ALL):
def filter_eco_graph():
my_graphs = db.t_tests_results.created_by == auth.user.id

a = request.vars   # just for testing and it renders what is expected. 
()
graph_query = (my_graphs)
if request.vars.platform != 'ALL':
platform_query = db.t_types.id == request.vars.platform
graph_query = graph_query & (platform_query)
if request.vars.project != 'ALL':
project_query = db.t_projects.id == request.vars.project
graph_query = graph_query & (project_query)
if request.vars.device != 'ALL':
device_query = db.t_devices.id == request.vars.device
graph_query = graph_query & (device_query)
if request.vars.milestone != 'ALL':
milestone_query = db.t_milestones.id == request.vars.milestone
graph_query = graph_query & (milestone_query)
if request.vars.env !='ALL':
env_query = db.t_envs.id == request.vars.env
graph_query = graph_query & (env_query)


graph_data = db(graph_query).select(join=db.t_tests.on(db.
t_tests_results.f_test == db.t_tests.id))
return locals()











On Monday, February 24, 2014 5:03:36 PM UTC+2, Avi A wrote:
>
> thanks, yes i just realised i don't need the joint for the filtering.
>
> On Monday, February 24, 2014 4:57:37 PM UTC+2, Anthony wrote:
>>
>> t_b = db.t_b.f_x ==3
>>>
>>
>> Doesn't look like you do anything with the above. Why not:
>>
>> rows = db((db.t_a.created_by == auth.user.id) & (db.t_b.f_x == 3)).select
>> (
>> join=db.t_b.on(db.t_a.f_test == db.t_b.id))
>>
>> Note, you can also do a join via:
>>
>> rows = db((db.t_a.created_by == auth.user.id) & (db.t_b.f_x == 3) &
>>   (db.t_a.f_test == db.t_b.id)).select()
>>
>> Technically, that will implement the join via a SQL WHERE clause rather 
>> than the JOIN statement.
>>
>> Anthony
>>
>

-- 
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.


[web2py] Re: How to pre filter a table I want to join.

2014-02-24 Thread Avi A
thanks, yes i just realised i don't need the joint for the filtering.

On Monday, February 24, 2014 4:57:37 PM UTC+2, Anthony wrote:
>
> t_b = db.t_b.f_x ==3
>>
>
> Doesn't look like you do anything with the above. Why not:
>
> rows = db((db.t_a.created_by == auth.user.id) & (db.t_b.f_x == 3)).select(
> join=db.t_b.on(db.t_a.f_test == db.t_b.id))
>
> Note, you can also do a join via:
>
> rows = db((db.t_a.created_by == auth.user.id) & (db.t_b.f_x == 3) &
>   (db.t_a.f_test == db.t_b.id)).select()
>
> Technically, that will implement the join via a SQL WHERE clause rather 
> than the JOIN statement.
>
> Anthony
>

-- 
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.


[web2py] How to pre filter a table I want to join.

2014-02-24 Thread Avi A
Hi,
I want to join t_a  and t_b:
rows = db(db.t_a.created_by == 
auth.user.id).select(join=db.t_b.on(db.t_a.f_y == db.t_b.id))
that works,
But  first I want to filter out t_b, for example: t_b to include only 
records where f_x == 3.
what I tried did not work, it just "ignored" it, nothing was filtered:

t_b = db.t_b.f_x ==3
rows = db(db.t_a.created_by == 
auth.user.id).select(join=db.t_b.on(db.t_a.f_test == db.t_b.id))

So what is the way to do it?
thanks.


-- 
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.


[web2py] Re: return all results for a field if no query.

2014-02-23 Thread Avi A
thanks.

On Sunday, February 23, 2014 12:34:58 AM UTC+2, Anthony wrote:
>
> If you make sure your URL vars have the same names as the associated table 
> fields, you can simplify further as follows:
>
> def eco:
> my_content = db.table.created_by == auth.user.id
> filter_query = reduce(lambda a, b: a & b,
>   [db.table[v] == request.vars[v] for v in request
> .vars
>if v in db.table.fields])
> filtered_list = db(my_content & filter_query).select(,) 
> return dict(filtered_list = filtered_list)
>
> or if you prefer loops:
>
> def eco:
> filter_query = db.table.created_by == auth.user.id
> for var in [v for v in request.vars if v in table.fields]:
> filter_query &= db.table[var] == request.vars[var]
> filtered_list = db(filter_query).select(,) 
> return dict(filtered_list = filtered_list)
>
> Anthony
>
> On Saturday, February 22, 2014 3:25:34 PM UTC-5, Avi A wrote:
>>
>> Great, thanks. the "moreover" idea is what i was missing. Yeah, I'll 
>> replace the args with vars url, thanks.
>>
>>
>> On Saturday, February 22, 2014 9:36:58 PM UTC+2, Niphlod wrote:
>>>
>>> every 
>>> db.table.column == parameter
>>> is something that further reduces the resultset (it's a "filter" 
>>> condition)
>>> in case "parameter" is 0, just don't use that condition in the query ^_^
>>>
>>> moreover, you can do
>>>
>>> filter_condition = (db.table.created_by == auth.user_id)
>>> if .
>>> filter_condition = filter_condition & (db.table.field_a == something)
>>> 
>>> 
>>>
>>> filtered_set = db(filter_condition).select()
>>>
>>>
>>> PS: usually filters are more "manageable" with request.vars than 
>>> request.args() ... it's a little unconfortable to remember the order of the 
>>> filter and to specify 0 as the "ALL" parameter is counterintuitive  
>>> eco/0/1/0/6/0/0 sounds a lot more ugly than eco?b=1&d=6
>>>
>>> On Saturday, February 22, 2014 7:28:33 PM UTC+1, Avi A wrote:
>>>>
>>>> Hi,
>>>> Assuming I want to create an ajax query that will filter the results 
>>>> according to some data in fields:
>>>>  for example: ajax url:  ... eco/1/6/4/5/3
>>>>
>>>> def eco:
>>>> my_content = db.table.created_by == auth.user.id
>>>> query_a = db.table.field_a == request.args(0)
>>>> query_b = db.table.field_b== request.args(1)
>>>> query_c = db.table.field_c == request.args(2)
>>>> query_d = db.table.field_d == request.args(3)
>>>> query_e = db.table.field_e == request.args(4)
>>>> 
>>>> filtered_list = db((my_content) & (query_a) & (query_b) & (query_c) 
>>>> & (query_d) & (query_e)).select(,) 
>>>> return dict(filtered_list = filtered_list)
>>>> I guess, so far so good.
>>>>
>>>> Now if any arg == 0 , (for example: eco/2/0/0/0/3) I want it to skip 
>>>> that specific query.
>>>>
>>>> So I want to a chive something like that:
>>>> if request.args(0) != 0:
>>>> query_a = db.table.field_a == request.args(0)
>>>> else:
>>>> query_a = db.table.field_a == ALL
>>>>if request.args(01) != 0:
>>>> etc"...
>>>>
>>>> with what should I replace the ALL? or the else part?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> 
>>>> 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>

-- 
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.


[web2py] Re: return all results for a field if no query.

2014-02-22 Thread Avi A
Great, thanks. the "moreover" idea is what i was missing. Yeah, I'll 
replace the args with vars url, thanks.


On Saturday, February 22, 2014 9:36:58 PM UTC+2, Niphlod wrote:
>
> every 
> db.table.column == parameter
> is something that further reduces the resultset (it's a "filter" condition)
> in case "parameter" is 0, just don't use that condition in the query ^_^
>
> moreover, you can do
>
> filter_condition = (db.table.created_by == auth.user_id)
> if .
> filter_condition = filter_condition & (db.table.field_a == something)
> 
> 
>
> filtered_set = db(filter_condition).select()
>
>
> PS: usually filters are more "manageable" with request.vars than 
> request.args() ... it's a little unconfortable to remember the order of the 
> filter and to specify 0 as the "ALL" parameter is counterintuitive  
> eco/0/1/0/6/0/0 sounds a lot more ugly than eco?b=1&d=6
>
> On Saturday, February 22, 2014 7:28:33 PM UTC+1, Avi A wrote:
>>
>> Hi,
>> Assuming I want to create an ajax query that will filter the results 
>> according to some data in fields:
>>  for example: ajax url:  ... eco/1/6/4/5/3
>>
>> def eco:
>> my_content = db.table.created_by == auth.user.id
>> query_a = db.table.field_a == request.args(0)
>> query_b = db.table.field_b== request.args(1)
>> query_c = db.table.field_c == request.args(2)
>> query_d = db.table.field_d == request.args(3)
>> query_e = db.table.field_e == request.args(4)
>> 
>> filtered_list = db((my_content) & (query_a) & (query_b) & (query_c) & 
>> (query_d) & (query_e)).select(,) 
>> return dict(filtered_list = filtered_list)
>> I guess, so far so good.
>>
>> Now if any arg == 0 , (for example: eco/2/0/0/0/3) I want it to skip that 
>> specific query.
>>
>> So I want to a chive something like that:
>> if request.args(0) != 0:
>> query_a = db.table.field_a == request.args(0)
>> else:
>> query_a = db.table.field_a == ALL
>>if request.args(01) != 0:
>> etc"...
>>
>> with what should I replace the ALL? or the else part?
>>
>> Thanks.
>>
>>
>> 
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

-- 
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.


[web2py] return all results for a field if no query.

2014-02-22 Thread Avi A
Hi,
Assuming I want to create an ajax query that will filter the results 
according to some data in fields:
 for example: ajax url:  ... eco/1/6/4/5/3

def eco:
my_content = db.table.created_by == auth.user.id
query_a = db.table.field_a == request.args(0)
query_b = db.table.field_b== request.args(1)
query_c = db.table.field_c == request.args(2)
query_d = db.table.field_d == request.args(3)
query_e = db.table.field_e == request.args(4)

filtered_list = db((my_content) & (query_a) & (query_b) & (query_c) & 
(query_d) & (query_e)).select(,) 
return dict(filtered_list = filtered_list)
I guess, so far so good.

Now if any arg == 0 , (for example: eco/2/0/0/0/3) I want it to skip that 
specific query.

So I want to a chive something like that:
if request.args(0) != 0:
query_a = db.table.field_a == request.args(0)
else:
query_a = db.table.field_a == ALL
   if request.args(01) != 0:
etc"...

with what should I replace the ALL? or the else part?

Thanks.
















-- 
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.


[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
Oops. alright, thanks a lot.

On Sunday, February 16, 2014 4:58:06 PM UTC+2, Anthony wrote:
>
> You didn't update your controller code -- request.args(0) should now be 
> request.vars.code.
>
> On Sunday, February 16, 2014 9:46:47 AM UTC-5, Avi A wrote:
>>
>> I mean that it displays the "searching" (the "else" part) and the 
>> query doesn't find it:
>>
>> org_code_name = db(db.t_orgs.f_org_code == 
>> request.args(0)).select(db.t_orgs.ALL)
>> if org_code_name:
>> ...
>>else:
>>return 'searching..'
>>
>> if the password is just "123" it works. (and not 123!).
>>
>>
>> On Sunday, February 16, 2014 4:35:55 PM UTC+2, Anthony wrote:
>>>
>>> Sorry, should be encodeURIComponent. What do you mean it doesn't find it?
>>>
>>> On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote:
>>>>
>>>> This almost works (no error):
>>>> encodeURIComponent (without the "d").
>>>> But it doesn't find it
>>>>
>>>> On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote:
>>>>>
>>>>> "ReferenceError: encodedURIComponent is not defined"
>>>>>
>>>>> How do I define it? Do I have to import something?
>>>>> Thanks.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote:
>>>>>>
>>>>>> great, thanks .
>>>>>>
>>>>>> On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote:
>>>>>>>
>>>>>>> and what you expected ? :-P
>>>>>>> you built your function to post to an url like 
>>>>>>>
>>>>>>> /base_url/
>>>>>>> whatever_is_inserted_in_the_form_without_encoding_or_sanitization
>>>>>>>
>>>>>>> Not every url is a valid one (try opening /base_url/ì^'0=")and 
>>>>>>> its generally NOT safe doing what you're doing. 
>>>>>>> User input in web applications needs to be either validated before 
>>>>>>> or properly escaped.usually you'd want base_url?something=
>>>>>>> escaped_value
>>>>>>> that you can retrieve later with response.vars.something
>>>>>>>
>>>>>>>
>>>>>>> On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote:
>>>>>>>>
>>>>>>>> All I see is:invalid request
>>>>>>>> rendered on the #org_form_target
>>>>>>>> #model
>>>>>>>> db.define_table('t_orgs',
>>>>>>>> Field('f_org_name', type='string',
>>>>>>>>   label=T('Organization Name')),
>>>>>>>> Field('f_org_code', type='password',
>>>>>>>>   label=T('Organization pasword')),
>>>>>>>> Field('org_api_key', length=64, type='string', 
>>>>>>>> default=uuid.uuid4(), writable=False),
>>>>>>>> auth.signature,
>>>>>>>> format='%(f_org_name)s',
>>>>>>>> migrate=settings.migrate)
>>>>>>>>
>>>>>>>> db.define_table('t_orgs_archive', db.t_orgs,
>>>>>>>> Field('current_record', 'reference t_orgs', 
>>>>>>>> readable=False, writable=False))
>>>>>>>>
>>>>>>>>
>>>>>>>> #controller:
>>>>>>>> def org_form_load():
>>>>>>>> org_code_name = db(db.t_orgs.f_org_code == 
>>>>>>>> request.args(0)).select(db.t_orgs.ALL)
>>>>>>>> if org_code_name:
>>>>>>>> db.t_org_members.f_org_rep.default = org_code_name[0].id
>>>>>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>>>>>> label_org_name = 'Join ' + org_code_name[0].f_org_name + ' 
>>>>>>>> Organization'
>>>>>>>> form = SQLFORM(db.t_org_members, onupda

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
I mean that it displays the "searching" (the "else" part) and the query 
doesn't find it:

org_code_name = db(db.t_orgs.f_org_code == 
request.args(0)).select(db.t_orgs.ALL)
if org_code_name:
...
   else:
   return 'searching..'

if the password is just "123" it works. (and not 123!).


On Sunday, February 16, 2014 4:35:55 PM UTC+2, Anthony wrote:
>
> Sorry, should be encodeURIComponent. What do you mean it doesn't find it?
>
> On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote:
>>
>> This almost works (no error):
>> encodeURIComponent (without the "d").
>> But it doesn't find it
>>
>> On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote:
>>>
>>> "ReferenceError: encodedURIComponent is not defined"
>>>
>>> How do I define it? Do I have to import something?
>>> Thanks.
>>>
>>>
>>>
>>>
>>> On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote:
>>>>
>>>> great, thanks .
>>>>
>>>> On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote:
>>>>>
>>>>> and what you expected ? :-P
>>>>> you built your function to post to an url like 
>>>>>
>>>>> /base_url/
>>>>> whatever_is_inserted_in_the_form_without_encoding_or_sanitization
>>>>>
>>>>> Not every url is a valid one (try opening /base_url/ì^'0=")and 
>>>>> its generally NOT safe doing what you're doing. 
>>>>> User input in web applications needs to be either validated before or 
>>>>> properly escaped.usually you'd want base_url?something=
>>>>> escaped_value
>>>>> that you can retrieve later with response.vars.something
>>>>>
>>>>>
>>>>> On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote:
>>>>>>
>>>>>> All I see is:invalid request
>>>>>> rendered on the #org_form_target
>>>>>> #model
>>>>>> db.define_table('t_orgs',
>>>>>> Field('f_org_name', type='string',
>>>>>>   label=T('Organization Name')),
>>>>>> Field('f_org_code', type='password',
>>>>>>   label=T('Organization pasword')),
>>>>>> Field('org_api_key', length=64, type='string', 
>>>>>> default=uuid.uuid4(), writable=False),
>>>>>> auth.signature,
>>>>>> format='%(f_org_name)s',
>>>>>> migrate=settings.migrate)
>>>>>>
>>>>>> db.define_table('t_orgs_archive', db.t_orgs,
>>>>>> Field('current_record', 'reference t_orgs', 
>>>>>> readable=False, writable=False))
>>>>>>
>>>>>>
>>>>>> #controller:
>>>>>> def org_form_load():
>>>>>> org_code_name = db(db.t_orgs.f_org_code == 
>>>>>> request.args(0)).select(db.t_orgs.ALL)
>>>>>> if org_code_name:
>>>>>> db.t_org_members.f_org_rep.default = org_code_name[0].id
>>>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>>>> label_org_name = 'Join ' + org_code_name[0].f_org_name + ' 
>>>>>> Organization'
>>>>>> form = SQLFORM(db.t_org_members, onupdate=auth.archive, 
>>>>>> submit_button= label_org_name)
>>>>>> if form.process().accepted:
>>>>>> session.flash = 'Welcome to \'' + 
>>>>>> org_code_name[0].f_org_name + '\' Organization!'
>>>>>> redirect(URL('default', 'api_key.html'), client_side=True)
>>>>>> elif form.errors:
>>>>>> response.flash = 'response errors'
>>>>>> return dict(form=form, org_code_name=org_code_name)
>>>>>>
>>>>>> else:
>>>>>> return 'searching.'
>>>>>>
>>>>>> #view
>>>>>> 
>>>>>> Type your organization code:
>>>>>>
>>>>>>

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
This almost works (no error):
encodeURIComponent (without the "d").
But it doesn't find it

On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote:
>
> "ReferenceError: encodedURIComponent is not defined"
>
> How do I define it? Do I have to import something?
> Thanks.
>
>
>
>
> On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote:
>>
>> great, thanks .
>>
>> On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote:
>>>
>>> and what you expected ? :-P
>>> you built your function to post to an url like 
>>>
>>> /base_url/
>>> whatever_is_inserted_in_the_form_without_encoding_or_sanitization
>>>
>>> Not every url is a valid one (try opening /base_url/ì^'0=")and its 
>>> generally NOT safe doing what you're doing. 
>>> User input in web applications needs to be either validated before or 
>>> properly escaped.usually you'd want base_url?something=escaped_value
>>> that you can retrieve later with response.vars.something
>>>
>>>
>>> On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote:
>>>>
>>>> All I see is:invalid request
>>>> rendered on the #org_form_target
>>>> #model
>>>> db.define_table('t_orgs',
>>>> Field('f_org_name', type='string',
>>>>   label=T('Organization Name')),
>>>> Field('f_org_code', type='password',
>>>>   label=T('Organization pasword')),
>>>> Field('org_api_key', length=64, type='string', 
>>>> default=uuid.uuid4(), writable=False),
>>>> auth.signature,
>>>> format='%(f_org_name)s',
>>>> migrate=settings.migrate)
>>>>
>>>> db.define_table('t_orgs_archive', db.t_orgs,
>>>> Field('current_record', 'reference t_orgs', 
>>>> readable=False, writable=False))
>>>>
>>>>
>>>> #controller:
>>>> def org_form_load():
>>>> org_code_name = db(db.t_orgs.f_org_code == 
>>>> request.args(0)).select(db.t_orgs.ALL)
>>>> if org_code_name:
>>>> db.t_org_members.f_org_rep.default = org_code_name[0].id
>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>> label_org_name = 'Join ' + org_code_name[0].f_org_name + ' 
>>>> Organization'
>>>> form = SQLFORM(db.t_org_members, onupdate=auth.archive, 
>>>> submit_button= label_org_name)
>>>> if form.process().accepted:
>>>> session.flash = 'Welcome to \'' + 
>>>> org_code_name[0].f_org_name + '\' Organization!'
>>>> redirect(URL('default', 'api_key.html'), client_side=True)
>>>> elif form.errors:
>>>> response.flash = 'response errors'
>>>> return dict(form=form, org_code_name=org_code_name)
>>>>
>>>> else:
>>>> return 'searching.'
>>>>
>>>> #view
>>>> 
>>>> Type your organization code:
>>>>
>>>> {{else:}}
>>>>  Organization api:
>>>> {{=my_org_data[0].t_orgs.org_api_key}}
>>>> {{pass}}
>>>> 
>>>>
>>>>
>>>>
>>>> 
>>>>
>>>> function org_code_value(org_code)
>>>> {
>>>>
>>>> var url ="{{=URL('default', 'org_form_load.load')}}";
>>>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>>>> }
>>>> 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote:
>>>>>
>>>>> What do you mean the form won't be accepted? Is it failing validation 
>>>>> on the server when form.process() is called? Do you have an IS_STRONG 
>>>>> validator defined? What is happening with the Ajax call in the browser? 
>>>>> Please show some more code an explain exactly what is happening.
>>>>>
>>>>> On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote:
>>>>>>
>>>>>> Hi,
>>>>>> I created a table with a password field.
>>>>>> I got an ajax (web2py component)  form where a user fill the 
>>>>>> password, and if it's OK, it does something.
>>>>>> It works fine, but the problem is that if I use for example "!" in 
>>>>>> the password field , the form won't be accepted.
>>>>>> Is there a solution for that? I would like to allow any char that 
>>>>>> won't break the javascript.
>>>>>>
>>>>>> db.define_table('t_orgs',
>>>>>> Field('f_org_name', type='string',
>>>>>>   label=T('Organization Name')),
>>>>>> Field('f_org_code', type='password',
>>>>>> ...
>>>>>>
>>>>>> Type your organization code:
>>>>>>
>>>>>>
>>>>>>
>>>>>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>>>>>>
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>

-- 
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.


[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
"ReferenceError: encodedURIComponent is not defined"

How do I define it? Do I have to import something?
Thanks.




On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote:
>
> great, thanks .
>
> On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote:
>>
>> and what you expected ? :-P
>> you built your function to post to an url like 
>>
>> /base_url/
>> whatever_is_inserted_in_the_form_without_encoding_or_sanitization
>>
>> Not every url is a valid one (try opening /base_url/ì^'0=")and its 
>> generally NOT safe doing what you're doing. 
>> User input in web applications needs to be either validated before or 
>> properly escaped.usually you'd want base_url?something=escaped_value
>> that you can retrieve later with response.vars.something
>>
>>
>> On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote:
>>>
>>> All I see is:invalid request
>>> rendered on the #org_form_target
>>> #model
>>> db.define_table('t_orgs',
>>> Field('f_org_name', type='string',
>>>   label=T('Organization Name')),
>>> Field('f_org_code', type='password',
>>>   label=T('Organization pasword')),
>>> Field('org_api_key', length=64, type='string', default=uuid.uuid4(), 
>>> writable=False),
>>> auth.signature,
>>> format='%(f_org_name)s',
>>> migrate=settings.migrate)
>>>
>>> db.define_table('t_orgs_archive', db.t_orgs,
>>> Field('current_record', 'reference t_orgs', 
>>> readable=False, writable=False))
>>>
>>>
>>> #controller:
>>> def org_form_load():
>>> org_code_name = db(db.t_orgs.f_org_code == 
>>> request.args(0)).select(db.t_orgs.ALL)
>>> if org_code_name:
>>> db.t_org_members.f_org_rep.default = org_code_name[0].id
>>> db.t_org_members.f_org_member.default = auth.user.id
>>> label_org_name = 'Join ' + org_code_name[0].f_org_name + ' 
>>> Organization'
>>> form = SQLFORM(db.t_org_members, onupdate=auth.archive, 
>>> submit_button= label_org_name)
>>> if form.process().accepted:
>>> session.flash = 'Welcome to \'' + 
>>> org_code_name[0].f_org_name + '\' Organization!'
>>> redirect(URL('default', 'api_key.html'), client_side=True)
>>> elif form.errors:
>>> response.flash = 'response errors'
>>> return dict(form=form, org_code_name=org_code_name)
>>>
>>> else:
>>> return 'searching.'
>>>
>>> #view
>>> 
>>> Type your organization code:
>>>
>>> {{else:}}
>>>  Organization api:
>>> {{=my_org_data[0].t_orgs.org_api_key}}
>>> {{pass}}
>>> 
>>>
>>>
>>>
>>> 
>>>
>>> function org_code_value(org_code)
>>> {
>>>
>>> var url ="{{=URL('default', 'org_form_load.load')}}";
>>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>>> }
>>> 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote:
>>>>
>>>> What do you mean the form won't be accepted? Is it failing validation 
>>>> on the server when form.process() is called? Do you have an IS_STRONG 
>>>> validator defined? What is happening with the Ajax call in the browser? 
>>>> Please show some more code an explain exactly what is happening.
>>>>
>>>> On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote:
>>>>>
>>>>> Hi,
>>>>> I created a table with a password field.
>>>>> I got an ajax (web2py component)  form where a user fill the password, 
>>>>> and if it's OK, it does something.
>>>>> It works fine, but the problem is that if I use for example "!" in 
>>>>> the password field , the form won't be accepted.
>>>>> Is there a solution for that? I would like to allow any char that 
>>>>> won't break the javascript.
>>>>>
>>>>> db.define_table('t_orgs',
>>>>> Field('f_org_name', type='string',
>>>>>   label=T('Organization Name')),
>>>>> Field('f_org_code', type='password',
>>>>> ...
>>>>>
>>>>> Type your organization code:
>>>>>
>>>>>
>>>>>
>>>>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>

-- 
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.


[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
great, thanks .

On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote:
>
> and what you expected ? :-P
> you built your function to post to an url like 
>
> /base_url/
> whatever_is_inserted_in_the_form_without_encoding_or_sanitization
>
> Not every url is a valid one (try opening /base_url/ì^'0=")and its 
> generally NOT safe doing what you're doing. 
> User input in web applications needs to be either validated before or 
> properly escaped.usually you'd want base_url?something=escaped_value
> that you can retrieve later with response.vars.something
>
>
> On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote:
>>
>> All I see is:invalid request
>> rendered on the #org_form_target
>> #model
>> db.define_table('t_orgs',
>> Field('f_org_name', type='string',
>>   label=T('Organization Name')),
>> Field('f_org_code', type='password',
>>   label=T('Organization pasword')),
>> Field('org_api_key', length=64, type='string', default=uuid.uuid4(), 
>> writable=False),
>> auth.signature,
>> format='%(f_org_name)s',
>> migrate=settings.migrate)
>>
>> db.define_table('t_orgs_archive', db.t_orgs,
>> Field('current_record', 'reference t_orgs', 
>> readable=False, writable=False))
>>
>>
>> #controller:
>> def org_form_load():
>> org_code_name = db(db.t_orgs.f_org_code == 
>> request.args(0)).select(db.t_orgs.ALL)
>> if org_code_name:
>> db.t_org_members.f_org_rep.default = org_code_name[0].id
>> db.t_org_members.f_org_member.default = auth.user.id
>> label_org_name = 'Join ' + org_code_name[0].f_org_name + ' 
>> Organization'
>> form = SQLFORM(db.t_org_members, onupdate=auth.archive, 
>> submit_button= label_org_name)
>> if form.process().accepted:
>> session.flash = 'Welcome to \'' + org_code_name[0].f_org_name 
>> + '\' Organization!'
>> redirect(URL('default', 'api_key.html'), client_side=True)
>> elif form.errors:
>> response.flash = 'response errors'
>> return dict(form=form, org_code_name=org_code_name)
>>
>> else:
>> return 'searching.'
>>
>> #view
>> 
>> Type your organization code:
>>
>> {{else:}}
>>  Organization api:
>> {{=my_org_data[0].t_orgs.org_api_key}}
>> {{pass}}
>> 
>>
>>
>>
>> 
>>
>> function org_code_value(org_code)
>> {
>>
>> var url ="{{=URL('default', 'org_form_load.load')}}";
>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>> }
>> 
>>
>>
>>
>>
>>
>>
>>
>> On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote:
>>>
>>> What do you mean the form won't be accepted? Is it failing validation on 
>>> the server when form.process() is called? Do you have an IS_STRONG 
>>> validator defined? What is happening with the Ajax call in the browser? 
>>> Please show some more code an explain exactly what is happening.
>>>
>>> On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote:
>>>>
>>>> Hi,
>>>> I created a table with a password field.
>>>> I got an ajax (web2py component)  form where a user fill the password, 
>>>> and if it's OK, it does something.
>>>> It works fine, but the problem is that if I use for example "!" in the 
>>>> password field , the form won't be accepted.
>>>> Is there a solution for that? I would like to allow any char that won't 
>>>> break the javascript.
>>>>
>>>> db.define_table('t_orgs',
>>>> Field('f_org_name', type='string',
>>>>   label=T('Organization Name')),
>>>> Field('f_org_code', type='password',
>>>> ...
>>>>
>>>> Type your organization code:
>>>>
>>>>
>>>>
>>>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>>>>
>>>>
>>>> Thanks.
>>>>
>>>

-- 
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.


[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
All I see is:invalid request
rendered on the #org_form_target
#model
db.define_table('t_orgs',
Field('f_org_name', type='string',
  label=T('Organization Name')),
Field('f_org_code', type='password',
  label=T('Organization pasword')),
Field('org_api_key', length=64, type='string', default=uuid.uuid4(), 
writable=False),
auth.signature,
format='%(f_org_name)s',
migrate=settings.migrate)

db.define_table('t_orgs_archive', db.t_orgs,
Field('current_record', 'reference t_orgs', readable=False, 
writable=False))


#controller:
def org_form_load():
org_code_name = db(db.t_orgs.f_org_code == 
request.args(0)).select(db.t_orgs.ALL)
if org_code_name:
db.t_org_members.f_org_rep.default = org_code_name[0].id
db.t_org_members.f_org_member.default = auth.user.id
label_org_name = 'Join ' + org_code_name[0].f_org_name + ' 
Organization'
form = SQLFORM(db.t_org_members, onupdate=auth.archive, 
submit_button= label_org_name)
if form.process().accepted:
session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + 
'\' Organization!'
redirect(URL('default', 'api_key.html'), client_side=True)
elif form.errors:
response.flash = 'response errors'
return dict(form=form, org_code_name=org_code_name)

else:
return 'searching.'

#view

Type your organization code:
   
{{else:}}
 Organization api:
{{=my_org_data[0].t_orgs.org_api_key}}
{{pass}}






function org_code_value(org_code)
{

var url ="{{=URL('default', 'org_form_load.load')}}";
$.web2py.component(url + '/' + org_code, 'org_form_target');
}








On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote:
>
> What do you mean the form won't be accepted? Is it failing validation on 
> the server when form.process() is called? Do you have an IS_STRONG 
> validator defined? What is happening with the Ajax call in the browser? 
> Please show some more code an explain exactly what is happening.
>
> On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote:
>>
>> Hi,
>> I created a table with a password field.
>> I got an ajax (web2py component)  form where a user fill the password, 
>> and if it's OK, it does something.
>> It works fine, but the problem is that if I use for example "!" in the 
>> password field , the form won't be accepted.
>> Is there a solution for that? I would like to allow any char that won't 
>> break the javascript.
>>
>> db.define_table('t_orgs',
>> Field('f_org_name', type='string',
>>   label=T('Organization Name')),
>> Field('f_org_code', type='password',
>> ...
>>
>> Type your organization code:
>>
>>
>>
>> $.web2py.component(url + '/' + org_code, 'org_form_target');
>>
>>
>> Thanks.
>>
>

-- 
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.


[web2py] Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
Hi,
I created a table with a password field.
I got an ajax (web2py component)  form where a user fill the password, and 
if it's OK, it does something.
It works fine, but the problem is that if I use for example "!" in the 
password field , the form won't be accepted.
Is there a solution for that? I would like to allow any char that won't 
break the javascript.

db.define_table('t_orgs',
Field('f_org_name', type='string',
  label=T('Organization Name')),
Field('f_org_code', type='password',
...

Type your organization code:
   


$.web2py.component(url + '/' + org_code, 'org_form_target');


Thanks.

-- 
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.


[web2py] Re: Show items i created only on form reference fields.

2014-02-08 Thread Avi A
great thanks.

On Sunday, February 9, 2014 3:47:44 AM UTC+2, Anthony wrote:
>
> Assuming different users are adding "projects" to the "t_projects" table 
>> which is a referenced field in "t_tests" table as below:
>> db.define_table('t_tests',
>> Field('f_test_name', type='string',
>>   label=T('Test Name')),
>> Field('f_test_project', type='reference t_projects',
>>..
>>
>> On the SQLFORM of "t_tests", the drop down menu will display all 
>> projects added by all users.
>> Is there a way to filter the list to display my projects only?
>>
>
> Field('f_test_project', type='reference t_projects',
>   requires=IS_IN_DB(db([query goes here]), 't_projects.id', db.
> t_projects._format))
>
> You'll have to specify a query to limit the projects to a particular user 
> (presumably there is an auth_user reference field in t_projects. Also, note 
> that by explicitly specifying a "requires" argument for the reference 
> field, you will no longer get a default "represent" attribute, so you'll 
> need to specify that explicitly as well.
>
> Anthony
>

-- 
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.


[web2py] Show items i created only on form reference fields.

2014-02-08 Thread Avi A
Hi,
Assuming different users are adding "projects" to the "t_projects" table 
which is a referenced field in "t_tests" table as below:
db.define_table('t_tests',
Field('f_test_name', type='string',
  label=T('Test Name')),
Field('f_test_project', type='reference t_projects',
   ..

On the SQLFORM of "t_tests", the drop down menu will display all projects 
added by all users.
Is there a way to filter the list to display my projects only?
Thanks.

-- 
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.


[web2py] Re: Trying to build a post api.

2014-02-03 Thread Avi A
Alright, it's awesomely works now. :)
(just fyi the r.content returns this and not the id of newly created 
record.:)
>>> r.content
'errorsid'

Thanks again .

On Monday, February 3, 2014 2:31:00 AM UTC+2, Anthony wrote:
>
> As I recall, you have more than one reference field, but looks like you 
> are only converting one of them. You'll need to do some debugging to figure 
> out exactly which field or fields are generating errors, and then make the 
> appropriate corrections.
>
> On Sunday, February 2, 2014 4:21:37 PM UTC-5, Avi A wrote:
>>
>> getting this error: 
>>
>> ValueError: invalid literal for long() with base 10: 'ergergrg'
>>
>>
>> t = db.t_tests_results
>> def POST(**post_params):
>> if db(db.auth_user.api_key == post_params['api_key']).count():
>> #post_params['f_test'] = db(db.t_tests.f_test_name ==
>>  #  post_params['f_test']).select(
>> db.t_tests.id).first().id
>> #post_params['f_project'] = db(db.t_projects.f_project_name ==
>>  #  post_params['f_project']).select(
>> db.t_projects.id).first().id
>> post_params['f_platform'] = db(db.t_types.f_platform_name ==
>> post_params['f_platform']).select(
>> db.t_types.id).first().id
>> #post_params['f_device'] = db(db.t_devices.f_device_name ==
>>  #  post_params['f_device']).select(
>> db.t_devices.id).first().id
>>
>> return t.validate_and_insert(**t._filter_fields(post_params))
>> else:
>> raise HTTP(400)
>> return locals()
>>
>>
>> On Saturday, February 1, 2014 11:24:02 PM UTC+2, Avi A wrote:
>>>
>>> Yes, that's what I want.
>>> I'll give it a try , thanks.
>>>
>>> On Saturday, February 1, 2014 10:30:28 PM UTC+2, Anthony wrote:
>>>>
>>>> Without the ability to post data to reference fields it's a problem to 
>>>>> achieve it. just posting the reference data as strings won't allow me to 
>>>>> make these filters, unless I will insert them into tables after posting 
>>>>> to 
>>>>> the tests results table. (I think).
>>>>>
>>>>
>>>> Keep in mind, a reference field references an entire record in another 
>>>> table, not just a particular string field in that table. In general, the 
>>>> referenced table may not even include a string field that contains unique 
>>>> values, so you couldn't reference a particular record simply by specifying 
>>>> a single string.
>>>>
>>>> I'm not sure I completely follow your data model, but for example, is 
>>>> the f_platform field a reference to the db.t_types table (which itself 
>>>> contains an f_platform_name field)? Is it the case that you want users to 
>>>> be able to specify an f_platform_name string and have that converted to 
>>>> the 
>>>> appropriate record ID of the t_types table so the ID can be stored in the 
>>>> f_platform field? If so, you just need to write the code to do that:
>>>>
>>>> post_params['f_platform'] = db(db.t_types.f_platform_name ==
>>>>post_params['f_platform']).select(db.
>>>> t_types.id).first().id
>>>>
>>>> That will use the string value of f_platform to look up the record ID 
>>>> in db.t_types, and then change post_params['f_platform'] to that record 
>>>> ID. 
>>>> You could do something similar for any other fields that need to be looked 
>>>> up/converted.
>>>>
>>>> Anthony
>>>>
>>>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-02-02 Thread Avi A
Thanks,
Anthony already helped me we that, this first thread jumped by mistake.
But there was a problem with posting into reference fields, so Anthony 
suggested that I will do something like that , but I am getting the same 
"long" error:

ValueError: invalid literal for long() with base 10: 'ergergrg'

and this is the controller:

def POST(**post_params):
if db(db.auth_user.api_key == post_params['api_key']).count():
#post_params['f_test'] = db(db.t_tests.f_test_name ==
 # 
 post_params['f_test']).select(db.t_tests.id).first().id
#post_params['f_project'] = db(db.t_projects.f_project_name ==
 # 
 post_params['f_project']).select(db.t_projects.id).first().id
post_params['f_platform'] = db(db.t_types.f_platform_name ==

post_params['f_platform']).select(db.t_types.id).first().id
#post_params['f_device'] = db(db.t_devices.f_device_name ==
 # 
 post_params['f_device']).select(db.t_devices.id).first().id

return t.validate_and_insert(**t._filter_fields(post_params))
else:
raise HTTP(400)
return locals()

Apologize for the confusion I made.
Thanks.





On Thursday, January 30, 2014 12:30:52 PM UTC+2, Avi A wrote:
>
> Hi,
> I am trying something like that:
> #on one local script instance:
> import requests
>
> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
> 'platform', 'f_device': 'device', 'f_steps': '10',
>'f_matches':'7', 'f_missmatches': '3', 'f_missing': '0'}
> r = requests.post('http://127.0.0.1:8000/qatests/api', params=test_params)
>
> #and the api function:
>
> @request.restful()
> def api():
> response.view = 'generic.'+request.extension
> def GET(search):
> pass
> clients = db(db.auth_user).select(db.auth_user.api_key)
> t = db.t_tests_results
> def POST(**post_params):
> for client in clients:
> if client.api_key == post_params.api_key:
> return t.validate_and_insert(post_params.test,
> post_params.f_platform, 
> post_params.f_device,
> post_params.f_steps, 
> post_params.f_matches,
> post_params.f_missmatches, 
> post_params.f_missing)
> else:
> raise HTTP(400)
>
> It's not working... Any help?
> Thanks.
>
>
>
>
>
>
>
>
>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-02-02 Thread Avi A


getting this error: 

ValueError: invalid literal for long() with base 10: 'ergergrg'


t = db.t_tests_results
def POST(**post_params):
if db(db.auth_user.api_key == post_params['api_key']).count():
#post_params['f_test'] = db(db.t_tests.f_test_name ==
 # 
 post_params['f_test']).select(db.t_tests.id).first().id
#post_params['f_project'] = db(db.t_projects.f_project_name ==
 # 
 post_params['f_project']).select(db.t_projects.id).first().id
post_params['f_platform'] = db(db.t_types.f_platform_name ==

post_params['f_platform']).select(db.t_types.id).first().id
#post_params['f_device'] = db(db.t_devices.f_device_name ==
 # 
 post_params['f_device']).select(db.t_devices.id).first().id

return t.validate_and_insert(**t._filter_fields(post_params))
else:
    raise HTTP(400)
return locals()


On Saturday, February 1, 2014 11:24:02 PM UTC+2, Avi A wrote:
>
> Yes, that's what I want.
> I'll give it a try , thanks.
>
> On Saturday, February 1, 2014 10:30:28 PM UTC+2, Anthony wrote:
>>
>> Without the ability to post data to reference fields it's a problem to 
>>> achieve it. just posting the reference data as strings won't allow me to 
>>> make these filters, unless I will insert them into tables after posting to 
>>> the tests results table. (I think).
>>>
>>
>> Keep in mind, a reference field references an entire record in another 
>> table, not just a particular string field in that table. In general, the 
>> referenced table may not even include a string field that contains unique 
>> values, so you couldn't reference a particular record simply by specifying 
>> a single string.
>>
>> I'm not sure I completely follow your data model, but for example, is the 
>> f_platform field a reference to the db.t_types table (which itself contains 
>> an f_platform_name field)? Is it the case that you want users to be able to 
>> specify an f_platform_name string and have that converted to the 
>> appropriate record ID of the t_types table so the ID can be stored in the 
>> f_platform field? If so, you just need to write the code to do that:
>>
>> post_params['f_platform'] = db(db.t_types.f_platform_name ==
>>post_params['f_platform']).select(db.
>> t_types.id).first().id
>>
>> That will use the string value of f_platform to look up the record ID in 
>> db.t_types, and then change post_params['f_platform'] to that record ID. 
>> You could do something similar for any other fields that need to be looked 
>> up/converted.
>>
>> Anthony
>>
>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-02-01 Thread Avi A
Yes, that's what I want.
I'll give it a try , thanks.

On Saturday, February 1, 2014 10:30:28 PM UTC+2, Anthony wrote:
>
> Without the ability to post data to reference fields it's a problem to 
>> achieve it. just posting the reference data as strings won't allow me to 
>> make these filters, unless I will insert them into tables after posting to 
>> the tests results table. (I think).
>>
>
> Keep in mind, a reference field references an entire record in another 
> table, not just a particular string field in that table. In general, the 
> referenced table may not even include a string field that contains unique 
> values, so you couldn't reference a particular record simply by specifying 
> a single string.
>
> I'm not sure I completely follow your data model, but for example, is the 
> f_platform field a reference to the db.t_types table (which itself contains 
> an f_platform_name field)? Is it the case that you want users to be able to 
> specify an f_platform_name string and have that converted to the 
> appropriate record ID of the t_types table so the ID can be stored in the 
> f_platform field? If so, you just need to write the code to do that:
>
> post_params['f_platform'] = db(db.t_types.f_platform_name ==
>post_params['f_platform']).select(db.
> t_types.id).first().id
>
> That will use the string value of f_platform to look up the record ID in 
> db.t_types, and then change post_params['f_platform'] to that record ID. 
> You could do something similar for any other fields that need to be looked 
> up/converted.
>
> Anthony
>
>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-02-01 Thread Avi A


On Thursday, January 30, 2014 12:30:52 PM UTC+2, Avi A wrote:
>
> Hi,
> I am trying something like that:
> #on one local script instance:
> import requests
>
> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
> 'platform', 'f_device': 'device', 'f_steps': '10',
>'f_matches':'7', 'f_missmatches': '3', 'f_missing': '0'}
> r = requests.post('http://127.0.0.1:8000/qatests/api', params=test_params)
>
> #and the api function:
>
> @request.restful()
> def api():
> response.view = 'generic.'+request.extension
> def GET(search):
> pass
> clients = db(db.auth_user).select(db.auth_user.api_key)
> t = db.t_tests_results
> def POST(**post_params):
> for client in clients:
> if client.api_key == post_params.api_key:
> return t.validate_and_insert(post_params.test,
> post_params.f_platform, 
> post_params.f_device,
> post_params.f_steps, 
> post_params.f_matches,
> post_params.f_missmatches, 
> post_params.f_missing)
> else:
> raise HTTP(400)
>
> It's not working... Any help?
> Thanks.
>
>
>
>
>
>
>
>
>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-02-01 Thread Avi A
I agree.
This is the app flow:
A user defines on the site a generic data he will use in the tests. Each 
data is in a separate table, and then on the test he can combine different 
combinations:
-test name.
combinations:
- project: (tablet pdf reader, on line editor, etc")
-platform: (android, ios, browser, desktop, etc).
- device: (nexus, ipad x, toshiba, etc".)
-test number of steps.
-test number passed.
-test number failed.
So the table where posting to is the 
-tests_results:
-project reference
-platform reference
-device reference
passed integer
failed integer.

Then I was able to display graphs for tests results with the ability to 
filter by test name, project, platform, or device.

Without the ability to post data to reference fields it's a problem to 
achieve it. 







If I was able to post to reference fields, I was able to achive it.









On Saturday, February 1, 2014 5:27:22 PM UTC+2, Anthony wrote:
>
> Not sure that's the right approach. A reference field is not a string, it 
> is an integer storing the id of the record in another table. It does not 
> refer to a string value in another table but rather to an entire record in 
> another table. If you API receives some parameters that are not fields in 
> the table getting the insert, then you can't just directly insert the 
> parameters in the table. Rather, you'll need to use the parameters to fetch 
> the values you need to insert and then do the insert. It's hard to say how 
> it should look without knowing your data model and what you're trying to 
> achieve with the API.
>
> Anthony
>
> On Saturday, February 1, 2014 9:16:09 AM UTC-5, Avi A wrote:
>>
>> Alright,
>> I turned those fields to be strings, also had to modify the DAL and added 
>> (no idea why): ", adapter_args=dict(foreign_keys=False),
>> And now it's working.
>> Thanks a lot of the support, the teaching and the patient.
>>
>>
>> On Saturday, February 1, 2014 11:19:36 AM UTC+2, Avi A wrote:
>>>
>>> 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:
>>>>>>>>

[web2py] Re: Trying to build a post api.

2014-02-01 Thread Avi A
Alright,
I turned those fields to be strings, also had to modify the DAL and added 
(no idea why): ", adapter_args=dict(foreign_keys=False),
And now it's working.
Thanks a lot of the support, the teaching and the patient.


On Saturday, February 1, 2014 11:19:36 AM UTC+2, Avi A wrote:
>
> 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)
>>>>>>>
>>

[web2py] Re: Trying to build a post api.

2014-02-01 Thread Avi A
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.


[web2py] Re: Trying to build a post api.

2014-01-31 Thread Avi A
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.


[web2py] Re: Trying to build a post api.

2014-01-31 Thread Avi A


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.


[web2py] Re: Trying to build a post api.

2014-01-31 Thread Avi A


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.


[web2py] Re: Trying to build a post api.

2014-01-31 Thread Avi A
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.


[web2py] Re: Trying to build a post api.

2014-01-31 Thread Avi A


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.


[web2py] Re: join after filtering first table

2014-01-31 Thread Avi A
It's OK thanks.

On Friday, January 31, 2014 7:57:45 PM UTC+2, Massimo Di Pierro wrote:
>
> Please show the model and explain in english what you want to do.
>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
Still nothing: (with or without /default/)

Python 2.7.3 (default, Sep 26 2013, 20:03:06) 
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import requests
>>> 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'}

>>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
params=test_params)
>>> r = requests.post('http://127.0.0.1:8000/qatests/default/api', 
params=test_params)
>>> 

On Friday, January 31, 2014 2:27:47 AM UTC+2, Anthony wrote:
>
> No, just run this code from a Python shell:
>
> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
> 'platform', 'f_device': 'device', 'f_steps': '10', 'f_matches':'7', 
> 'f_missmatches': '3', 'f_missing': '0'}
> r = requests.post('http://127.0.0.1:8000/qatests/api', params=test_params)
>
> and check the value of r.content.
>
> On Thursday, January 30, 2014 4:47:20 PM UTC-5, Avi A wrote:
>>
>> Nothing is returned:
>> avi@avi-S500CA:~/applitools$ python test_json.py
>> avi@avi-S500CA:~/applitools$ 
>>
>> On Thursday, January 30, 2014 11:42:24 PM UTC+2, Anthony wrote:
>>>
>>> Just run your request code from a Python shell and check the value of 
>>> r.content.
>>>
>>> Anthony
>>>
>>> On Thursday, January 30, 2014 4:22:29 PM UTC-5, Avi A wrote:
>>>>
>>>> All I get in the client is:
>>>> Process finished with exit code 0
>>>>
>>>> On Thursday, January 30, 2014 11:20:11 PM UTC+2, Anthony wrote:
>>>>>
>>>>> .validate_and_insert returns a response object with an .id attribute 
>>>>> and an .errors attribute. If the insert is successful, response.idhas the 
>>>>> id of the inserted records, and if there are any validation errors, 
>>>>> response.errors is a dictionary of field names and error messages. You 
>>>>> can 
>>>>> have your function conditionally return the new record ID (or some 
>>>>> success 
>>>>> message) or a string summary of the errors. Then just check the content 
>>>>> of 
>>>>> that return value from the client where you are making the API requests.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Thursday, January 30, 2014 2:29:02 PM UTC-5, Avi A wrote:
>>>>>>
>>>>>> what do you mean? How can I check it?
>>>>>>
>>>>>>
>>>>>> On Thursday, January 30, 2014 8:39:56 PM UTC+2, Anthony wrote:
>>>>>>>
>>>>>>> What does .validate_and_insert return?
>>>>>>>
>>>>>>> On Thursday, January 30, 2014 1:11:18 PM UTC-5, Avi A wrote:
>>>>>>>>
>>>>>>>> Thank you very much.
>>>>>>>> No errors now, but still not inserting. I'll give it some more 
>>>>>>>> tries and get back if required.
>>>>>>>> thanks again. 
>>>>>>>>
>>>>>>>> On Thursday, January 30, 2014 7:59:23 PM UTC+2, Anthony wrote:
>>>>>>>>>
>>>>>>>>> Your api() function should end with:
>>>>>>>>>
>>>>>>>>> return locals()
>>>>>>>>>
>>>>>>>>> locals() is a dictionary containing all the variables (including 
>>>>>>>>> the functions) defined in the local function scope.
>>>>>>>>>
>>>>>>>>> Note, this is why it helps to describe the exact error/failure. 
>>>>>>>>> Initially I hadn't noticed the missing locals() return, but seeing 
>>>>>>>>> the 
>>>>>>>>> exception made it obvious.
>>>>>>>>>
>>>>>>>>> Anthony
>>>>&

[web2py] join after filtering first table

2014-01-30 Thread Avi A
Is that the way to do it?:
filtered_t_a= db.t_a.created_by == auth.user.id
rows = db(filtered_t_a.id== db.t_b.id).select()

for r in rows:
print row.filtered_t_a.name, 'has', row.t_b.description

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
Nothing is returned:
avi@avi-S500CA:~/applitools$ python test_json.py
avi@avi-S500CA:~/applitools$ 

On Thursday, January 30, 2014 11:42:24 PM UTC+2, Anthony wrote:
>
> Just run your request code from a Python shell and check the value of 
> r.content.
>
> Anthony
>
> On Thursday, January 30, 2014 4:22:29 PM UTC-5, Avi A wrote:
>>
>> All I get in the client is:
>> Process finished with exit code 0
>>
>> On Thursday, January 30, 2014 11:20:11 PM UTC+2, Anthony wrote:
>>>
>>> .validate_and_insert returns a response object with an .id attribute and 
>>> an .errors attribute. If the insert is successful, response.id has the 
>>> id of the inserted records, and if there are any validation errors, 
>>> response.errors is a dictionary of field names and error messages. You can 
>>> have your function conditionally return the new record ID (or some success 
>>> message) or a string summary of the errors. Then just check the content of 
>>> that return value from the client where you are making the API requests.
>>>
>>> Anthony
>>>
>>> On Thursday, January 30, 2014 2:29:02 PM UTC-5, Avi A wrote:
>>>>
>>>> what do you mean? How can I check it?
>>>>
>>>>
>>>> On Thursday, January 30, 2014 8:39:56 PM UTC+2, Anthony wrote:
>>>>>
>>>>> What does .validate_and_insert return?
>>>>>
>>>>> On Thursday, January 30, 2014 1:11:18 PM UTC-5, Avi A wrote:
>>>>>>
>>>>>> Thank you very much.
>>>>>> No errors now, but still not inserting. I'll give it some more tries 
>>>>>> and get back if required.
>>>>>> thanks again. 
>>>>>>
>>>>>> On Thursday, January 30, 2014 7:59:23 PM UTC+2, Anthony wrote:
>>>>>>>
>>>>>>> Your api() function should end with:
>>>>>>>
>>>>>>> return locals()
>>>>>>>
>>>>>>> locals() is a dictionary containing all the variables (including the 
>>>>>>> functions) defined in the local function scope.
>>>>>>>
>>>>>>> Note, this is why it helps to describe the exact error/failure. 
>>>>>>> Initially I hadn't noticed the missing locals() return, but seeing the 
>>>>>>> exception made it obvious.
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>> On Thursday, January 30, 2014 5:30:52 AM UTC-5, Avi A wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I am trying something like that:
>>>>>>>> #on one local script instance:
>>>>>>>> import requests
>>>>>>>>
>>>>>>>> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
>>>>>>>> 'platform', 'f_device': 'device', 'f_steps': '10',
>>>>>>>>'f_matches':'7', 'f_missmatches': '3', 'f_missing': 
>>>>>>>> '0'}
>>>>>>>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
>>>>>>>> params=test_params)
>>>>>>>>
>>>>>>>> #and the api function:
>>>>>>>>
>>>>>>>> @request.restful()
>>>>>>>> def api():
>>>>>>>> response.view = 'generic.'+request.extension
>>>>>>>> def GET(search):
>>>>>>>> pass
>>>>>>>> clients = db(db.auth_user).select(db.auth_user.api_key)
>>>>>>>> t = db.t_tests_results
>>>>>>>> def POST(**post_params):
>>>>>>>> for client in clients:
>>>>>>>> if client.api_key == post_params.api_key:
>>>>>>>> return t.validate_and_insert(post_params.test,
>>>>>>>> post_params.f_platform, 
>>>>>>>> post_params.f_device,
>>>>>>>> post_params.f_steps, 
>>>>>>>> post_params.f_matches,
>>>>>>>> post_params.f_missmatches, 
>>>>>>>> post_params.f_missing)
>>>>>>>> else:
>>>>>>>> raise HTTP(400)
>>>>>>>>
>>>>>>>> It's not working... Any help?
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
All I get in the client is:
Process finished with exit code 0

On Thursday, January 30, 2014 11:20:11 PM UTC+2, Anthony wrote:
>
> .validate_and_insert returns a response object with an .id attribute and 
> an .errors attribute. If the insert is successful, response.id has the id 
> of the inserted records, and if there are any validation errors, 
> response.errors is a dictionary of field names and error messages. You can 
> have your function conditionally return the new record ID (or some success 
> message) or a string summary of the errors. Then just check the content of 
> that return value from the client where you are making the API requests.
>
> Anthony
>
> On Thursday, January 30, 2014 2:29:02 PM UTC-5, Avi A wrote:
>>
>> what do you mean? How can I check it?
>>
>>
>> On Thursday, January 30, 2014 8:39:56 PM UTC+2, Anthony wrote:
>>>
>>> What does .validate_and_insert return?
>>>
>>> On Thursday, January 30, 2014 1:11:18 PM UTC-5, Avi A wrote:
>>>>
>>>> Thank you very much.
>>>> No errors now, but still not inserting. I'll give it some more tries 
>>>> and get back if required.
>>>> thanks again. 
>>>>
>>>> On Thursday, January 30, 2014 7:59:23 PM UTC+2, Anthony wrote:
>>>>>
>>>>> Your api() function should end with:
>>>>>
>>>>> return locals()
>>>>>
>>>>> locals() is a dictionary containing all the variables (including the 
>>>>> functions) defined in the local function scope.
>>>>>
>>>>> Note, this is why it helps to describe the exact error/failure. 
>>>>> Initially I hadn't noticed the missing locals() return, but seeing the 
>>>>> exception made it obvious.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Thursday, January 30, 2014 5:30:52 AM UTC-5, Avi A wrote:
>>>>>>
>>>>>> Hi,
>>>>>> I am trying something like that:
>>>>>> #on one local script instance:
>>>>>> import requests
>>>>>>
>>>>>> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
>>>>>> 'platform', 'f_device': 'device', 'f_steps': '10',
>>>>>>'f_matches':'7', 'f_missmatches': '3', 'f_missing': 
>>>>>> '0'}
>>>>>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
>>>>>> params=test_params)
>>>>>>
>>>>>> #and the api function:
>>>>>>
>>>>>> @request.restful()
>>>>>> def api():
>>>>>> response.view = 'generic.'+request.extension
>>>>>> def GET(search):
>>>>>> pass
>>>>>> clients = db(db.auth_user).select(db.auth_user.api_key)
>>>>>> t = db.t_tests_results
>>>>>> def POST(**post_params):
>>>>>> for client in clients:
>>>>>> if client.api_key == post_params.api_key:
>>>>>> return t.validate_and_insert(post_params.test,
>>>>>> post_params.f_platform, 
>>>>>> post_params.f_device,
>>>>>> post_params.f_steps, 
>>>>>> post_params.f_matches,
>>>>>> post_params.f_missmatches, 
>>>>>> post_params.f_missing)
>>>>>> else:
>>>>>> raise HTTP(400)
>>>>>>
>>>>>> It's not working... Any help?
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
what do you mean? How can I check it?


On Thursday, January 30, 2014 8:39:56 PM UTC+2, Anthony wrote:
>
> What does .validate_and_insert return?
>
> On Thursday, January 30, 2014 1:11:18 PM UTC-5, Avi A wrote:
>>
>> Thank you very much.
>> No errors now, but still not inserting. I'll give it some more tries and 
>> get back if required.
>> thanks again. 
>>
>> On Thursday, January 30, 2014 7:59:23 PM UTC+2, Anthony wrote:
>>>
>>> Your api() function should end with:
>>>
>>> return locals()
>>>
>>> locals() is a dictionary containing all the variables (including the 
>>> functions) defined in the local function scope.
>>>
>>> Note, this is why it helps to describe the exact error/failure. 
>>> Initially I hadn't noticed the missing locals() return, but seeing the 
>>> exception made it obvious.
>>>
>>> Anthony
>>>
>>> On Thursday, January 30, 2014 5:30:52 AM UTC-5, Avi A wrote:
>>>>
>>>> Hi,
>>>> I am trying something like that:
>>>> #on one local script instance:
>>>> import requests
>>>>
>>>> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
>>>> 'platform', 'f_device': 'device', 'f_steps': '10',
>>>>'f_matches':'7', 'f_missmatches': '3', 'f_missing': '0'}
>>>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
>>>> params=test_params)
>>>>
>>>> #and the api function:
>>>>
>>>> @request.restful()
>>>> def api():
>>>> response.view = 'generic.'+request.extension
>>>> def GET(search):
>>>> pass
>>>> clients = db(db.auth_user).select(db.auth_user.api_key)
>>>> t = db.t_tests_results
>>>> def POST(**post_params):
>>>> for client in clients:
>>>> if client.api_key == post_params.api_key:
>>>> return t.validate_and_insert(post_params.test,
>>>> post_params.f_platform, 
>>>> post_params.f_device,
>>>> post_params.f_steps, 
>>>> post_params.f_matches,
>>>> post_params.f_missmatches, 
>>>> post_params.f_missing)
>>>> else:
>>>> raise HTTP(400)
>>>>
>>>> It's not working... Any help?
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
Thank you very much.
No errors now, but still not inserting. I'll give it some more tries and 
get back if required.
thanks again. 

On Thursday, January 30, 2014 7:59:23 PM UTC+2, Anthony wrote:
>
> Your api() function should end with:
>
> return locals()
>
> locals() is a dictionary containing all the variables (including the 
> functions) defined in the local function scope.
>
> Note, this is why it helps to describe the exact error/failure. Initially 
> I hadn't noticed the missing locals() return, but seeing the exception made 
> it obvious.
>
> Anthony
>
> On Thursday, January 30, 2014 5:30:52 AM UTC-5, Avi A wrote:
>>
>> Hi,
>> I am trying something like that:
>> #on one local script instance:
>> import requests
>>
>> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
>> 'platform', 'f_device': 'device', 'f_steps': '10',
>>'f_matches':'7', 'f_missmatches': '3', 'f_missing': '0'}
>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
>> params=test_params)
>>
>> #and the api function:
>>
>> @request.restful()
>> def api():
>> response.view = 'generic.'+request.extension
>> def GET(search):
>> pass
>> clients = db(db.auth_user).select(db.auth_user.api_key)
>> t = db.t_tests_results
>> def POST(**post_params):
>> for client in clients:
>> if client.api_key == post_params.api_key:
>> return t.validate_and_insert(post_params.test,
>> post_params.f_platform, 
>> post_params.f_device,
>> post_params.f_steps, 
>> post_params.f_matches,
>> post_params.f_missmatches, 
>> post_params.f_missing)
>> else:
>> raise HTTP(400)
>>
>> It's not working... Any help?
>> Thanks.
>>
>>
>>
>>
>>
>>
>>
>>
>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
Actually I do get an error:

   rest_action = _action().get(method, None)
AttributeError: 'NoneType' object has no attribute 'get'





On Thursday, January 30, 2014 7:28:23 PM UTC+2, Avi A wrote:
>
> Thanks for the explanation.
> It stiil doesn't add records to the table.
> Is there any where I can see the error? on the admin there are no errors, 
> and not on the console where i post.
> Thanks. 
>
> On Thursday, January 30, 2014 7:00:32 PM UTC+2, Anthony wrote:
>>
>> On Thursday, January 30, 2014 10:33:19 AM UTC-5, Avi A wrote:
>>>
>>> Sorry for the "not working", I thought my mistake would be obvious.
>>>
>>
>> Describing the specific failure often makes it easier to home in on the 
>> source of the problem.
>>  
>>
>>> First line: does it mean that this "if" statement knows to search the 
>>> auth.user records till it finds a match?
>>>
>>
>> Yes, it's simply a query to see if any auth_user records contain an 
>> api_key that matches the one submitted. You were doing this query in 
>> Python, when it is far more efficient to have the database do it for you 
>> (particularly if you create a database index on the api_key field).
>>  
>>
>>> and what is the .count() for?
>>>
>>
>> When doing the query, there is no need to return the matching records -- 
>> you just need to know whether any such records exist. So, it is more 
>> efficient just to get a count of the records (if the count is 0, there are 
>> no matching records).
>>  
>>
>>> Second line: 
>>> t._filter_fields(**post_params)
>>> Should work assuming the key on the url params matches exactly the field 
>>> name on the table?
>>>
>>
>> Yes, that assumes the URL parameters match the field names of the table. 
>> Note, ._filter_fields() simply removes any keys from the dictionary that 
>> don't match any of the field names in the table (in this case, it would 
>> remove the api_key key, since that's not part of the db table). You could 
>> also manually remove any extra fields from the dictionary. For example:
>>
>> if db(db.auth_user.api_key == post_params.pop('api_key')).count():
>> return t.validate_and_insert(**post_params)
>>
>> post_params.pop('api_key') extracts the api_key value from post_params 
>> and then removes that key/value from post_params, leaving only the keys 
>> associated with fields in the db table.
>>
>> Anthony
>>
>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
Thanks for the explanation.
It stiil doesn't add records to the table.
Is there any where I can see the error? on the admin there are no errors, 
and not on the console where i post.
Thanks. 

On Thursday, January 30, 2014 7:00:32 PM UTC+2, Anthony wrote:
>
> On Thursday, January 30, 2014 10:33:19 AM UTC-5, Avi A wrote:
>>
>> Sorry for the "not working", I thought my mistake would be obvious.
>>
>
> Describing the specific failure often makes it easier to home in on the 
> source of the problem.
>  
>
>> First line: does it mean that this "if" statement knows to search the 
>> auth.user records till it finds a match?
>>
>
> Yes, it's simply a query to see if any auth_user records contain an 
> api_key that matches the one submitted. You were doing this query in 
> Python, when it is far more efficient to have the database do it for you 
> (particularly if you create a database index on the api_key field).
>  
>
>> and what is the .count() for?
>>
>
> When doing the query, there is no need to return the matching records -- 
> you just need to know whether any such records exist. So, it is more 
> efficient just to get a count of the records (if the count is 0, there are 
> no matching records).
>  
>
>> Second line: 
>> t._filter_fields(**post_params)
>> Should work assuming the key on the url params matches exactly the field 
>> name on the table?
>>
>
> Yes, that assumes the URL parameters match the field names of the table. 
> Note, ._filter_fields() simply removes any keys from the dictionary that 
> don't match any of the field names in the table (in this case, it would 
> remove the api_key key, since that's not part of the db table). You could 
> also manually remove any extra fields from the dictionary. For example:
>
> if db(db.auth_user.api_key == post_params.pop('api_key')).count():
> return t.validate_and_insert(**post_params)
>
> post_params.pop('api_key') extracts the api_key value from post_params and 
> then removes that key/value from post_params, leaving only the keys 
> associated with fields in the db table.
>
> Anthony
>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
I understand the "if", only the .count() I don't understand.

On Thursday, January 30, 2014 5:33:19 PM UTC+2, Avi A wrote:
>
> Sorry for the "not working", I thought my mistake would be obvious. On the 
> console where i sent the post i got "Process finished with exit code 0" but 
> i could not see that anything was updated on the table.
> Regarding your answer,
> First line: does it mean that this "if" statement knows to search the 
> auth.user records till it finds a match? and what is the .count() for?
> Second line: 
> t._filter_fields(**post_params)
> Should work assuming the key on the url params matches exactly the field 
> name on the table?
>
> (I tried earlier with the insert something like that as well :
> return t.validate_and_insert( t.f_test= post_params.f_test, etc")
> as well but I thought it was wrong in that context. The example on the 
> book wasn't clear to me. (return db.person.validate_and_insert(**fields) )
> )
> Thanks. 
>
>
> On Thursday, January 30, 2014 4:49:42 PM UTC+2, Anthony wrote:
>>
>> Generally it's helpful if you can give more detail than just "not 
>> working". Anyway, note that an insert requires keywords and values, not 
>> just positional arguments. You can actually use post_params itself to do 
>> the insert. Also, no need to select and iterate over all auth_user records 
>> to check the API key -- just check for the existence of that single key via 
>> a query.
>>
>> if db(db.auth_user.api_key == post_params.api_key).count():
>> return t.validate_and_insert(t._filter_fields(**post_params))
>>
>> Anthony
>>
>> On Thursday, January 30, 2014 5:30:52 AM UTC-5, Avi A wrote:
>>>
>>> Hi,
>>> I am trying something like that:
>>> #on one local script instance:
>>> import requests
>>>
>>> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
>>> 'platform', 'f_device': 'device', 'f_steps': '10',
>>>'f_matches':'7', 'f_missmatches': '3', 'f_missing': '0'}
>>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
>>> params=test_params)
>>>
>>> #and the api function:
>>>
>>> @request.restful()
>>> def api():
>>> response.view = 'generic.'+request.extension
>>> def GET(search):
>>> pass
>>> clients = db(db.auth_user).select(db.auth_user.api_key)
>>> t = db.t_tests_results
>>> def POST(**post_params):
>>> for client in clients:
>>> if client.api_key == post_params.api_key:
>>> return t.validate_and_insert(post_params.test,
>>> post_params.f_platform, 
>>> post_params.f_device,
>>> post_params.f_steps, 
>>> post_params.f_matches,
>>> post_params.f_missmatches, 
>>> post_params.f_missing)
>>> else:
>>> raise HTTP(400)
>>>
>>> It's not working... Any help?
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

-- 
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.


[web2py] Re: Trying to build a post api.

2014-01-30 Thread Avi A
Sorry for the "not working", I thought my mistake would be obvious. On the 
console where i sent the post i got "Process finished with exit code 0" but 
i could not see that anything was updated on the table.
Regarding your answer,
First line: does it mean that this "if" statement knows to search the 
auth.user records till it finds a match? and what is the .count() for?
Second line: 
t._filter_fields(**post_params)
Should work assuming the key on the url params matches exactly the field 
name on the table?

(I tried earlier with the insert something like that as well :
return t.validate_and_insert( t.f_test= post_params.f_test, etc")
as well but I thought it was wrong in that context. The example on the book 
wasn't clear to me. (return db.person.validate_and_insert(**fields) )
)
Thanks. 


On Thursday, January 30, 2014 4:49:42 PM UTC+2, Anthony wrote:
>
> Generally it's helpful if you can give more detail than just "not 
> working". Anyway, note that an insert requires keywords and values, not 
> just positional arguments. You can actually use post_params itself to do 
> the insert. Also, no need to select and iterate over all auth_user records 
> to check the API key -- just check for the existence of that single key via 
> a query.
>
> if db(db.auth_user.api_key == post_params.api_key).count():
> return t.validate_and_insert(t._filter_fields(**post_params))
>
> Anthony
>
> On Thursday, January 30, 2014 5:30:52 AM UTC-5, Avi A wrote:
>>
>> Hi,
>> I am trying something like that:
>> #on one local script instance:
>> import requests
>>
>> test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
>> 'platform', 'f_device': 'device', 'f_steps': '10',
>>'f_matches':'7', 'f_missmatches': '3', 'f_missing': '0'}
>> r = requests.post('http://127.0.0.1:8000/qatests/api', 
>> params=test_params)
>>
>> #and the api function:
>>
>> @request.restful()
>> def api():
>> response.view = 'generic.'+request.extension
>> def GET(search):
>> pass
>> clients = db(db.auth_user).select(db.auth_user.api_key)
>> t = db.t_tests_results
>> def POST(**post_params):
>> for client in clients:
>> if client.api_key == post_params.api_key:
>> return t.validate_and_insert(post_params.test,
>> post_params.f_platform, 
>> post_params.f_device,
>> post_params.f_steps, 
>> post_params.f_matches,
>> post_params.f_missmatches, 
>> post_params.f_missing)
>> else:
>> raise HTTP(400)
>>
>> It's not working... Any help?
>> Thanks.
>>
>>
>>
>>
>>
>>
>>
>>
>>

-- 
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.


[web2py] Trying to build a post api.

2014-01-30 Thread Avi A
Hi,
I am trying something like that:
#on one local script instance:
import requests

test_params = {'api_key': 'api_key', 'test': 'test', 'f_platform': 
'platform', 'f_device': 'device', 'steps': 'steps',
   'matches':'matches', 'missmatches': 'missmatches', 'steps': 
'steps'}
r = requests.post('http://127.0.0.1:8000/qatests/api', params=test_params)

#and the api function:

@request.restful()
def api():
response.view = 'generic.'+request.extension
def GET(search):
pass
clients = db(db.auth_user).select(db.auth_user.api_key)
t = db.t_tests_results
def POST(**post_params):
for client in clients:
if client.api_key == post_params.a:
return t.validate_and_insert(post_params.b,
post_params.c, post_params.d,
post_params.e, post_params.f,
post_params.g)
else:
raise HTTP(400)

It's not working... Any help?
Thanks.








-- 
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.


[web2py] post (**vars) question.

2014-01-30 Thread Avi A
Hi,
Looking at that example:

def POST(table_name,**vars):
return db[table_name].validate_and_insert(**vars)

I'm trying to do something like this:
@request.restful()
def api():
clients = db(db.auth_user).select(db.auth.api_key)
t = db.t_tests_results
def POST(**post_params):
for client in clients:
if client.api_key == post_params.a:
return t.validate_and_insert(t.f_test=post_params.b,
t.f_platform=post_params.c, 
t.f_device=post_params.d,
t.f_steps=post_params.e, 
t.f_matches=post_params.f,
t.f_missmatches=post_params.g, 
t.f_missing=post_params.h)
else:
raise HTTP(400)

I am getting:

return db.t_tests_results.validate_and_insert(t.f_test=post_params.b,
SyntaxError: keyword can't be an expression


Thanks.






-- 
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.


[web2py] Re: update via ajax getting error.

2014-01-29 Thread Avi A
I also get on the error log on the Variables :
).update  undefined
On Thursday, January 30, 2014 12:42:03 AM UTC+2, Avi A wrote:
>
>db(db.auth_user.id == auth.user.id).update(api_key == uuid.uuid4())
> TypeError: update() takes exactly 1 argument (2 given)
>
>
> On Thursday, January 30, 2014 12:30:04 AM UTC+2, Avi A wrote:
>>
>> Thanks,
>> I'm still getting the same error.
>>
>> On Thursday, January 30, 2014 12:18:35 AM UTC+2, Niphlod wrote:
>>>
>>> the syntax is wrong
>>> it's 
>>>
>>> db(condition).update(column_name=value)
>>>
>>> not
>>>
>>> db(condition).update(db.table.column_name=value)
>>>
>>> On Wednesday, January 29, 2014 11:09:40 PM UTC+1, Avi A wrote:
>>>>
>>>> Hi,
>>>> I am trying something like that: (render current api key and update it 
>>>> if clicking)
>>>>
>>>> on the view:
>>>>
>>>> Get new api key
>>>> {{=LOAD('default','api_key.load',ajax=True)}}
>>>>
>>>> 
>>>> $(document).ready(function(){
>>>>   $("#change_api_key").click(function(){
>>>> url = 'api_key.load/1' ;
>>>> ajax(default/url, '', 'target')
>>>>   });
>>>>   });
>>>>
>>>> 
>>>>
>>>>
>>>> and the controller:
>>>>
>>>> import uuid
>>>> def api_key():
>>>> if request.args(0):
>>>> db(db.auth_user.id == auth.user.id).update(db.auth_user.api_key 
>>>> == uuid.uuid4())  #error line
>>>>
>>>> my_api_key = db(db.auth_user.id == auth.user.id
>>>> ).select(db.auth_user.api_key)
>>>> return locals()
>>>>
>>>> the error i am getting:
>>>>
>>>> TypeError: update() takes exactly 1 argument (2 given)
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>

-- 
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.


[web2py] Re: update via ajax getting error.

2014-01-29 Thread Avi A


   db(db.auth_user.id == auth.user.id).update(api_key == uuid.uuid4())
TypeError: update() takes exactly 1 argument (2 given)


On Thursday, January 30, 2014 12:30:04 AM UTC+2, Avi A wrote:
>
> Thanks,
> I'm still getting the same error.
>
> On Thursday, January 30, 2014 12:18:35 AM UTC+2, Niphlod wrote:
>>
>> the syntax is wrong
>> it's 
>>
>> db(condition).update(column_name=value)
>>
>> not
>>
>> db(condition).update(db.table.column_name=value)
>>
>> On Wednesday, January 29, 2014 11:09:40 PM UTC+1, Avi A wrote:
>>>
>>> Hi,
>>> I am trying something like that: (render current api key and update it 
>>> if clicking)
>>>
>>> on the view:
>>>
>>> Get new api key
>>> {{=LOAD('default','api_key.load',ajax=True)}}
>>>
>>> 
>>> $(document).ready(function(){
>>>   $("#change_api_key").click(function(){
>>> url = 'api_key.load/1' ;
>>> ajax(default/url, '', 'target')
>>>   });
>>>   });
>>>
>>> 
>>>
>>>
>>> and the controller:
>>>
>>> import uuid
>>> def api_key():
>>> if request.args(0):
>>> db(db.auth_user.id == auth.user.id).update(db.auth_user.api_key 
>>> == uuid.uuid4())  #error line
>>>
>>> my_api_key = db(db.auth_user.id == auth.user.id
>>> ).select(db.auth_user.api_key)
>>> return locals()
>>>
>>> the error i am getting:
>>>
>>> TypeError: update() takes exactly 1 argument (2 given)
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>

-- 
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.


[web2py] Re: update via ajax getting error.

2014-01-29 Thread Avi A
Thanks,
I'm still getting the same error.

On Thursday, January 30, 2014 12:18:35 AM UTC+2, Niphlod wrote:
>
> the syntax is wrong
> it's 
>
> db(condition).update(column_name=value)
>
> not
>
> db(condition).update(db.table.column_name=value)
>
> On Wednesday, January 29, 2014 11:09:40 PM UTC+1, Avi A wrote:
>>
>> Hi,
>> I am trying something like that: (render current api key and update it if 
>> clicking)
>>
>> on the view:
>>
>> Get new api key
>> {{=LOAD('default','api_key.load',ajax=True)}}
>>
>> 
>> $(document).ready(function(){
>>   $("#change_api_key").click(function(){
>> url = 'api_key.load/1' ;
>> ajax(default/url, '', 'target')
>>   });
>>   });
>>
>> 
>>
>>
>> and the controller:
>>
>> import uuid
>> def api_key():
>> if request.args(0):
>> db(db.auth_user.id == auth.user.id).update(db.auth_user.api_key 
>> == uuid.uuid4())  #error line
>>
>> my_api_key = db(db.auth_user.id == auth.user.id
>> ).select(db.auth_user.api_key)
>> return locals()
>>
>> the error i am getting:
>>
>> TypeError: update() takes exactly 1 argument (2 given)
>>
>> Thanks.
>>
>>
>>
>>
>>
>>

-- 
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.


[web2py] update via ajax getting error.

2014-01-29 Thread Avi A
Hi,
I am trying something like that: (render current api key and update it if 
clicking)

on the view:

Get new api key
{{=LOAD('default','api_key.load',ajax=True)}}


$(document).ready(function(){
  $("#change_api_key").click(function(){
url = 'api_key.load/1' ;
ajax(default/url, '', 'target')
  });
  });




and the controller:

import uuid
def api_key():
if request.args(0):
db(db.auth_user.id == auth.user.id).update(db.auth_user.api_key == 
uuid.uuid4())  #error line

my_api_key = db(db.auth_user.id == 
auth.user.id).select(db.auth_user.api_key)
return locals()

the error i am getting:

TypeError: update() takes exactly 1 argument (2 given)

Thanks.





-- 
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.


[web2py] Send local script results to web2py

2014-01-25 Thread Avi A
Hi,
Assuming I want to run a testing script locally and send the test results 
to a web2py app. Would that be the way to do it?

#local script
import requests
test_results = {'api_key': x, 'Fail': 'etc'}
r = requests.get("somedomain.com/default/api/*get*", params=test_results)

# link
def api():
test_vars = request.vars
clients = db(db.t_clients).select(db.t_clients.f_api_key)
for client in clients:
if client.api_key ==  test_vars[0]:
db.t_tests.insert(..)
else:
pass
Thanks.

-- 
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.


[web2py] can't see errors on components.

2014-01-12 Thread Avi A
Hi,
Working on ajax components, I got error/s. It flashes there is an error.
but where can I find the code?
thanks.

-- 
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.


[web2py] Re: How not to update data on live version.

2014-01-12 Thread Avi A
Thanks.

On Sunday, January 12, 2014 1:06:08 PM UTC+2, LightDot wrote:
>
> This can be very simple or complex, depending on if you made any changes 
> to the database structure or its access information.
>
> Assuming you didn't change anything about your database, the solution is 
> to simply don't upload your applications//databases folder.
>
> You really should read about database migrations in the web2py book and 
> provide more information when asking such questions, ie. the database type, 
> etc.
>
> Regards
>
> On Sunday, January 12, 2014 11:20:08 AM UTC+1, Avi A wrote:
>>
>> Hi,
>> Assuming i got my local version, which I want to upload to the live 
>> version.
>> How do I make the updating without overwritng/updating the db on the live 
>> version?
>> Thanks.
>>
>

-- 
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.


[web2py] How not to update data on live version.

2014-01-12 Thread Avi A
Hi,
Assuming i got my local version, which I want to upload to the live version.
How do I make the updating without overwritng/updating the db on the live 
version?
Thanks.

-- 
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.


[web2py] Re: Important New Year News: Edison Award

2014-01-03 Thread Avi A
Good luck :).

On Saturday, January 4, 2014 6:08:38 AM UTC+2, Massimo Di Pierro wrote:
>
> Web2py/me have been nominated for the Edison Award. Please wish web2py 
> (and me) good luck. :-)
>
>

-- 
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.


[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-31 Thread Avi A
Now I got it... theoython {{ is rendered befor the js
Thanks.

On Wednesday, January 1, 2014 2:22:24 AM UTC+2, Anthony wrote:
>
> It appears you are trying to mix Python and Javascript. Note, everything 
> inside the {{...}} must be Python and gets executed on the server. Adding 
> the org_code variable must be done in Javascript, so it would be:
>
> var url = '{{=URL('default', 'org_form_load.load')}}';
> $.web2py.component(url + '/' + org_code, 'org_form_target');
>
> Anthony
>
> On Tuesday, December 31, 2013 2:38:37 PM UTC-5, Avi A wrote:
>>
>> Still stuck with that.
>> While this is rendered as expected on w3school "try me":
>> (assuming org_code = 3):
>> var a ="{{=URL('default', 'org_form_load.load/" + org_code + "')}}";
>> alert(a):
>> {{=URL('default', 'org_form_load.load/3')}}
>>  on web2py it renders:
>> /parking/default/org_form_load.load/%22%20%2B%20org_code%20%2B%20%22
>>
>> ((adding the encoded or decoded chars + NOT replacing the var with it's 
>> value.)
>> Thanks.
>>
>>
>>
>>
>>
>> On Tuesday, December 31, 2013 12:26:43 AM UTC+2, Avi A wrote:
>>>
>>> I was in the direction in one of the tries...
>>> Thanks.
>>>
>>> On Monday, December 30, 2013 11:17:44 PM UTC+2, Anthony wrote:
>>>>
>>>> "$.web2py.component('%s', 'org_form_target');" % URL('default', 
>>>> 'org_form_load.load/org_code');
>>>>
>>>> is actually Python code that generates Javascript, so you cannot use it 
>>>> as you are using it. Instead, I would create the url variable separately:
>>>>
>>>> function insert_component(org_code)
>>>> {
>>>> alert(org_code);
>>>> var url = '{{=URL('default', 'org_form_load.load/org_code')}}';
>>>> $.web2py.component(url, 'org_form_target');
>>>> }
>>>>
>>>> Note the URL is generated in Python, hence its inclusion within the 
>>>> {{...}} template delimiters.
>>>>
>>>> Anthony
>>>>
>>>> On Monday, December 30, 2013 3:58:10 PM UTC-5, Avi A wrote:
>>>>>
>>>>> It works only till the alert...
>>>>>
>>>>> 
>>>>> function insert_component(org_code)
>>>>> {
>>>>> alert(org_code);
>>>>> "$.web2py.component('%s', 'org_form_target');" % URL('default', 
>>>>> 'org_form_load.load/org_code');
>>>>> }
>>>>> 
>>>>>
>>>>> On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:
>>>>>>
>>>>>> ok thanks.
>>>>>>
>>>>>> On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:
>>>>>>>
>>>>>>> Oops, sorry. You'll need to do something more sophisticated. Create 
>>>>>>> an onkeyup handler that retrieves the value in the input and appends it 
>>>>>>> to 
>>>>>>> the URL of the form action (i.e., 
>>>>>>> /default/org_form_load.load/some_name). 
>>>>>>> Then call $.web2py.component() with that URL, and in the org_form_load 
>>>>>>> action, use request.args(0) instead of request.vars.name.
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>> On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:
>>>>>>>>
>>>>>>>> How is the "name" (input value) is passed in this component 
>>>>>>>> template/case? (i click the code and the form won't load into the 
>>>>>>>> page.).
>>>>>>>>
>>>>>>>> On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:
>>>>>>>>>
>>>>>>>>> Thanks. I will look into it.
>>>>>>>>> Happy new year! and thanks for all the awesome support!
>>>>>>>>>
>>>>>>>>> On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>>>>>>>>>>
>>>>>>>>>> The form won't 

[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-31 Thread Avi A
Still stuck with that.
While this is rendered as expected on w3school "try me":
(assuming org_code = 3):
var a ="{{=URL('default', 'org_form_load.load/" + org_code + "')}}";
alert(a):
{{=URL('default', 'org_form_load.load/3')}}
 on web2py it renders:
/parking/default/org_form_load.load/%22%20%2B%20org_code%20%2B%20%22

((adding the encoded or decoded chars + NOT replacing the var with it's 
value.)
Thanks.





On Tuesday, December 31, 2013 12:26:43 AM UTC+2, Avi A wrote:
>
> I was in the direction in one of the tries...
> Thanks.
>
> On Monday, December 30, 2013 11:17:44 PM UTC+2, Anthony wrote:
>>
>> "$.web2py.component('%s', 'org_form_target');" % URL('default', 
>> 'org_form_load.load/org_code');
>>
>> is actually Python code that generates Javascript, so you cannot use it 
>> as you are using it. Instead, I would create the url variable separately:
>>
>> function insert_component(org_code)
>> {
>> alert(org_code);
>> var url = '{{=URL('default', 'org_form_load.load/org_code')}}';
>> $.web2py.component(url, 'org_form_target');
>> }
>>
>> Note the URL is generated in Python, hence its inclusion within the 
>> {{...}} template delimiters.
>>
>> Anthony
>>
>> On Monday, December 30, 2013 3:58:10 PM UTC-5, Avi A wrote:
>>>
>>> It works only till the alert...
>>>
>>> 
>>> function insert_component(org_code)
>>> {
>>> alert(org_code);
>>> "$.web2py.component('%s', 'org_form_target');" % URL('default', 
>>> 'org_form_load.load/org_code');
>>> }
>>> 
>>>
>>> On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:
>>>>
>>>> ok thanks.
>>>>
>>>> On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:
>>>>>
>>>>> Oops, sorry. You'll need to do something more sophisticated. Create an 
>>>>> onkeyup handler that retrieves the value in the input and appends it to 
>>>>> the 
>>>>> URL of the form action (i.e., /default/org_form_load.load/some_name). 
>>>>> Then 
>>>>> call $.web2py.component() with that URL, and in the org_form_load action, 
>>>>> use request.args(0) instead of request.vars.name.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:
>>>>>>
>>>>>> How is the "name" (input value) is passed in this component 
>>>>>> template/case? (i click the code and the form won't load into the page.).
>>>>>>
>>>>>> On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:
>>>>>>>
>>>>>>> Thanks. I will look into it.
>>>>>>> Happy new year! and thanks for all the awesome support!
>>>>>>>
>>>>>>> On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>>>>>>>>
>>>>>>>> The form won't get submitted to the org_form_load action, but 
>>>>>>>> instead will get submitted to the action of the parent page. You have 
>>>>>>>> to 
>>>>>>>> trap the form submission and submit back to the org_form_load action. 
>>>>>>>> Rather than using the ajax() function to load a form, you're better 
>>>>>>>> off 
>>>>>>>> loading the form via an Ajax component:
>>>>>>>>
>>>>>>>> onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % 
>>>>>>>> URL('default', 'org_form_load.load')}}"
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>> On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> It solved the error getting after the form is loaded into the page,
>>>>>>>>> but still nothing happen if I submit the form.
>>>>>>>>> This is what I do:
>>>>>>>>> if form.process().accepted:
>>>>>>>>> response.flash = 'Success!'
>>

[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
I was in the direction in one of the tries...
Thanks.

On Monday, December 30, 2013 11:17:44 PM UTC+2, Anthony wrote:
>
> "$.web2py.component('%s', 'org_form_target');" % URL('default', 
> 'org_form_load.load/org_code');
>
> is actually Python code that generates Javascript, so you cannot use it as 
> you are using it. Instead, I would create the url variable separately:
>
> function insert_component(org_code)
> {
> alert(org_code);
> var url = '{{=URL('default', 'org_form_load.load/org_code')}}';
> $.web2py.component(url, 'org_form_target');
> }
>
> Note the URL is generated in Python, hence its inclusion within the 
> {{...}} template delimiters.
>
> Anthony
>
> On Monday, December 30, 2013 3:58:10 PM UTC-5, Avi A wrote:
>>
>> It works only till the alert...
>>
>> 
>> function insert_component(org_code)
>> {
>> alert(org_code);
>> "$.web2py.component('%s', 'org_form_target');" % URL('default', 
>> 'org_form_load.load/org_code');
>> }
>> 
>>
>> On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:
>>>
>>> ok thanks.
>>>
>>> On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:
>>>>
>>>> Oops, sorry. You'll need to do something more sophisticated. Create an 
>>>> onkeyup handler that retrieves the value in the input and appends it to 
>>>> the 
>>>> URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
>>>> call $.web2py.component() with that URL, and in the org_form_load action, 
>>>> use request.args(0) instead of request.vars.name.
>>>>
>>>> Anthony
>>>>
>>>> On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:
>>>>>
>>>>> How is the "name" (input value) is passed in this component 
>>>>> template/case? (i click the code and the form won't load into the page.).
>>>>>
>>>>> On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:
>>>>>>
>>>>>> Thanks. I will look into it.
>>>>>> Happy new year! and thanks for all the awesome support!
>>>>>>
>>>>>> On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>>>>>>>
>>>>>>> The form won't get submitted to the org_form_load action, but 
>>>>>>> instead will get submitted to the action of the parent page. You have 
>>>>>>> to 
>>>>>>> trap the form submission and submit back to the org_form_load action. 
>>>>>>> Rather than using the ajax() function to load a form, you're better off 
>>>>>>> loading the form via an Ajax component:
>>>>>>>
>>>>>>> onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % 
>>>>>>> URL('default', 'org_form_load.load')}}"
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>> On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> It solved the error getting after the form is loaded into the page,
>>>>>>>> but still nothing happen if I submit the form.
>>>>>>>> This is what I do:
>>>>>>>> if form.process().accepted:
>>>>>>>> response.flash = 'Success!'
>>>>>>>> elif form.errors:
>>>>>>>> response.flash = 'response errors'
>>>>>>>>
>>>>>>>>
>>>>>>>> On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>>>>>>>>>
>>>>>>>>> The form is not accepted when it is first created, so you will 
>>>>>>>>> always get that error message. Instead, you want:
>>>>>>>>>
>>>>>>>>> elif form.errors:
>>>>>>>>> response.flash = 'There was an error..'
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>

[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
It works only till the alert...


function insert_component(org_code)
{
alert(org_code);
"$.web2py.component('%s', 'org_form_target');" % URL('default', 
'org_form_load.load/org_code');
}


On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:
>
> ok thanks.
>
> On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:
>>
>> Oops, sorry. You'll need to do something more sophisticated. Create an 
>> onkeyup handler that retrieves the value in the input and appends it to the 
>> URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
>> call $.web2py.component() with that URL, and in the org_form_load action, 
>> use request.args(0) instead of request.vars.name.
>>
>> Anthony
>>
>> On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:
>>>
>>> How is the "name" (input value) is passed in this component 
>>> template/case? (i click the code and the form won't load into the page.).
>>>
>>> On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:
>>>>
>>>> Thanks. I will look into it.
>>>> Happy new year! and thanks for all the awesome support!
>>>>
>>>> On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>>>>>
>>>>> The form won't get submitted to the org_form_load action, but instead 
>>>>> will get submitted to the action of the parent page. You have to trap the 
>>>>> form submission and submit back to the org_form_load action. Rather than 
>>>>> using the ajax() function to load a form, you're better off loading the 
>>>>> form via an Ajax component:
>>>>>
>>>>> onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % 
>>>>> URL('default', 'org_form_load.load')}}"
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>>>>>>
>>>>>> Thanks,
>>>>>> It solved the error getting after the form is loaded into the page,
>>>>>> but still nothing happen if I submit the form.
>>>>>> This is what I do:
>>>>>> if form.process().accepted:
>>>>>> response.flash = 'Success!'
>>>>>> elif form.errors:
>>>>>> response.flash = 'response errors'
>>>>>>
>>>>>>
>>>>>> On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>>>>>>>
>>>>>>> The form is not accepted when it is first created, so you will 
>>>>>>> always get that error message. Instead, you want:
>>>>>>>
>>>>>>> elif form.errors:
>>>>>>> response.flash = 'There was an error..'
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I have this on the view:
>>>>>>>>
>>>>>>>> 
>>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>>
>>>>>>>> and something like this on the controller:
>>>>>>>>
>>>>>>>> def org_form_load():
>>>>>>>> org_code = request.vars.name
>>>>>>>> org_code_name = db(..).select(..)
>>>>>>>> if org_code_name:
>>>>>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>>>>>> form = 
>>>>>>>> SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
>>>>>>>> 'something...')
>>>>>>>> if form.process().accepted:
>>>>>>>> response.flash = 'Success!'
>>>>>>>> else:
>>>>>>>> response.flash = 'There was an error..'
>>>>>>>> return dict(form = form, org_code_name = org_code_name)
>>>>>>>> and on the org_form_load:
>>>>>>>>
>>>>>>>> {{=form}}
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> (Before moving the form into the load page, everything went fine.)
>>>>>>>> After moving the form to the load page, this is what it does:
>>>>>>>> User fill correctly the organization code.
>>>>>>>> The form appears as expected, (but not submitted yet)
>>>>>>>> BUT I already get the " response.flash = 'There was an error..'".
>>>>>>>> If I try to submit the form nothing flashes and form is not 
>>>>>>>> submitted either.
>>>>>>>> Help please...
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>

-- 
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.


[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
ok thanks.

On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:
>
> Oops, sorry. You'll need to do something more sophisticated. Create an 
> onkeyup handler that retrieves the value in the input and appends it to the 
> URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
> call $.web2py.component() with that URL, and in the org_form_load action, 
> use request.args(0) instead of request.vars.name.
>
> Anthony
>
> On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:
>>
>> How is the "name" (input value) is passed in this component 
>> template/case? (i click the code and the form won't load into the page.).
>>
>> On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:
>>>
>>> Thanks. I will look into it.
>>> Happy new year! and thanks for all the awesome support!
>>>
>>> On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>>>>
>>>> The form won't get submitted to the org_form_load action, but instead 
>>>> will get submitted to the action of the parent page. You have to trap the 
>>>> form submission and submit back to the org_form_load action. Rather than 
>>>> using the ajax() function to load a form, you're better off loading the 
>>>> form via an Ajax component:
>>>>
>>>> onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % 
>>>> URL('default', 'org_form_load.load')}}"
>>>>
>>>> Anthony
>>>>
>>>> On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>>>>>
>>>>> Thanks,
>>>>> It solved the error getting after the form is loaded into the page,
>>>>> but still nothing happen if I submit the form.
>>>>> This is what I do:
>>>>> if form.process().accepted:
>>>>> response.flash = 'Success!'
>>>>> elif form.errors:
>>>>> response.flash = 'response errors'
>>>>>
>>>>>
>>>>> On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>>>>>>
>>>>>> The form is not accepted when it is first created, so you will always 
>>>>>> get that error message. Instead, you want:
>>>>>>
>>>>>> elif form.errors:
>>>>>> response.flash = 'There was an error..'
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>> I have this on the view:
>>>>>>>
>>>>>>> 
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>> and something like this on the controller:
>>>>>>>
>>>>>>> def org_form_load():
>>>>>>> org_code = request.vars.name
>>>>>>> org_code_name = db(..).select(..)
>>>>>>> if org_code_name:
>>>>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>>>>> form = 
>>>>>>> SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
>>>>>>> 'something...')
>>>>>>> if form.process().accepted:
>>>>>>> response.flash = 'Success!'
>>>>>>> else:
>>>>>>> response.flash = 'There was an error..'
>>>>>>> return dict(form = form, org_code_name = org_code_name)
>>>>>>> and on the org_form_load:
>>>>>>>
>>>>>>> {{=form}}
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> (Before moving the form into the load page, everything went fine.)
>>>>>>> After moving the form to the load page, this is what it does:
>>>>>>> User fill correctly the organization code.
>>>>>>> The form appears as expected, (but not submitted yet)
>>>>>>> BUT I already get the " response.flash = 'There was an error..'".
>>>>>>> If I try to submit the form nothing flashes and form is not 
>>>>>>> submitted either.
>>>>>>> Help please...
>>>>>>> Thanks.
>>>>>>>
>>>>>>

-- 
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.


[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
How is the "name" (input value) is passed in this component template/case? 
(i click the code and the form won't load into the page.).

On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:
>
> Thanks. I will look into it.
> Happy new year! and thanks for all the awesome support!
>
> On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>>
>> The form won't get submitted to the org_form_load action, but instead 
>> will get submitted to the action of the parent page. You have to trap the 
>> form submission and submit back to the org_form_load action. Rather than 
>> using the ajax() function to load a form, you're better off loading the 
>> form via an Ajax component:
>>
>> onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % 
>> URL('default', 'org_form_load.load')}}"
>>
>> Anthony
>>
>> On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>>>
>>> Thanks,
>>> It solved the error getting after the form is loaded into the page,
>>> but still nothing happen if I submit the form.
>>> This is what I do:
>>> if form.process().accepted:
>>> response.flash = 'Success!'
>>> elif form.errors:
>>> response.flash = 'response errors'
>>>
>>>
>>> On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>>>>
>>>> The form is not accepted when it is first created, so you will always 
>>>> get that error message. Instead, you want:
>>>>
>>>> elif form.errors:
>>>> response.flash = 'There was an error..'
>>>>
>>>> Anthony
>>>>
>>>> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>>>>>
>>>>> Hi,
>>>>> I have this on the view:
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>> 
>>>>>
>>>>> and something like this on the controller:
>>>>>
>>>>> def org_form_load():
>>>>> org_code = request.vars.name
>>>>> org_code_name = db(..).select(..)
>>>>> if org_code_name:
>>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>>> form = 
>>>>> SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
>>>>> 'something...')
>>>>> if form.process().accepted:
>>>>> response.flash = 'Success!'
>>>>> else:
>>>>> response.flash = 'There was an error..'
>>>>> return dict(form = form, org_code_name = org_code_name)
>>>>> and on the org_form_load:
>>>>>
>>>>> {{=form}}
>>>>>
>>>>>
>>>>>
>>>>> (Before moving the form into the load page, everything went fine.)
>>>>> After moving the form to the load page, this is what it does:
>>>>> User fill correctly the organization code.
>>>>> The form appears as expected, (but not submitted yet)
>>>>> BUT I already get the " response.flash = 'There was an error..'".
>>>>> If I try to submit the form nothing flashes and form is not submitted 
>>>>> either.
>>>>> Help please...
>>>>> Thanks.
>>>>>
>>>>

-- 
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.


[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
Thanks. I will look into it.
Happy new year! and thanks for all the awesome support!

On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:
>
> The form won't get submitted to the org_form_load action, but instead will 
> get submitted to the action of the parent page. You have to trap the form 
> submission and submit back to the org_form_load action. Rather than using 
> the ajax() function to load a form, you're better off loading the form via 
> an Ajax component:
>
> onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % 
> URL('default', 'org_form_load.load')}}"
>
> Anthony
>
> On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>>
>> Thanks,
>> It solved the error getting after the form is loaded into the page,
>> but still nothing happen if I submit the form.
>> This is what I do:
>> if form.process().accepted:
>> response.flash = 'Success!'
>> elif form.errors:
>> response.flash = 'response errors'
>>
>>
>> On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>>>
>>> The form is not accepted when it is first created, so you will always 
>>> get that error message. Instead, you want:
>>>
>>> elif form.errors:
>>> response.flash = 'There was an error..'
>>>
>>> Anthony
>>>
>>> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>>>>
>>>> Hi,
>>>> I have this on the view:
>>>>
>>>> 
>>>>
>>>> 
>>>> 
>>>>
>>>> and something like this on the controller:
>>>>
>>>> def org_form_load():
>>>> org_code = request.vars.name
>>>> org_code_name = db(..).select(..)
>>>> if org_code_name:
>>>> db.t_org_members.f_org_member.default = auth.user.id
>>>> form = 
>>>> SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
>>>> 'something...')
>>>> if form.process().accepted:
>>>> response.flash = 'Success!'
>>>> else:
>>>> response.flash = 'There was an error..'
>>>> return dict(form = form, org_code_name = org_code_name)
>>>> and on the org_form_load:
>>>>
>>>> {{=form}}
>>>>
>>>>
>>>>
>>>> (Before moving the form into the load page, everything went fine.)
>>>> After moving the form to the load page, this is what it does:
>>>> User fill correctly the organization code.
>>>> The form appears as expected, (but not submitted yet)
>>>> BUT I already get the " response.flash = 'There was an error..'".
>>>> If I try to submit the form nothing flashes and form is not submitted 
>>>> either.
>>>> Help please...
>>>> Thanks.
>>>>
>>>

-- 
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.


[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
Thanks,
It solved the error getting after the form is loaded into the page,
but still nothing happen if I submit the form.
This is what I do:
if form.process().accepted:
response.flash = 'Success!'
elif form.errors:
response.flash = 'response errors'


On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>
> The form is not accepted when it is first created, so you will always get 
> that error message. Instead, you want:
>
> elif form.errors:
> response.flash = 'There was an error..'
>
> Anthony
>
> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>>
>> Hi,
>> I have this on the view:
>>
>> 
>>
>> 
>> 
>>
>> and something like this on the controller:
>>
>> def org_form_load():
>> org_code = request.vars.name
>> org_code_name = db(..).select(..)
>> if org_code_name:
>> db.t_org_members.f_org_member.default = auth.user.id
>> form = 
>> SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
>> 'something...')
>> if form.process().accepted:
>> response.flash = 'Success!'
>> else:
>> response.flash = 'There was an error..'
>> return dict(form = form, org_code_name = org_code_name)
>> and on the org_form_load:
>>
>> {{=form}}
>>
>>
>>
>> (Before moving the form into the load page, everything went fine.)
>> After moving the form to the load page, this is what it does:
>> User fill correctly the organization code.
>> The form appears as expected, (but not submitted yet)
>> BUT I already get the " response.flash = 'There was an error..'".
>> If I try to submit the form nothing flashes and form is not submitted 
>> either.
>> Help please...
>> Thanks.
>>
>

-- 
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.


[web2py] with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
Hi,
I have this on the view:


   



and something like this on the controller:

def org_form_load():
org_code = request.vars.name
org_code_name = db(..).select(..)
if org_code_name:
db.t_org_members.f_org_member.default = auth.user.id
form = 
SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
'something...')
if form.process().accepted:
response.flash = 'Success!'
else:
response.flash = 'There was an error..'
return dict(form = form, org_code_name = org_code_name)
and on the org_form_load:

{{=form}}



(Before moving the form into the load page, everything went fine.)
After moving the form to the load page, this is what it does:
User fill correctly the organization code.
The form appears as expected, (but not submitted yet)
BUT I already get the " response.flash = 'There was an error..'".
If I try to submit the form nothing flashes and form is not submitted 
either.
Help please...
Thanks.

-- 
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.


Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
I created a dict instead of a list and I'm getting there...thanks.

On Saturday, December 28, 2013 12:44:09 AM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 2:42 PM, Avi A > wrote:
>
> member.auth_user.email throws the same error. 
> auth_user.email is defined in the select on the controller, as far as i 
> understand, 
> among other fields from the auth user table..
>
>
> It's not.
>
> Try member.email. If that doesn't work, just display member and see what's 
> in it.
>
>
> On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote:
>>
>> On 27 Dec 2013, at 2:20 PM, Avi A  wrote:
>>
>> Now I am able to get the list as you suggested with append.
>> But i don't know how to render it.
>> This is what I try in the view but it says that NameError: name 'auth_user' 
>> is not defined:
>>
>>  {{for member in org_member_data:}}
>> {{=member[auth_user.email]}}
>>   {{pass}}
>>
>>
>> You want something like member.auth_user.email or maybe member.email. 
>> auth_user isn't a variable defined in your controller or view; it's an 
>> element of the row.
>>
>>
>>
>> On Friday, December 27, 2013 9:14:55 PM UTC+2, Avi A wrote:
>>>
>>> user logged in
>>> the view:
>>> if he is in a group:
>>> till now he will see the group members' data and take some action later 
>>> on.
>>> else:
>>> will sign up for a group.
>>> after page refresh will see the group members' data.
>>>
>>> (will have a different page for modifying subscription.)
>>>
>>>
>>> On Friday, December 27, 2013 8:54:34 PM UTC+2, Jonathan Lundell wrote:
>>>>
>>>> On 27 Dec 2013, at 10:53 AM, Avi A  wrote:
>>>>
>>>> for case my_org is empty i wrote:
>>>> if my_org:
>>>> not good enough? (if not empty?)
>>>>
>>>>
>>>> If that happens, what does the view see?
>>>>
>>>>
>>>>
>>>> On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>>>>>
>>>>> On 27 Dec 2013, at 10:23 AM, Avi A  wrote:
>>>>>
>>>>> Thanks,
>>>>> I wasn't wrong, this is what I need:
>>>>>
>>>>> {{for member in org_member_data:}} 
>>>>>
>>>>> what do you mean by:
>>>>> "org_member_data is set to a single member's data, so it ends up with 
>>>>> the last one it was set to. ?
>>>>> or:
>>>>> or perhaps collect org_member_data instances in a list?
>>>>>
>>>>> i return it as a dict or as locals() and it still renders the last one 
>>>>> only.
>>>>>
>>>>>
>>>>> You assign org_member_data to the select of a single row at a time. 
>>>>> Assigning it three times doesn't mean that it'll contain all three rows.
>>>>>
>>>>> Another potential problem is that org_member_data is undefined 
>>>>> if my_org is empty; it'd be prudent to initialize it to None (and check 
>>>>> for 
>>>>> that).
>>>>>
>>>>> But I think what you really mean is something like:
>>>>>
>>>>> org_member_data = []
>>>>> ...
>>>>> for member in my_org_members:
>>>>> org_member_data.append(db(db.auth_user.id == 
>>>>>  member.created_by).select(db.auth_user.phone_num, 
>>>>> db.auth_user.car_num_0, 
>>>>> db.auth_user.email,
>>>>>  db.auth_user.profile_image,db.auth_user.first_name, 
>>>>> db.auth_user.last_name 
>>>>> ))
>>>>>
>>>>>
>>>>>  
>>>>>
>>>>> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>>>>>
>>>>>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>>>>>
>>>>>> Hi,
>>>>>> I'm doing something like that:
>>>>>> if auth.user:
>>>>>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>>>>>> ).select(db.t_org_members.f_org_rep)
>>>>>> if my_org:
>>>>>> for m in my_org:
>>>>

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
yes i tried that one too.
{{=member}} renders inside each option atable with expected data:
auth_user.phone_numauth_user.car_num_0
auth_user.emailauth_user.profile_image
auth_user.first_nameauth_user.last_name0548102940111aviavia4u+1@g...
fileAviAbramovitch

On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 2:20 PM, Avi A > wrote:
>
> Now I am able to get the list as you suggested with append.
> But i don't know how to render it.
> This is what I try in the view but it says that NameError: name 'auth_user' 
> is not defined:
>
>  {{for member in org_member_data:}}
> {{=member[auth_user.email]}}
>   {{pass}}
>
>
> You want something like member.auth_user.email or maybe member.email. 
> auth_user isn't a variable defined in your controller or view; it's an 
> element of the row.
>
>
>
> On Friday, December 27, 2013 9:14:55 PM UTC+2, Avi A wrote:
>>
>> user logged in
>> the view:
>> if he is in a group:
>> till now he will see the group members' data and take some action later 
>> on.
>> else:
>> will sign up for a group.
>> after page refresh will see the group members' data.
>>
>> (will have a different page for modifying subscription.)
>>
>>
>> On Friday, December 27, 2013 8:54:34 PM UTC+2, Jonathan Lundell wrote:
>>>
>>> On 27 Dec 2013, at 10:53 AM, Avi A  wrote:
>>>
>>> for case my_org is empty i wrote:
>>> if my_org:
>>> not good enough? (if not empty?)
>>>
>>>
>>> If that happens, what does the view see?
>>>
>>>
>>>
>>> On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>>>>
>>>> On 27 Dec 2013, at 10:23 AM, Avi A  wrote:
>>>>
>>>> Thanks,
>>>> I wasn't wrong, this is what I need:
>>>>
>>>> {{for member in org_member_data:}} 
>>>>
>>>> what do you mean by:
>>>> "org_member_data is set to a single member's data, so it ends up with 
>>>> the last one it was set to. ?
>>>> or:
>>>> or perhaps collect org_member_data instances in a list?
>>>>
>>>> i return it as a dict or as locals() and it still renders the last one 
>>>> only.
>>>>
>>>>
>>>> You assign org_member_data to the select of a single row at a time. 
>>>> Assigning it three times doesn't mean that it'll contain all three rows.
>>>>
>>>> Another potential problem is that org_member_data is undefined 
>>>> if my_org is empty; it'd be prudent to initialize it to None (and check 
>>>> for 
>>>> that).
>>>>
>>>> But I think what you really mean is something like:
>>>>
>>>> org_member_data = []
>>>> ...
>>>> for member in my_org_members:
>>>> org_member_data.append(db(db.auth_user.id == 
>>>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>>>> db.auth_user.email,
>>>>  db.auth_user.profile_image,db.auth_user.first_name, 
>>>> db.auth_user.last_name 
>>>> ))
>>>>
>>>>
>>>>  
>>>>
>>>> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>>>>
>>>>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>>>>
>>>>> Hi,
>>>>> I'm doing something like that:
>>>>> if auth.user:
>>>>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>>>>> ).select(db.t_org_members.f_org_rep)
>>>>> if my_org:
>>>>> for m in my_org:
>>>>> my_org_members = db(db.t_org_members.f_org_rep == 
>>>>>  m.f_org_rep).select(db.t_org_members.created_by)
>>>>> for member in my_org_members:
>>>>> org_member_data = db(db.auth_user.id == 
>>>>>  member.created_by).select(db.auth_user.phone_num, 
>>>>> db.auth_user.car_num_0, 
>>>>> db.auth_user.email, 
>>>>> db.auth_user.profile_image,db.auth_user.first_name, 
>>>>> db.auth_user.last_name )
>>>>>
>>>>> The only problem is that :
>>>>>

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
member.auth_user.email throws the same error. 
auth_user.email is defined in the select on the controller, as far as i 
understand, 
among other fields from the auth user table..

On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 2:20 PM, Avi A > wrote:
>
> Now I am able to get the list as you suggested with append.
> But i don't know how to render it.
> This is what I try in the view but it says that NameError: name 'auth_user' 
> is not defined:
>
>  {{for member in org_member_data:}}
> {{=member[auth_user.email]}}
>   {{pass}}
>
>
> You want something like member.auth_user.email or maybe member.email. 
> auth_user isn't a variable defined in your controller or view; it's an 
> element of the row.
>
>
>
> On Friday, December 27, 2013 9:14:55 PM UTC+2, Avi A wrote:
>>
>> user logged in
>> the view:
>> if he is in a group:
>> till now he will see the group members' data and take some action later 
>> on.
>> else:
>> will sign up for a group.
>> after page refresh will see the group members' data.
>>
>> (will have a different page for modifying subscription.)
>>
>>
>> On Friday, December 27, 2013 8:54:34 PM UTC+2, Jonathan Lundell wrote:
>>>
>>> On 27 Dec 2013, at 10:53 AM, Avi A  wrote:
>>>
>>> for case my_org is empty i wrote:
>>> if my_org:
>>> not good enough? (if not empty?)
>>>
>>>
>>> If that happens, what does the view see?
>>>
>>>
>>>
>>> On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>>>>
>>>> On 27 Dec 2013, at 10:23 AM, Avi A  wrote:
>>>>
>>>> Thanks,
>>>> I wasn't wrong, this is what I need:
>>>>
>>>> {{for member in org_member_data:}} 
>>>>
>>>> what do you mean by:
>>>> "org_member_data is set to a single member's data, so it ends up with 
>>>> the last one it was set to. ?
>>>> or:
>>>> or perhaps collect org_member_data instances in a list?
>>>>
>>>> i return it as a dict or as locals() and it still renders the last one 
>>>> only.
>>>>
>>>>
>>>> You assign org_member_data to the select of a single row at a time. 
>>>> Assigning it three times doesn't mean that it'll contain all three rows.
>>>>
>>>> Another potential problem is that org_member_data is undefined 
>>>> if my_org is empty; it'd be prudent to initialize it to None (and check 
>>>> for 
>>>> that).
>>>>
>>>> But I think what you really mean is something like:
>>>>
>>>> org_member_data = []
>>>> ...
>>>> for member in my_org_members:
>>>> org_member_data.append(db(db.auth_user.id == 
>>>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>>>> db.auth_user.email,
>>>>  db.auth_user.profile_image,db.auth_user.first_name, 
>>>> db.auth_user.last_name 
>>>> ))
>>>>
>>>>
>>>>  
>>>>
>>>> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>>>>
>>>>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>>>>
>>>>> Hi,
>>>>> I'm doing something like that:
>>>>> if auth.user:
>>>>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>>>>> ).select(db.t_org_members.f_org_rep)
>>>>> if my_org:
>>>>> for m in my_org:
>>>>> my_org_members = db(db.t_org_members.f_org_rep == 
>>>>>  m.f_org_rep).select(db.t_org_members.created_by)
>>>>> for member in my_org_members:
>>>>> org_member_data = db(db.auth_user.id == 
>>>>>  member.created_by).select(db.auth_user.phone_num, 
>>>>> db.auth_user.car_num_0, 
>>>>> db.auth_user.email, 
>>>>> db.auth_user.profile_image,db.auth_user.first_name, 
>>>>> db.auth_user.last_name )
>>>>>
>>>>> The only problem is that :
>>>>>
>>>>> while this renders three members as expected:
>>>>>

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Now I am able to get the list as you suggested with append.
But i don't know how to render it.
This is what I try in the view but it says that NameError: name 'auth_user' is 
not defined:

 {{for member in org_member_data:}}
{{=member[auth_user.email]}}
  {{pass}}



On Friday, December 27, 2013 9:14:55 PM UTC+2, Avi A wrote:
>
> user logged in
> the view:
> if he is in a group:
> till now he will see the group members' data and take some action later on.
> else:
> will sign up for a group.
> after page refresh will see the group members' data.
>
> (will have a different page for modifying subscription.)
>
>
> On Friday, December 27, 2013 8:54:34 PM UTC+2, Jonathan Lundell wrote:
>>
>> On 27 Dec 2013, at 10:53 AM, Avi A  wrote:
>>
>> for case my_org is empty i wrote:
>> if my_org:
>> not good enough? (if not empty?)
>>
>>
>> If that happens, what does the view see?
>>
>>
>>
>> On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>>>
>>> On 27 Dec 2013, at 10:23 AM, Avi A  wrote:
>>>
>>> Thanks,
>>> I wasn't wrong, this is what I need:
>>>
>>> {{for member in org_member_data:}} 
>>>
>>> what do you mean by:
>>> "org_member_data is set to a single member's data, so it ends up with 
>>> the last one it was set to. ?
>>> or:
>>> or perhaps collect org_member_data instances in a list?
>>>
>>> i return it as a dict or as locals() and it still renders the last one 
>>> only.
>>>
>>>
>>> You assign org_member_data to the select of a single row at a time. 
>>> Assigning it three times doesn't mean that it'll contain all three rows.
>>>
>>> Another potential problem is that org_member_data is undefined if my_org 
>>> is empty; it'd be prudent to initialize it to None (and check for that).
>>>
>>> But I think what you really mean is something like:
>>>
>>> org_member_data = []
>>> ...
>>> for member in my_org_members:
>>> org_member_data.append(db(db.auth_user.id == 
>>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>>> db.auth_user.email,
>>>  db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name 
>>> ))
>>>
>>>
>>>  
>>>
>>> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>>>
>>>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>>>
>>>> Hi,
>>>> I'm doing something like that:
>>>> if auth.user:
>>>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>>>> ).select(db.t_org_members.f_org_rep)
>>>> if my_org:
>>>> for m in my_org:
>>>> my_org_members = db(db.t_org_members.f_org_rep == 
>>>>  m.f_org_rep).select(db.t_org_members.created_by)
>>>> for member in my_org_members:
>>>> org_member_data = db(db.auth_user.id == 
>>>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>>>> db.auth_user.email, 
>>>> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name 
>>>> )
>>>>
>>>> The only problem is that :
>>>>
>>>> while this renders three members as expected:
>>>> {{=my_org_members}}
>>>>
>>>> This renders the last member's data only:
>>>>
>>>> {{for member in org_member_data:}} 
>>>> {{=member}}
>>>> {{pass}}
>>>>
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> org_member_data is set to a single member's data, so it ends up with 
>>>> the last one it was set to. 
>>>>
>>>> Did you mean to write:
>>>>
>>>> {{for member in my_org_members:}} 
>>>> {{=member}}
>>>> {{pass}}
>>>>
>>>> ... or perhaps collect org_member_data instances in a list?
>>>>
>>>
>>>
>>>
>>>
>>>
>> -- 
>> 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)
>>
>>
>>
>>
>>

-- 
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.


Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
user logged in
the view:
if he is in a group:
till now he will see the group members' data and take some action later on.
else:
will sign up for a group.
after page refresh will see the group members' data.

(will have a different page for modifying subscription.)


On Friday, December 27, 2013 8:54:34 PM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 10:53 AM, Avi A > 
> wrote:
>
> for case my_org is empty i wrote:
> if my_org:
> not good enough? (if not empty?)
>
>
> If that happens, what does the view see?
>
>
>
> On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>>
>> On 27 Dec 2013, at 10:23 AM, Avi A  wrote:
>>
>> Thanks,
>> I wasn't wrong, this is what I need:
>>
>> {{for member in org_member_data:}} 
>>
>> what do you mean by:
>> "org_member_data is set to a single member's data, so it ends up with 
>> the last one it was set to. ?
>> or:
>> or perhaps collect org_member_data instances in a list?
>>
>> i return it as a dict or as locals() and it still renders the last one 
>> only.
>>
>>
>> You assign org_member_data to the select of a single row at a time. 
>> Assigning it three times doesn't mean that it'll contain all three rows.
>>
>> Another potential problem is that org_member_data is undefined if my_org 
>> is empty; it'd be prudent to initialize it to None (and check for that).
>>
>> But I think what you really mean is something like:
>>
>> org_member_data = []
>> ...
>> for member in my_org_members:
>> org_member_data.append(db(db.auth_user.id == 
>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>> db.auth_user.email,
>>  db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name 
>> ))
>>
>>
>>  
>>
>> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>>
>>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>>
>>> Hi,
>>> I'm doing something like that:
>>> if auth.user:
>>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>>> ).select(db.t_org_members.f_org_rep)
>>> if my_org:
>>> for m in my_org:
>>> my_org_members = db(db.t_org_members.f_org_rep == 
>>>  m.f_org_rep).select(db.t_org_members.created_by)
>>> for member in my_org_members:
>>> org_member_data = db(db.auth_user.id == 
>>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>>> db.auth_user.email, 
>>> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name )
>>>
>>> The only problem is that :
>>>
>>> while this renders three members as expected:
>>> {{=my_org_members}}
>>>
>>> This renders the last member's data only:
>>>
>>> {{for member in org_member_data:}} 
>>> {{=member}}
>>> {{pass}}
>>>
>>>
>>> Thanks.
>>>
>>>
>>> org_member_data is set to a single member's data, so it ends up with the 
>>> last one it was set to. 
>>>
>>> Did you mean to write:
>>>
>>> {{for member in my_org_members:}} 
>>> {{=member}}
>>> {{pass}}
>>>
>>> ... or perhaps collect org_member_data instances in a list?
>>>
>>
>>
>>
>>
>>
> -- 
> 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)
>
>
>
>
>

-- 
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.


Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
for case my_org is empty i wrote:
if my_org:
not good enough? (if not empty?)


On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 10:23 AM, Avi A > 
> wrote:
>
> Thanks,
> I wasn't wrong, this is what I need:
>
> {{for member in org_member_data:}} 
>
> what do you mean by:
> "org_member_data is set to a single member's data, so it ends up with the 
> last one it was set to. ?
> or:
> or perhaps collect org_member_data instances in a list?
>
> i return it as a dict or as locals() and it still renders the last one 
> only.
>
>
> You assign org_member_data to the select of a single row at a time. 
> Assigning it three times doesn't mean that it'll contain all three rows.
>
> Another potential problem is that org_member_data is undefined if my_org 
> is empty; it'd be prudent to initialize it to None (and check for that).
>
> But I think what you really mean is something like:
>
> org_member_data = []
> ...
> for member in my_org_members:
> org_member_data.append(db(db.auth_user.id == 
>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
> db.auth_user.email,
>  db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name 
> ))
>
>
>  
>
> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>
>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>
>> Hi,
>> I'm doing something like that:
>> if auth.user:
>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>> ).select(db.t_org_members.f_org_rep)
>> if my_org:
>> for m in my_org:
>> my_org_members = db(db.t_org_members.f_org_rep == 
>>  m.f_org_rep).select(db.t_org_members.created_by)
>> for member in my_org_members:
>> org_member_data = db(db.auth_user.id == 
>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>> db.auth_user.email, 
>> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name )
>>
>> The only problem is that :
>>
>> while this renders three members as expected:
>> {{=my_org_members}}
>>
>> This renders the last member's data only:
>>
>> {{for member in org_member_data:}} 
>> {{=member}}
>> {{pass}}
>>
>>
>> Thanks.
>>
>>
>> org_member_data is set to a single member's data, so it ends up with the 
>> last one it was set to. 
>>
>> Did you mean to write:
>>
>> {{for member in my_org_members:}} 
>> {{=member}}
>> {{pass}}
>>
>> ... or perhaps collect org_member_data instances in a list?
>>
>
>
>
>
>

-- 
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.


Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Alright, I see what you mean. I'll give it a try. Thanks.

On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 10:23 AM, Avi A > 
> wrote:
>
> Thanks,
> I wasn't wrong, this is what I need:
>
> {{for member in org_member_data:}} 
>
> what do you mean by:
> "org_member_data is set to a single member's data, so it ends up with the 
> last one it was set to. ?
> or:
> or perhaps collect org_member_data instances in a list?
>
> i return it as a dict or as locals() and it still renders the last one 
> only.
>
>
> You assign org_member_data to the select of a single row at a time. 
> Assigning it three times doesn't mean that it'll contain all three rows.
>
> Another potential problem is that org_member_data is undefined if my_org 
> is empty; it'd be prudent to initialize it to None (and check for that).
>
> But I think what you really mean is something like:
>
> org_member_data = []
> ...
> for member in my_org_members:
> org_member_data.append(db(db.auth_user.id == 
>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
> db.auth_user.email,
>  db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name 
> ))
>
>
>  
>
> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>
>> On 27 Dec 2013, at 9:53 AM, Avi A  wrote:
>>
>> Hi,
>> I'm doing something like that:
>> if auth.user:
>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>> ).select(db.t_org_members.f_org_rep)
>> if my_org:
>> for m in my_org:
>> my_org_members = db(db.t_org_members.f_org_rep == 
>>  m.f_org_rep).select(db.t_org_members.created_by)
>> for member in my_org_members:
>> org_member_data = db(db.auth_user.id == 
>>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
>> db.auth_user.email, 
>> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name )
>>
>> The only problem is that :
>>
>> while this renders three members as expected:
>> {{=my_org_members}}
>>
>> This renders the last member's data only:
>>
>> {{for member in org_member_data:}} 
>> {{=member}}
>> {{pass}}
>>
>>
>> Thanks.
>>
>>
>> org_member_data is set to a single member's data, so it ends up with the 
>> last one it was set to. 
>>
>> Did you mean to write:
>>
>> {{for member in my_org_members:}} 
>> {{=member}}
>> {{pass}}
>>
>> ... or perhaps collect org_member_data instances in a list?
>>
>
>
>
>
>

-- 
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.


Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Thanks,
I wasn't wrong, this is what I need:

{{for member in org_member_data:}} 

what do you mean by:
"org_member_data is set to a single member's data, so it ends up with the 
last one it was set to. ?
or:
or perhaps collect org_member_data instances in a list?

i return it as a dict or as locals() and it still renders the last one only.
 

On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>
> On 27 Dec 2013, at 9:53 AM, Avi A > wrote:
>
> Hi,
> I'm doing something like that:
> if auth.user:
> my_org = db(db.t_org_members.f_org_member == auth.user.id
> ).select(db.t_org_members.f_org_rep)
> if my_org:
> for m in my_org:
> my_org_members = db(db.t_org_members.f_org_rep == 
>  m.f_org_rep).select(db.t_org_members.created_by)
> for member in my_org_members:
> org_member_data = db(db.auth_user.id == 
>  member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0, 
> db.auth_user.email, 
> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name )
>
> The only problem is that :
>
> while this renders three members as expected:
> {{=my_org_members}}
>
> This renders the last member's data only:
>
> {{for member in org_member_data:}} 
> {{=member}}
> {{pass}}
>
>
> Thanks.
>
>
> org_member_data is set to a single member's data, so it ends up with the 
> last one it was set to. 
>
> Did you mean to write:
>
> {{for member in my_org_members:}} 
> {{=member}}
> {{pass}}
>
> ... or perhaps collect org_member_data instances in a list?
>

-- 
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.


  1   2   >