Smartgrid, grid export control works on Linux, but not on Windows Server

73 views
Skip to first unread message

Seth J

unread,
Jun 7, 2017, 4:41:38 PM6/7/17
to web2py-users
I am experiencing a peculiar issue with smartgrid and grid.  I have web2py installed on Apache/2.2.15 (Red Hat)  and everything works as it supposed to with respect to disabling export options:

title_grid = SQLFORM.smartgrid(db.title, linked_tables = ['title_archive'], links=title_links, editable= dict(title=True, title_archive=False), deletable= dict(title=True, title_archive=False), create= dict(title=True, title_archive=False), user_signature=True, details=False, showbuttontext=True, paginate=30, maxtextlengths={'title.f_title_desc':50}, exportclasses=dict(csv_with_hidden_cols=False, xml=False, html=False, tsv_with_hidden_cols=False, json=False), orderby=orderby, divider="»", formname='title_grid')

Here's a screenshot of it:

However, when the same exact application is installed on web2py 2.14.5-stable+timestamp.2016.04.14.03.26.16
(Running on Microsoft-IIS/8.5, Python 2.7.10)   I get the full Export option regardless of the disabled options:


Is there something I am missing or something can be done to enable control over Export options? Thanks!!!

Anthony

unread,
Jun 7, 2017, 11:13:47 PM6/7/17
to web2py-users
There's nothing in the relevant framework code that would cause different behavior based on the OS or web server, so likely there is some other difference in your app code between the two systems.

Anthony

Seth J

unread,
Jun 8, 2017, 12:27:31 AM6/8/17
to web2py-users
That's the thing! There's no difference in my code, apart from connecting to different database. Controller and view are exactly the same. Same behavior is exhibited by all other controllers/views (about 10 in total).
I am not saying that there's an error in framework. Apps created on Win Server installation of web2py hide unneeded export options just fine.
It's just this app that was originally done on Linux, 2.13 web2py, 2.6 python; when packed and installed on Win Server running web2py does not respond to disabling selected export options.

I am at a loss how to even debig this problem?! 🤷🏼

Anthony

unread,
Jun 8, 2017, 12:40:45 AM6/8/17
to web2py-users
Did you compile the app? If so, after making changes you must re-compile, as changes you make to the source files will otherwise have no effect.

Anthony

Seth J

unread,
Jun 8, 2017, 1:11:10 AM6/8/17
to web2py-users
Neah, I never compile my apps for that very reason.

Anthony

unread,
Jun 8, 2017, 8:20:24 AM6/8/17
to web2py-users
So, (a) on Linux, the export buttons are properly hidden, (b) on Windows, if you create a new app, again, the export buttons are properly hidden, but (c) if you pack an app from Linux and simply copy it to Windows, the export buttons that were hidden on Linux suddenly appear on Windows?

I can't think if anything that would cause that behavior, and it would be hard to diagnose without interacting directly with the system.

Anthony

Anthony

unread,
Jun 8, 2017, 8:38:52 AM6/8/17
to web2py-users
If you'd like, feel free to attach a packed app that exhibits this behavior (it should use SQLite as the db).

Seth J

unread,
Jun 8, 2017, 4:44:11 PM6/8/17
to web2py-users
I wish I could do that, but it's government code.  Security issues, etc.  I was just inquiring on how one would troubleshoot something like that?!?!  May be it's related to a theme somehow?!?!

Anthony

unread,
Jun 8, 2017, 5:01:37 PM6/8/17
to web2py-users
You don't have to share the actual app, just create a minimal application that reproduces the problem.

Seth J

unread,
Jun 9, 2017, 11:33:01 AM6/9/17
to web2py-users
Sorry, didn't think of it that way.  I'm attaching a minimal app that has two tables.  You'll need to create an account (sign up).  After that you can see this issue in "Title" page (via top menu).  Let me know what you think and if it works on your end.  I really appreciate it!
web2py.app.CFPdebug.w2p

Jim S

unread,
Jun 9, 2017, 2:37:20 PM6/9/17
to web2py-users
You need to tell it which table you're referencing:

title_grid = SQLFORM.smartgrid(db.title, linked_tables=['title_archive'], links=title_links,
editable=dict(title=True, title_archive=False),
deletable=dict(title=True, title_archive=False),
create=dict(title=True, title_archive=False), user_signature=True, details=False,
                               showbuttontext=True, paginate=30, maxtextlengths={'title.f_title_desc': 50},
                               exportclasses=dict(title=dict(csv_with_hidden_cols=False, xml=False, html=False,
tsv_with_hidden_cols=False, json=False)), orderby=orderby,
                               divider="»", formname='title_grid')

-Jim

Seth J

unread,
Jun 9, 2017, 2:40:52 PM6/9/17
to web2py-users
Can you be more specific?  I thought "title=dict(..." is reference enough?!?! 🤔

Jim S

unread,
Jun 9, 2017, 2:43:45 PM6/9/17
to web2py-users
Sorry, I'm not sure what you're referencing...  Can you give me a line number in default.py?

-Jim

Seth J

unread,
Jun 9, 2017, 2:47:20 PM6/9/17
to web2py-users
My bad!!! I thought you were referencing my code there!  Thanks a lot!!! That solved the problem!!!  👍

Jim S

unread,
Jun 9, 2017, 2:53:23 PM6/9/17
to web2py-users
Glad to hear.  Doesn't answer the question of why it is different between windows and linux, but does get it working.

Have a great weekend.

-Jim

Anthony

unread,
Jun 9, 2017, 3:49:12 PM6/9/17
to web2py-users
Hmm, thought you said you were running the exact same code on both servers as well as in new apps on the Windows server, and the only thing that wasn't working was the packed app moved from Linux to Windows. But looks like your code itself is wrong, so must not have been the same in the other apps.

Seth J

unread,
Jun 9, 2017, 3:58:50 PM6/9/17
to web2py-users
It IS exactly the same! It controlled export just fine with the attached code on Linux, but did NOT on Win IIS. It is still a mystery to me and, apparently, Jim.

Seth J

unread,
Jun 9, 2017, 4:03:09 PM6/9/17
to web2py-users
As a matter of fact, I've never specified a table for export control on any of my other apps written from scratch even on IIS and never had a problem.  It's just that particular app, for some reason, requires table name.


On Friday, June 9, 2017 at 3:49:12 PM UTC-4, Anthony wrote:

Anthony

unread,
Jun 9, 2017, 7:01:14 PM6/9/17
to web2py-users
On Friday, June 9, 2017 at 4:03:09 PM UTC-4, Seth J wrote:
As a matter of fact, I've never specified a table for export control on any of my other apps written from scratch even on IIS and never had a problem.  It's just that particular app, for some reason, requires table name.

No, that's not possible. I think your original code worked with an earlier version of web2py, which may explain the difference between the Linux and Windows machines, but you also said if you created a brand new app on the Windows machine the same code would work, which cannot be the case, as the current version of web2py requires specifying the table names with the exportclasses argument of smartgrid.

Anthony

Seth J

unread,
Jun 9, 2017, 7:25:28 PM6/9/17
to web2py-users
Yes, two versions are different.  It seems to be the culprit here.  Linux has a 2.13.3   version (I think I mentioned it above somewhere).  IIS has the latest 2.14.5 on it.  Thanks!
Reply all
Reply to author
Forward
0 new messages