Re: [web2py] Re: multiple SQLFORM.grid on tabs

2014-08-12 Thread Vid Ogris
Thanks for reply

I get both grids but they are not in different tabs but both in the same
and in addition, when I open view or edit option I get double view for one
record?


2014-08-11 16:58 GMT+02:00 Cliff Kachinske :

> I would just use ajax or LOAD.
>
> If you really want to use grid, something like this might work.
>
> In the view:
> 
> {{=form_0}}
> 
>
>
> 
> {{=form_1}}
> 
>
>
> 
> {{=form_...}}
> 
>
> In the controller:
> def some_func():
>
>
> form_0 = SQLFORM.grid(whatever)
> form_1 = SQLFORM.grid(whatever_else)
> form_... = SQLFORM.grod(yet_other)
>
>
> return dict(form_0=form_0, form_1=form_1, form_...=form_...)
>
>
>
> On Monday, August 11, 2014 10:03:56 AM UTC-4, Yebach wrote:
>>
>> Hello
>>
>> I am trying to create a view where I have tabs and each tab has its own
>> view.
>> All tabs are included into main view. lets call it settings.
>>
>> In settings there are tabs for user to insert workers into tables, posts,
>> etc etc. all the (un)necessary stuff.
>>
>> For each I would like to use SQLFORM.grid. It already works for inserting
>> workers, but how to add new ones??
>>
>> I guess in controller I have to create function for each table
>> (form.grid) and for each I have to create new view (html)??
>>
>> And what function to create for main view? - Basically it should show
>> data for workers but this way all I get is workers SQLform.grid
>>
>> Is this it even possible.
>>
>> Any guideliness would be nice
>>
>> Thank you
>>
>> some code
>>
>> main view
>>
>> 
>> {{=T('
>> Delavci')}}
>> {{=T('Turnusi')}}
>> 
>>
>> 
>> 
>> {{include '../views/settings/workers.html'}}
>> 
>> 
>> {{include '../views/settings/turnusi.html'}}
>> 
>> 
>> 
>> 
>> 
>> 
>> {{=T('Delavci')}}
>> {{=T('Turnusi')}}
>> 
>> 
>> 
>> 
>>
>> My view for workers
>>
>> 
>> 
>> {{=T('Šifrant delavcev')}}
>> {{=response.flash}}
>> 
>> {{=grid}}
>> 
>> 
>> >
>> my view for turnusi
>>
>> 
>> 
>> {{=T('Šifrant turnusov')}}
>> {{=response.flash}}
>> {{=grid}}
>> 
>> 
>>
>>
>> and for both i have fucntions in controller
>>
>>
>>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/cB5pLIi9N6o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lep pozdrav

Vid Ogris

-- 
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] Issue 1961; redirect, response.headers and CAS

2014-08-12 Thread Remco Boerma


Thanks Massimo, 

Concerning https://code.google.com/p/web2py/issues/detail?id=1961&can=1 

The CAS structure uses redirect() internally. Can you update the call in the 
CAS code to send the request.headers? That's why i proposed a change on all 
redirect calls. This allows the CAS to be CORS compliant if the user provides 
the proper headers on the controller level 

With kind regards. 

Remco

-- 
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] converting rows object into javascript array (array of arrays)

2014-08-12 Thread Mirek Zvolský
I need a javascript array of arrays for the autocomplete control.
There are not so much records, so I can fetch them all before, without use 
of ajax inside the autocomplete control.
Following works for me, but I am not sure if this is optimal way (if 2 
steps are necessary):


var oCustomers = {{=XML(customers.json())}};  // [Object, Object, ..]
aCustomers = [];  // 
[Array[2], Array[2], ..]
for (var i=0; ihttp://yahoo.util.localdatasource%28hledej/>aCustomers);
var AC = new YAHOO.widget.AutoComplete('no_table_c 
<http://yahoo.widget.autocomplete%28%27no_table_hledame/>ustomer', 
'suggestionsDiv', DS);



Question is if the array of arrays can be created directly, without the 
step with array of objects (1st line of code).

Or additional question if somebody works with YUI2 autocomplete as me:
Can I create json object (and how) and .LocalDataSource( 
json) directly from this json 
object?

Thanks..., Mirek

-- 
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] How to use this module?

2014-08-12 Thread lyn2py
With reference to SimpleCV . Although it is a PY (I 
can drop into the modules folder and just import), it has a number of 
dependencies:

pygame>=1.9.1
PIL==1.1.7
nose>=1.0.0
ipython>=0.12
numpy>=numpy-2.0.0


Please correct me if I am wrong:

   1. Only pure python modules can be used from the *modules* folder?
   2. If they contain C,C++ files they cannot be used from the *modules* 
   folder? (or rather, how can I use them by dropping them into the modules 
   folder? I prefer this method since it is more portable)
   
Thank you!

-- 
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] Dynamic menu update

