Re: Modification in version 2.14.6 not documented ?

47 views
Skip to first unread message

Anthony

unread,
Jun 6, 2016, 11:43:23 AM6/6/16
to web2py-users, web2py-developers
Issue submitted with proposed fix: https://github.com/web2py/web2py/issues/1351

On Monday, June 6, 2016 at 11:23:10 AM UTC-4, Anthony wrote:
I see. With smartgrid, you can pass through any of the standard grid parameters to the grid, and there is an option to specify any of those parameters as a dictionary with table names as keys. The problem is that the code simply checks whether each kwarg is a dictionary, assuming if it is, it must be a dictionary whose keys are table names. However, some of the parameters themselves are supposed to be dictionaries, as in this case, so the code in question mistakenly deletes the parameter rather than allowing it to pass through unchanged.

Thanks for pointing this out. I'll file an issue.

Anthony

On Monday, June 6, 2016 at 8:57:58 AM UTC-4, omicron wrote:
I want to believe you, but in version 2.13.4 the code for smatgrid is
        # filter out data info for displayed table
       
if table._tablename in constraints:
            query
= query & constraints[table._tablename]
       
if isinstance(links, dict):
            links
= links.get(table._tablename, [])
       
for key in 'columns,orderby,searchable,sortable,paginate,deletable,editable,details,selectable,create,fields'.split(','):
           
if isinstance(kwargs.get(key, None), dict):
               
if table._tablename in kwargs[key]:
                    kwargs
[key] = kwargs[key][table._tablename]
               
else:
                   
del kwargs[key]
        check
= {}

and in 2.14.6 I see :
        # filter out data info for displayed table
       
if table._tablename in constraints:
            query
= query & constraints[table._tablename]
       
if isinstance(links, dict):
            links
= links.get(table._tablename, [])
       
for key in ('fields', 'field_id', 'left', 'headers', 'orderby', 'groupby', 'searchable',
                   
'sortable', 'paginate', 'deletable', 'editable', 'details', 'selectable',
                   
'create', 'csv', 'links', 'links_in_grid', 'upload', 'maxtextlengths',
                   
'maxtextlength', 'onvalidation', 'onfailure', 'oncreate', 'onupdate',
                   
'ondelete', 'sorter_icons', 'ui', 'showbuttontext', '_class', 'formname',
                   
'search_widget', 'advanced_search', 'ignore_rw', 'formstyle', 'exportclasses',
                   
'formargs', 'createargs', 'editargs', 'viewargs', 'selectable_submit_button',
                   
'buttons_placement', 'links_placement', 'noconfirm', 'cache_count', 'client_side_delete',
                   
'ignore_common_filters', 'auto_pagination', 'use_cursor'
                   
):
           
if isinstance(kwargs.get(key, None), dict):
               
if table._tablename in kwargs[key]:
                    kwargs
[key] = kwargs[key][table._tablename]
               
else:
                   
del kwargs[key]
        check
= {}

So, to hide the export buttons I must adapt my controller between this 2 versions. If not, where i am wrong ?

Le vendredi 3 juin 2016 22:11:46 UTC+2, Anthony a écrit :
The documentation you quote is for SQLFORM.grid, but you are using SQLFORM.smartgrid, which lets you use most of the grid parameters, but within a dictionary keyed for each table of the smartgrid. Nothing has changed.

Anthony

On Friday, June 3, 2016 at 3:33:36 PM UTC-4, omicron wrote:
It's on smartgrid for my application

Le vendredi 3 juin 2016 20:24:41 UTC+2, Niphlod a écrit :
is this on grid or smartgrid ?

On Friday, June 3, 2016 at 7:15:33 PM UTC+2, omicron wrote:
I have just seen this modification for parameter 'exportclasses' in grids. The manual say "If you pass a dict like
dict(xml=False, html=False)

you will disable the xml and html export formats", but with the last version you must change you code to pass a dict like this
dict(tablename = dict(xml=False, html=False))


And it's the same for other dicts options like "maxtextlength" for example.


Leonel Câmara

unread,
Jun 7, 2016, 9:23:18 AM6/7/16
to web2py-developers, web...@googlegroups.com
I did this to fix an issue where some of the grid options were not being passed by smartgrid, I'm sorry I'll see about fixing it. 
Reply all
Reply to author
Forward
0 new messages