2014-08-12 Thread Richard
Hello,

I  have a farely large menu structure in a page through buttons with 
dropdown menu's which are changed dynamically. A refresh of the whole page 
take about 5 seconds which is too long. Now I want to split this using 
components. These components must be reloaded depending on additions to the 
database through a SQLFORM.factory.

navigation.load:
   

{{=LOAD('default', 'menu_identity.load', ajax=False, 
ajax_trap=False, vars=request.vars, target='menu_identity') }}

menu_identity.load:
 {{=A(T("Add local 
EV"),_href=URL('internal','add_local_ev.load', 
   vars=dict(com=com, sif=sif)), 
cid='internal_data_div' ) }}

add_local_ev.load:
 {{=LOAD('internal', 'process_add_local_ev', ajax=True, 
ajax_trap=True, vars=request.vars )}}


internal.py:
 if 
form_add_local_ev.process(formname='add_lev').accepted:
.
 response.js = "jQuery('#%s').get(0).reload()" 
% 'menu_identity'

I think I am making the design to complicated and does not give the needed 
functionality.
Any assist is welcome.

Richard D

-- 
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] Random form field order

2014-08-12 Thread Richard
For updating a dynamically generated table I use a temporarily table and a 
SQLFORM on that table.
This works fine except the sequence of the fields looks random to me.

I use the following code:

lev_fields_dict= {
Field( 
"d"+str(eval('db.%s'%request.vars.lev_table)[date_row.id]['lev_date']).replace("-",
 
""),
  
db.local_ev_def[db(db.local_ev.lev_table_name==request.vars.lev_table).select().first().local_ev_def].data_type,
  
default=eval('db.%s'%request.vars.lev_table)[date_row.id]['lev_value'],
  label = 
str(eval('db.%s'%request.vars.lev_table)[date_row.id]['lev_date'])
 )
 for date_row in 
eval('db(db.%s)'%request.vars.lev_table).select( 
eval('db.%s'%request.vars.lev_table).id,

orderby=eval('db.%s'%request.vars.lev_table).id)
}

db.define_table('form_%s'%request.vars.lev_table, *lev_fields_dict)
form = SQLFORM(eval('db.form_%s'%request.vars.lev_table))

The fields in the temp table have random order. Does anybody know why?
Thanks,
Richard D

-- 
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] form.auth.register() does not add user

2014-08-12 Thread Ruud Schroen

I have this:

My form:
auth.settings.register_onaccept = lambda form: __add_user_membership(form)
auth.settings.register_next = URL('members', 'ingeschreven')
return dict(form=auth.register())

My onaccept function:
def __add_user_membership(form):
user_id = form.vars.id
if form.vars.is_company==True:
print "Adding user to the company group"
group=db(db.auth_group.role=='company').select().first()
auth.add_membership(group.id,user_id)
else:
print "Company was not selected"
if form.vars.is_client==True:
print "Adding user to the client group"
group=db(db.auth_group.role=='client').select().first()
auth.add_membership(group.id,user_id)
else:
print "Client was not selected"
if form.vars.is_reseller==True:
print "Adding user to the reseller group"
group=db(db.auth_group.role=='reseller').select().first()
auth.add_membership(group.id,user_id)
else:
print "Company was not selected"
if form.vars.is_supplier==True:
print "Adding user to the supplier group"
group=db(db.auth_group.role=='supplier').select().first()
auth.add_membership(group.id,user_id)
else:
print "Client was not selected"

When I fill out the form and submit, the user is not added and nothing 
happens..

-- 
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: form.auth.register() does not add user

2014-08-12 Thread Leonel Câmara
Please don't do this:

if form.vars.is_company==True:

Just

if form.vars.is_company:

Is enough.

Then

auth.settings.register_onaccept.append(lambda form: 
__add_user_membership(form))

Notice that I'm using append instead of =.

-- 
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: Random form field order

2014-08-12 Thread Anthony
Your lev_fields_dict is not a dictionary but a set object (if you use curly 
braces without providing both keys and values separated by colons, you get 
a set). Neither sets nor dictionaries preserve order. In any case, you 
don't need a set -- just use a list (replace the curly braces with brackets 
to create a list comprehension).

Also, from a security perspective, it is dangerous to eval() code submitted 
by users -- don't do it. In fact, you don't need eval in any of the places 
you have used it. Instead of:

eval('db.%s'%request.vars.lev_table)

You can do:

db[request.vars.lev_table]

Anthony

On Tuesday, August 12, 2014 6:16:57 AM UTC-4, Richard wrote:
>
> For updating a dynamically generated table I use a temporarily table and a 
> SQLFORM on that table.
> This works fine except the sequence of the fields looks random to me.
>
> I use the following code:
>
> lev_fields_dict= {
> Field( "d"+str(eval('db.%s'%request.vars.lev_table)[
> date_row.id]['lev_date']).replace("-", ""),
>   
> db.local_ev_def[db(db.local_ev.lev_table_name==request.vars.lev_table).select().first().local_ev_def].data_type,
>   default=eval('db.%s'%request.vars.lev_table)[date_row.id
> ]['lev_value'],
>   label = str(eval('db.%s'%request.vars.lev_table)[
> date_row.id]['lev_date'])
>  )
>  for date_row in 
> eval('db(db.%s)'%request.vars.lev_table).select( 
> eval('db.%s'%request.vars.lev_table).id,
>   
>   orderby=eval('db.%s'%request.vars.lev_table).id)
> }
>
> db.define_table('form_%s'%request.vars.lev_table, *lev_fields_dict)
> form = SQLFORM(eval('db.form_%s'%request.vars.lev_table))
>
> The fields in the temp table have random order. Does anybody know why?
> Thanks,
> Richard D
>

-- 
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: Random form field order

2014-08-12 Thread Richard
Anthony,

Thank you, both hints work fine :)

Richard D

On Tuesday, August 12, 2014 12:16:57 PM UTC+2, Richard wrote:
>
> For updating a dynamically generated table I use a temporarily table and a 
> SQLFORM on that table.
> This works fine except the sequence of the fields looks random to me.
>
> I use the following code:
>
> lev_fields_dict= {
> Field( "d"+str(eval('db.%s'%request.vars.lev_table)[
> date_row.id]['lev_date']).replace("-", ""),
>   
> db.local_ev_def[db(db.local_ev.lev_table_name==request.vars.lev_table).select().first().local_ev_def].data_type,
>   default=eval('db.%s'%request.vars.lev_table)[date_row.id
> ]['lev_value'],
>   label = str(eval('db.%s'%request.vars.lev_table)[
> date_row.id]['lev_date'])
>  )
>  for date_row in 
> eval('db(db.%s)'%request.vars.lev_table).select( 
> eval('db.%s'%request.vars.lev_table).id,
>   
>   orderby=eval('db.%s'%request.vars.lev_table).id)
> }
>
> db.define_table('form_%s'%request.vars.lev_table, *lev_fields_dict)
> form = SQLFORM(eval('db.form_%s'%request.vars.lev_table))
>
> The fields in the temp table have random order. Does anybody know why?
> Thanks,
> Richard D
>

-- 
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: How to use this module?

2014-08-12 Thread Mirek Zvolský
I don't know this package, but I think it is possible install it in this 
way:

1. OpenCV - based on OS, f.e.
   Windows: from http://www.lfd.uci.edu/~gohlke/pythonlibs/
   Debian: aptitude: python-opencv

2. pip install SimpleCV
   this will install all dependencies

3. import SimpleCV






Dne úterý, 12. srpna 2014 11:25:07 UTC+2 lyn2py napsal(a):
>
> With reference to SimpleCV . Although it is a PY (I 
> can drop into the modules folder and just import), it has a number of 
> dependencies:
>
> pygame>=1.9.1
> PIL==1.1.7
> nose>=1.0.0
> ipython>=0.12
> numpy>=numpy-2.0.0
>
>
> Please correct me if I am wrong:
>
>1. Only pure python modules can be used from the *modules* folder?
>2. If they contain C,C++ files they cannot be used from the *modules* 
>folder? (or rather, how can I use them by dropping them into the modules 
>folder? I prefer this method since it is more portable)
>
> Thank you!
>

-- 
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] RESTful PATCH request not working

2014-08-12 Thread Falko Delarue
The backbone.js framwork defines the following request type map 
http://backbonejs.org/docs/backbone.html#section-153
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
  var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch':  'PATCH',
'delete': 'DELETE',
'read':   'GET'
  };

but when I implement controllers/object.py
@request.restful()
def object():
def GET(*args, **vars):
from gluon.serializers import json

def PATCH(*args, **vars):
'''
PATCH
update only a few properties of one object
'''
if request.args(0):
old_record = table[getAccess(True)]


the PATCH method is not working (chrome dev tools output)


   1. PATCH http://localhost:8000/icvs/object/object/11 400 (Bad Request) 
   jquery-2.1.1.min.js:4


So far I could not find the code in gluon that defines the allowed request 
methods. I would appreciate some help.

-- 
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: RESTful PATCH request not working

2014-08-12 Thread Leonel Câmara
The problem is probably that in your PATCH function you're accessing 
request.args(0) when you should be using args[0].

For further help you need to examine the error message you're getting as 
calling your PATCH is raising TypeError exceptions which usually means 
something isn't getting the correct arguments.

-- 
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: RESTful PATCH request not working

2014-08-12 Thread Falko Delarue


On Tuesday, August 12, 2014 6:10:28 PM UTC+2, Leonel Câmara wrote:
>
> The problem is probably that in your PATCH function you're accessing 
> request.args(0) when you should be using args[0].
>
What? this cannot be right, the request.args(0) is a standard function 
globally available for a long time, it's web2py standard. Also, where would 
the args list come from?


> For further help you need to examine the error message you're getting as 
> calling your PATCH is raising TypeError exceptions which usually means 
> something isn't getting the correct arguments.
>
As you may have read I am getting a 400 error not a 500, that means there 
is no error stack trace. 

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


Re: [web2py] Re: Controller to do SOAP to an action-less service, how to generate the (xml) nodes

2014-08-12 Thread Dave S

On Monday, August 11, 2014 9:33:38 PM UTC-7, Mariano Reingart wrote:
>
> Sorry but I don't fully understand your message. 
>
> What's the problem using pysimplesoap? 
>

What's wrong is my knowledge of how to do some funky WSDL in pysimplesoap.
  

> Can you provide an example using it (explaining wha'ts wrong)?
>

Detailing the XML seen is as close to an example as I could come.
 

> You can try to use SoapClient with ns="XYZService" and soap_server='axis' 
> (if that is your server, if not, don't need to specify it)
>
> Also, you can use "raw" requests:
>
>
> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Raw/arbitrary_SOAP_Header_Example
>
>
Ah, that's probably the piece of knowledge I was missing.  I've read that 
section before, but early on in learning pysimplesoap, and I did understand 
its usage.

 

> Hope it helps,
>
>
This does help, I think.  Thanks, I appreciate your advice and 
contributions.
 

> Best regards
>
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
>
/dps
 

> On Tue, Aug 12, 2014 at 12:58 AM, Dave S 
> > wrote:
>
>>
>>
>> On Thursday, August 7, 2014 11:05:20 AM UTC-7, Dave S wrote:
>>>
>>> From my appendage to another thread:
>>>
>>> So it's not too bad consuming a service I provide for myself, but I'm 
>>> also interested in a service provided by a third-party device.
>>>
>>>
>> I was hoping to use the controller to avoid installing a java app on a 
>> particular client.  I'm not sure I can get the user to install Python 
>> there, either, but there is no problem getting him to use a browser.  Thus 
>> a controller function to do the SOAP stuff would be very helpful, but I 
>> think I need help with the 'controller' node generation.
>>
>> Thanks.
>>
>> Dave S
>> /dps
>>  
>>
>> -- 
>> 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/d/optout.
>>
>
>

-- 
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 vs ruby on rails for a startup?

2014-08-12 Thread Dave S


On Monday, August 11, 2014 10:24:37 PM UTC-7, Massimo Di Pierro wrote:
>
> http://www.meetup.com/OWASP-OC/
>
> Are you nearby?
>

Yep, that Orange County.

/dps

-- 
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: RESTful PATCH request not working

2014-08-12 Thread Leonel Câmara
That's not exactly true, the thing is, you want the rest API to inform the 
caller if it's calling it wrong, and that's what web2py thinks it's 
happening.

Rest actions are run this way:

try:
return rest_action(*_self.args, **getattr(_self, 
'vars', {}))
except TypeError, e:
exc_type, exc_value, exc_traceback = sys.exc_info()
if len(traceback.extract_tb(exc_traceback)) == 1:
raise HTTP(400, "invalid arguments")

There you can see where the HTTP 400 comes from.  

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


Re: [web2py] Re: multiple SQLFORM.grid on tabs

2014-08-12 Thread Massimo Di Pierro
You cannot have multiple grids in one page because they use the url args to 
set their parameters. Unless you load the grid separately via ajax.

On Tuesday, 12 August 2014 02:10:38 UTC-5, Yebach wrote:
>
> Thanks for reply
>
> I get both grids but they are not in different tabs but both in the same
> and in addition, when I open view or edit option I get double view for one 
> record?
>
>
> 2014-08-11 16:58 GMT+02:00 Cliff Kachinske :
>
>> I would just use ajax or LOAD.
>>
>> If you really want to use grid, something like this might work.
>>
>> In the view:
>> 
>> {{=form_0}}
>> 
>>
>>
>> 
>> {{=form_1}}
>> 
>>
>>
>> 
>> {{=form_...}}
>> 
>>
>> In the controller:
>> def some_func():
>>
>>
>> form_0 = SQLFORM.grid(whatever)
>> form_1 = SQLFORM.grid(whatever_else)
>> form_... = SQLFORM.grod(yet_other)
>>
>>
>> return dict(form_0=form_0, form_1=form_1, form_...=form_...)
>>
>>
>>
>> On Monday, August 11, 2014 10:03:56 AM UTC-4, Yebach wrote:
>>>
>>> Hello
>>>
>>> I am trying to create a view where I have tabs and each tab has its own 
>>> view.
>>> All tabs are included into main view. lets call it settings.
>>>
>>> In settings there are tabs for user to insert workers into tables, 
>>> posts, etc etc. all the (un)necessary stuff.
>>>
>>> For each I would like to use SQLFORM.grid. It already works for 
>>> inserting workers, but how to add new ones??
>>>
>>> I guess in controller I have to create function for each table 
>>> (form.grid) and for each I have to create new view (html)??
>>>
>>> And what function to create for main view? - Basically it should show 
>>> data for workers but this way all I get is workers SQLform.grid
>>>
>>> Is this it even possible.
>>>
>>> Any guideliness would be nice
>>>
>>> Thank you
>>>
>>> some code
>>>
>>> main view 
>>>
>>> 
>>> {{=T('
>>> Delavci')}}
>>>  {{=T('Turnusi')}}
>>>  
>>>
>>> 
>>> 
>>> {{include '../views/settings/workers.html'}}
>>>  
>>> 
>>> {{include '../views/settings/turnusi.html'}}
>>>  
>>> 
>>> 
>>> 
>>> 
>>>  
>>> {{=T('Delavci')}}
>>>  {{=T('Turnusi')}}
>>> 
>>>  
>>> 
>>> 
>>>
>>> My view for workers
>>>
>>> 
>>> 
>>> {{=T('Šifrant delavcev')}}
>>>  {{=response.flash}}
>>> 
>>>  {{=grid}}
>>> 
>>> 
>>> >>
>>> my view for turnusi
>>>
>>> 
>>> 
>>>  {{=T('Šifrant turnusov')}}
>>> {{=response.flash}}
>>>  {{=grid}}
>>> 
>>> 
>>>
>>>
>>> and for both i have fucntions in controller
>>>
>>>
>>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/cB5pLIi9N6o/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Lep pozdrav 
>
> Vid Ogris
>
>
> 

-- 
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 grid select all filtred rows

2014-08-12 Thread keiser1080
Hi,

is there a way to get the query  or the list of id from a filtred grid?

for example a grid listing all students with pagination => filter data 
using the search widget of the grid  student.age > 20 
 => 2000 rows (multiple pages) =>  send data to another page or fonction ?

-- 
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: Issue 1961; redirect, response.headers and CAS

2014-08-12 Thread Massimo Di Pierro
Will do it tonight. CAS CORS compliancy is important.

On Tuesday, 12 August 2014 03:05:27 UTC-5, Remco Boerma wrote:
>
> Thanks Massimo, 
>
> Concerning https://code.google.com/p/web2py/issues/detail?id=1961&can=1 
>
> The CAS structure uses redirect() internally. Can you update the call in the 
> CAS code to send the request.headers? That's why i proposed a change on all 
> redirect calls. This allows the CAS to be CORS compliant if the user provides 
> the proper headers on the controller level 
>
> With kind regards. 
>
> Remco
>
>

-- 
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: Additional submit buttons on form

2014-08-12 Thread Stephen Weiss

I discovered that you can add a buttons list to an SQLFORM.factory call.

The last post in this question has syntax 
https://groups.google.com/forum/#!searchin/web2py/buttons/web2py/Hu8iCzOA9Lk/lJnVtBLNvK8J
 

This allows for multiple submit buttons to the same controller code and in 
there you can test which button was pressed and act accordingly.

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.


Re: [web2py] Re: Controller to do SOAP to an action-less service, how to generate the (xml) nodes

2014-08-12 Thread Dave S


On Monday, August 11, 2014 9:33:38 PM UTC-7, Mariano Reingart wrote:
>
> [...]
>
> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Raw/arbitrary_SOAP_Header_Example
>
>
Are the links to examples  there and down below in #Fixing_broken_WSDL 
out-of-date?

/dps

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


Re: [web2py] Re: multiple SQLFORM.grid on tabs

2014-08-12 Thread Vid Ogris
How can I do that? Load via Ajax?


2014-08-12 19:41 GMT+02:00 Massimo Di Pierro :

> You cannot have multiple grids in one page because they use the url args
> to set their parameters. Unless you load the grid separately via ajax.
>
>
> On Tuesday, 12 August 2014 02:10:38 UTC-5, Yebach wrote:
>>
>> Thanks for reply
>>
>> I get both grids but they are not in different tabs but both in the same
>> and in addition, when I open view or edit option I get double view for
>> one record?
>>
>>
>> 2014-08-11 16:58 GMT+02:00 Cliff Kachinske :
>>
>>> I would just use ajax or LOAD.
>>>
>>> If you really want to use grid, something like this might work.
>>>
>>> In the view:
>>> 
>>> {{=form_0}}
>>> 
>>>
>>>
>>> 
>>> {{=form_1}}
>>> 
>>>
>>>
>>> 
>>> {{=form_...}}
>>> 
>>>
>>> In the controller:
>>> def some_func():
>>>
>>>
>>> form_0 = SQLFORM.grid(whatever)
>>> form_1 = SQLFORM.grid(whatever_else)
>>> form_... = SQLFORM.grod(yet_other)
>>>
>>>
>>> return dict(form_0=form_0, form_1=form_1, form_...=form_...)
>>>
>>>
>>>
>>> On Monday, August 11, 2014 10:03:56 AM UTC-4, Yebach wrote:

 Hello

 I am trying to create a view where I have tabs and each tab has its own
 view.
 All tabs are included into main view. lets call it settings.

 In settings there are tabs for user to insert workers into tables,
 posts, etc etc. all the (un)necessary stuff.

 For each I would like to use SQLFORM.grid. It already works for
 inserting workers, but how to add new ones??

 I guess in controller I have to create function for each table
 (form.grid) and for each I have to create new view (html)??

 And what function to create for main view? - Basically it should show
 data for workers but this way all I get is workers SQLform.grid

 Is this it even possible.

 Any guideliness would be nice

 Thank you

 some code

 main view

 
 {{=T('Delavc
 i')}}
  {{=T('Turnusi')}}
  

 
 
 {{include '../views/settings/workers.html'}}
  
 
 {{include '../views/settings/turnusi.html'}}
  
 
 
 
 
  
 {{=T('Delavci')}}
  {{=T('Turnusi')}}
 
  
 
 

 My view for workers

 
 
 {{=T('Šifrant delavcev')}}
  {{=response.flash}}
 
  {{=grid}}
 
 
 >>>
 my view for turnusi

 
 
  {{=T('Šifrant turnusov')}}
 {{=response.flash}}
  {{=grid}}
 
 


 and for both i have fucntions in controller


  --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/web2py/cB5pLIi9N6o/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Lep pozdrav
>>
>> Vid Ogris
>>
>>
>>   --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/cB5pLIi9N6o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lep pozdrav

Vid Ogris

-- 
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] Record versioning without duplicate archive records?

2014-08-12 Thread Jack Kuan
Hi,

just starting out with web2py. Given a table with record versioning 
enabled, I find that for every successful update operation a row will be 
inserted in the archive table.
I'm using update_or_insert(), is it possible to make web2py only copy an 
old row into the archive table when there's a difference between the old 
row and the new row?


Thanks
Jack

-- 
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] Error in wsgi/apache

2014-08-12 Thread Nail Hassairi
I am getting errors like this:

[Mon Aug 11 16:34:23 2014] [error] [client 54.200.16.41] mod_wsgi 
(pid=23422): Exception occurred processing WSGI script 
'/home/econ/utility/web2py/wsgihandler.py'.
[Mon Aug 11 16:34:23 2014] [error] [client 54.200.16.41] IOError: failed to 
write data
[Mon Aug 11 16:37:44 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:37:49 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:37:55 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:00 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:05 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:10 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:15 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:21 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:26 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:31 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:36 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:41 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:46 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:52 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:38:57 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:39:02 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:39:07 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:39:12 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:39:18 2014] [error] [client 54.200.16.41] Script timed out 
before returning headers: wsgihandler.py
[Mon Aug 11 16:39:23 2014] [error] [client 54.200.16.41] mod_wsgi 
(pid=23422): Exception occurred processing WSGI script 
'/home/econ/utility/web2py/wsgihandler.py'.
[Mon Aug 11 16:39:23 2014] [error] [client 54.200.16.41] IOError: failed to 
write data

When this happens apache freezes and the access.log reports HTTP 408 errors:

193.174.89.19 - - [10/Aug/2014:07:38:03 +] "-" 408 0

The first time this happened the server was online and it was taken 
offline. Later on I was trying to simulate traffic
for short periods of time and this error does seem to get bigger with the 
volume of the traffic but sometimes
even large volume of traffic does not trigger it and sometimes smaller 
amount of traffic triggers it.

This seems to be demanding of the CPU resources but memory seems to be 
largely idle (top):

PID  USER  PR  NI  VIRT  RES  SHR S   %CPU %MEMTIME+  COMMAND   

  
2967econ20   0  142m   83m   16m S  60 2.1 
 41:34.55 apache2   

  
3308postgres  20   0  50036   35m   32m S 20  0.9 
10:01.85 postgres

$ free -m

>  total   used   free sharedbuffers cached
Mem:  4002953   3049  0 31662
-/+ buffers/cache:258   3743
Swap:  511  0511

But given that the server has 4 cores it appears unlikely to me that this 
would simply be a hardware resource constraint.


The above picture shows the proportion of the HTTP 408 Timeout Error of all 
HTTP requests.
Do you know what might be causing the problem?

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] Login restricted based on subscription

2014-08-12 Thread Kenneth
Hello everyone,

I'm building a site that clients subscribes to so I need to limit their 
login based on the subscription. Is there a built in feature to limit login 
to a date range?


Kenneth

-- 
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: Implementing A Large Scale Engineering Equations Calculator in web2py

2014-08-12 Thread pang
You may want to look into the Sage software (python distribution of 
scientific libraries and python goodies + a consistent interface), 
specifically the "interact" feature:

http://interact.sagemath.org/
http://wiki.sagemath.org/interact

the "sage cell server":

https://sagecell.sagemath.org/static/about.html?v=15adefe8b7e89fcf49eda7af5303abd4

and the Sage Cloud:

https://cloud.sagemath.com/

Your work could be simply to create one Sage interact like the many 
examples you can see above for any calculator you want to offer, and then 
offer the interacts to visitors. Once the structure is set, it would take 
very little effort to add new calculators (work in a local sage install to 
get the interact, then login as admin and upload the interact to the 
server).

Sage includes scientific software for almost any task, it's incredibly 
simple to add cython snippets to boost performance of critical parts of the 
code, the community is super-friendly (try sage-support, sage-devel, and/or 
ask.sagemath.org), and everything is open source. They even offer private 
sage cell clouds, so that they would do all the computation in their 
servers.

-- 
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: Login restricted based on subscription

2014-08-12 Thread Dave S


On Tuesday, August 12, 2014 1:28:11 PM UTC-7, Kenneth wrote:
>
> Hello everyone,
>
> I'm building a site that clients subscribes to so I need to limit their 
> login based on the subscription. Is there a built in feature to limit login 
> to a date range?
>
>
>
I would use the scheduler to run s periodic job (daily, perhaps) that 
checks the auth table for expiration dates that have passed, and mark those 
accounts as disabled.

/dps
 

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


Re: [web2py] Re: Controller to do SOAP to an action-less service, how to generate the (xml) nodes

2014-08-12 Thread Dave S
Hmmm, I'm not quite there yet.


  client = SoapClient(
location = ws_location,
action = ws_action, # SOAPAction
namespace = ws_namespace,
soap_ns='soap', ns = False, exceptions=True, 
http_headers={'Authorization': "Basic %s" % encoded},
trace=True)
  params =  SimpleXMLElement("""
  DON
  25 C0 F0 165531
  """)
  response = client.call('service',params)


When I run it, I get an error on the console, from rocket, presumably 
during the 'send' part of client.call():

ERROR:Rocket.Errors.Thread-2:Traceback (most recent call last):

  File "/home/david/Documents/web2py/gluon/rocket.py", line 1337, in run
self.run_app(conn)
  File "/home/david/Documents/web2py/gluon/rocket.py", line 1851, in run_app
self.write(data, sections)
  File "/home/david/Documents/web2py/gluon/rocket.py", line 1773, in write
self.conn.sendall(data)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)

TypeError: must be convertible to a buffer, not SimpleXMLElement



I believe this happening after I get past client.py line #193 (in call()), 
and in fact I think I'm at line #240. --> send() which does the HTTP 
request at line #268.

Do I need to provide a logger instance to catch all the debug info?   I am 
a novice at Python logging, being too given to just use print and watch the 
console.

/dps

-- 
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: Record versioning without duplicate archive records?

2014-08-12 Thread Massimo Di Pierro
Please open a ticket about this. It makes sense.

On Tuesday, 12 August 2014 13:41:13 UTC-5, Jack Kuan wrote:
>
> Hi,
>
> just starting out with web2py. Given a table with record versioning 
> enabled, I find that for every successful update operation a row will be 
> inserted in the archive table.
> I'm using update_or_insert(), is it possible to make web2py only copy an 
> old row into the archive table when there's a difference between the old 
> row and the new row?
>
>
> Thanks
> Jack
>
>

-- 
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: plugin_lazy_options widget

2014-08-12 Thread Jesse Ferguson
I've tried everything, I'm sure its just something easy I'm missing or its 
possibly just some needed javascript to trigger the ajax call. Anyone out 
there wanna take a look, maybe give me a hint? 
 http://dev.s-cubism.com/plugin_lazy_options_widget

-- 
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: plugin_lazy_options widget

2014-08-12 Thread Jesse Ferguson
Here is an example of what I'm trying to do...
Don't forget to install the plugins

*IN CONTROLLER*

def index():
form = SQLFORM(db.product)
if form.accepts(request.vars, session):
session.flash = 'submitted %s' % form.vars
redirect(URL('index'))
return dict(form=form,
categories=SQLTABLE(db().select(db.category.ALL)),
colors=SQLTABLE(db(db.color.id > 0)(db.color.category == 
db.category.id
).select(db.color.id, db.category.name, 
db.color.name)))

*IN MODEL*

from plugin_lazy_options_widget import lazy_options_widget
from plugin_suggest_widget import suggest_widget

db = DAL('sqlite:memory:')
db.define_table('category', Field('name'))
db.define_table('color', Field('category', db.category), Field('name'))
db.define_table('hue', Field('color', db.color), Field('name'))
db.define_table('product',
Field('category', db.category, comment='<- type "A" or "B"'),
Field('color', db.color,
  requires=IS_EMPTY_OR(IS_IN_DB(db(db.color.id > 0), 'color.id', 
'color.name', zero='---')),
  comment='<- select category first'),
Field('hue', db.hue,
  requires=IS_EMPTY_OR(IS_IN_DB(db(db.hue.id > 0), 'hue.id', 
'hue.name', zero='---')),
  comment='<- select color first'),)

db.category.bulk_insert([{'name':'A'}, {'name':'B'}])

for category in db(db.category.id > 0).select():
_id = category.id
if category.name == 'A':
db.color.bulk_insert([{'category': _id, 'name':'red'}, {'category': 
_id, 'name':'blue'}])
elif category.name == 'B':
db.color.bulk_insert([{'category': _id, 'name':'green'}])
for color in db(db.color.id > 0).select():
_id = color.id
if color.name == 'red':
db.hue.bulk_insert([{'color': _id, 'name' : 'shiny'},{'color': _id, 
'name': 'dull'}])
elif color.name == 'blue':
db.hue.bulk_insert([{'color': _id, 'name' : 'glossy'},{'color': 
_id, 'name': 'dark'}])
elif color.name == 'green':
db.hue.bulk_insert([{'color': _id, 'name' : 'opaque'},{'color': 
_id, 'name': 'light'}])

db.product.category.widget = suggest_widget(db.category.name, 
id_field=db.category.id,
  limitby=(0, 10), min_length=1)

 The core 
##
# The lazy_options_widget receives js events
# called "product_category__selected" and "product_category__unselected"
# which will be triggered by the above suggest_widget.]
# You can also pass user_signature and hmac_key arguments for authorization 
in ajax
db.product.color.widget = lazy_options_widget(
  'product_category__selected', 
'product_category__unselected',
  lambda category_id: (db.color.category == category_id),
  request.vars.category,
  orderby=db.color.id,
  # If you want to process ajax requests at the time of the 
object construction (not at the form rendered),
  # specify your target field in the following:
  field=db.product.color,
  )

db.product.hue.widget = lazy_options_widget(
  'product_color__selected', 'product_color__unselected',
  lambda color_id: (db.hue.color == color_id),
  request.vars.color,
  orderby=db.hue.id,
  # If you want to process ajax requests at the time of the 
object construction (not at the form rendered),
  # specify your target field in the following:
  field=db.product.hue,
  )




-- 
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] question about db.mytable.update_or_insert()

2014-08-12 Thread Jack Kuan
Hi,

When using  update_or_insert(), say for example:  
db.mytable.update_or_insert(q, name='test')

Let's say the query, q, results in not finding any row in mytable, is it 
possible that in another transaction in another request that when the same 
update_or_insert(...) is called that it also doesn't find any row and thus 
at the end, the two transcations both try to commit an insert, which could 
result in duplicated rows(with different id's) or an integrity error(eg, if 
there's an unique constraint)? Or is web2py smart enough to generate an 
insert that is safe?

Thanks
Jack

-- 
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: Issue 1961; redirect, response.headers and CAS

2014-08-12 Thread Massimo Di Pierro
Looking into this but I need your help. We cannot preserve all the headers 
because some of them may contain sensitive information that should not be 
sent cross domain (for example session cookies). So the question is, which 
headers should be preserved by which redirects:

There are two redirects in gluon/contrib/login_methods/cas_auth.py

There are two redirects in gluon/tools.py in Auth allow_access.

Do you know which ones need the headers? Which headers?

On Tuesday, 12 August 2014 03:05:27 UTC-5, Remco Boerma wrote:
>
> Thanks Massimo, 
>
> Concerning https://code.google.com/p/web2py/issues/detail?id=1961&can=1 
>
> The CAS structure uses redirect() internally. Can you update the call in the 
> CAS code to send the request.headers? That's why i proposed a change on all 
> redirect calls. This allows the CAS to be CORS compliant if the user provides 
> the proper headers on the controller level 
>
> With kind regards. 
>
> Remco
>
>

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


Re: [web2py] web2py grid select all filtred rows

2014-08-12 Thread Manuele Pesenti
Il 12/08/14 19:42, keiser1080 ha scritto:
> Hi,
>
> is there a way to get the query  or the list of id from a filtred grid?
>
> for example a grid listing all students with pagination => filter data
> using the search widget of the grid  student.age > 20 
>  => 2000 rows (multiple pages) =>  send data to another page or fonction ?
Resulting rows you see in grid are saved in attribute "rows" of your
grid object.
Does this help you?

M.

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