TACTIC Open Source
Error in view using advanced grouping - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Error in view using advanced grouping (/showthread.php?tid=64)

Pages: 1 2


Error in view using advanced grouping - dankitchen - 12-27-2019

Hey All,

In a table view, I tried grouping based on a related column, I am locked out of the view now with the stack trace below.  I had a look in the widget config to see if there was a saved search I could edit/remove to allow access to the view but doesn't seem to be one.  Is there somewhere else the applied grouping would be saved/cached? I am running on FC30 and pulled from git today)

thanks!
-Dan

[b]Error: argument should be integer or bytes-like object, not 'str'[/b]

  File "/opt/tactic/tactic/src/pyasm/prod/service/api_xmlrpc.py", line 5401, in get_widget
    html = widget.get_buffer_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 480, in get_buffer_display
    buffer = self.get_buffer(cls)
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 471, in get_buffer
    self.explicit_display(cls)
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 438, in explicit_display
    widget = child.get_display()
  File "/opt/tactic/tactic/src/pyasm/web/html_wdg.py", line 807, in get_display
    super(HtmlElement,self).get_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 459, in get_display
    widget.explicit_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 438, in explicit_display
    widget = child.get_display()
  File "/opt/tactic/tactic/src/pyasm/web/html_wdg.py", line 807, in get_display
    super(HtmlElement,self).get_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 459, in get_display
    widget.explicit_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 429, in explicit_display
    child = self.get_display()
  File "/opt/tactic/tactic/src/pyasm/web/html_wdg.py", line 807, in get_display
    super(HtmlElement,self).get_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 459, in get_display
    widget.explicit_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 429, in explicit_display
    child = self.get_display()
  File "/opt/tactic/tactic/src/pyasm/web/html_wdg.py", line 807, in get_display
    super(HtmlElement,self).get_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 459, in get_display
    widget.explicit_display()
  File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 429, in explicit_display
    child = self.get_display()
  File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 1258, in get_display
    self.handle_groups(table, row, sobject)
  File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 2731, in handle_groups
    if group_value.find("/"):


Just a note that I found that the searches are saved in the Widget Settings table. Removing the entry for my Search Type removed the issue for now. I am sure if I tried to group again I would likely get the same error.


RE: Error in view using advanced grouping - remkonoteboom - 12-27-2019

This is a bug related to Python3, I believe.

Not sure how this line produces this error:

if group_value.find("/"):

Do you know what the value of "group_value" was? Or what type it was?


RE: Error in view using advanced grouping - dankitchen - 12-28-2019

I should have grabbed this config on the last pass, let me know if this helps? If I delete this widget settings entry the error clears up

[{"prefix": "filter_mode", "filter_mode": "and"}, {"prefix": "custom", "custom_enabled": "on", "filter_type": "_column", "custom_column": ""}, {"prefix": "main_body", "main_body_enabled": "on", "filter_type": "_column", "main_body_column": "", "main_body_relation": "is", "main_body_value": ""}, {"prefix": "search_ops", "levels": [], "ops": [], "modes": []}, {"prefix": "keyword", "value": ""}, {"prefix": "search_limit", "Prev": "", "Showing": "1 - 65", "Next": "", "search_limit": "", "limit_select": "100", "custom_limit": "", "Showing_last_search_offset": "0"}, {"prefix": "group", "group": "building", "interval": "", "order": "", "show_retired": ""}]


RE: Error in view using advanced grouping - remkonoteboom - 12-28-2019

What is the data type of the column "building"? It may be something that the grouping can't handle.

Also, if you are in debug mode, can you print this:

print("group_value: ", type(group_value), group_value)

just before the following line:

File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 2731, in handle_groups
if group_value.find("/"):


RE: Error in view using advanced grouping - dankitchen - 01-07-2020

I added the line of code and started in dev mode but, I think I might be getting a different error. When I try to group on the building column (which is a related column, the table is lpc/tenant as a child to lpc/building)

ticket: 161dfa0890e97d4700c
( 'tactic.ui.panel.table_layout_wdg.FastTableLayoutWdg',
{ 'args': { 'badge_view': '',
'base_dir': '',
'checkin_context': '',
'checkin_type': '',
'column_widths': [ 168,
210,
112,
100,
116,
138,
100,
100,
100,
134],
'custom_search_view': '',
'custom_views': '{}',
'default_data': '',
'do_initial_search': '',
'do_search': 'true',
'edit_view': '',
'element_names': [ 'building',
'name',
'code',
'accountnumber',
'unit',
'monthly_total_charges',
'recession_rating',
'primary_email',
'primary_name',
'primary_phone'],
'expression': '',
'extra_columns': '',
'extra_data': '',
'extra_keys': 'select_color,js_load,extra_columns',
'file_system_edit': '',
'filter_view': '',
'gear_settings': '',
'group_elements': '',
'height': '',
'ingest_custom_view': '',
'ingest_data_view': '',
'init_load_num': '',
'insert_view': '',
'is_refresh': 'true',
'js_load': '',
'mode': 'widget',
'no_results_msg': '',
'order_by': '',
'parent_key': '',
'parent_mode': '',
'search_class': '',
'search_dialog_id': 'dialog3339',
'search_key': '',
'search_keys': [],
'search_limit': '',
'search_limit_mode': '',
'search_type': 'lpc/tenant',
'search_view': 'link_search:tenant_export',
'select_color': '',
'settings': '',
'shelf_view': '',
'show_border': '',
'show_collection_tool': '',
'show_column_manager': '',
'show_context_menu': '',
'show_expand': '',
'show_gear': '',
'show_help': '',
'show_insert': '',
'show_keyword_search': '',
'show_layout_switcher': '',
'show_search': 'true',
'show_search_limit': '',
'show_select': '',
'show_shelf': '',
'simple_search_config': '',
'simple_search_mode': '',
'simple_search_view': '',
'state': '{}',
'table_id': 'main_body_table_4017',
'view': 'tenant_export',
'view_attrs': "{'layout': 'TableLayoutWdg'}"},
'libraries': { 'spt_button': True,
'spt_calendar': True,
'spt_help': True,
'spt_html5upload': True,
'spt_icon_button': True,
'spt_popup': True,
'spt_tab': True,
'spt_table': True,
'spt_view_panel': True},
'values': { 'json': '[{"prefix":"filter_mode","filter_mode":"and"},{"prefix":"custom","custom_enabled":"","filter_type":"_column","custom_column":""},{"prefix":"main_body","main_body_enabled":"","filter_type":"_column","main_body_column":"recession_rating","main_body_relation":"is '
'greater '
'than","main_body_value":"3"},{"prefix":"main_body","main_body_enabled":"","filter_type":"building","main_body_column":"","main_body_relation":"is","main_body_value":""},{"prefix":"main_body","main_body_enabled":"","filter_type":"_related","main_body_search_type":"","main_body_column":"","main_body_relation":"is","main_body_value":""},{"prefix":"search_ops","levels":[0,0],"ops":["and","and"],"modes":["child","child"]},{"prefix":"keyword","value":""},{"prefix":"search_limit","Prev":"","Showing":"1 '
'- '
'66","Next":"","search_limit":"","limit_select":"100","custom_limit":"","Showing_last_search_offset":"0"},{"prefix":"group","group":"building","interval":"","order":"","show_retired":""}]'}})
--------------------------------------------------
From ExceptionLog.log
--------------------------------------------------
File "/opt/tactic/tactic/src/pyasm/prod/service/api_xmlrpc.py", line 5401, in get_widget
html = widget.get_buffer_display()
File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 480, in get_buffer_display
buffer = self.get_buffer(cls)
File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 471, in get_buffer
self.explicit_display(cls)
File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 429, in explicit_display
child = self.get_display()
File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 612, in get_display
self.sobjects = self.order_sobjects(self.sobjects, self.group_columns)
File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 1639, in order_sobjects
sobjects = Common.sort_dict(self.group_dict, reverse=reverse)
File "/opt/tactic/tactic/src/pyasm/common/common.py", line 687, in sort_dict
keys.sort(reverse=reverse)

'<' not supported between instances of 'str' and 'bytes'
--------------------------------------------------
Duration: 0.249 seconds (request_id: 140466249242368 - #0000007)
Memory: 76492 KB
Increment: 364 KB


RE: Error in view using advanced grouping - remkonoteboom - 01-07-2020

It seems Python 3 doesn't sort lists with mixed types. Python 2 had no problem handling this, properly even. Not sure why they "broke" this.

I had fixed this in another branch, but you could copy the hacky fix to your branch:

https://github.com/remkonoteboom/TACTIC-DEV/commit/f330a53253043b24e662136fbaf606aaa8efa7cf


RE: Error in view using advanced grouping - dankitchen - 01-07-2020

I tried copying the fix over to my server and it got a little further, here is the current output


WARNING: sorting error: '<' not supported between instances of 'str' and 'bytes'
TextWdg: __init__() got an unexpected keyword argument 'hint'
group_value: <class 'bytes'> b'Bank of Nova Scotia'
group_value: <class 'bytes'> b'Bank of Nova Scotia'
group_value: <class 'bytes'> b'Bank of Nova Scotia'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Hunt St Plaza'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kawatha Heights'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'bytes'> b'Kent Place'
group_value: <class 'str'> __NONE__
--------------------------------------------------
From ExceptionLog.log
--------------------------------------------------
File "/opt/tactic/tactic/src/pyasm/prod/service/api_xmlrpc.py", line 5401, in get_widget
html = widget.get_buffer_display()
File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 480, in get_buffer_display
buffer = self.get_buffer(cls)
File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 471, in get_buffer
self.explicit_display(cls)
File "/opt/tactic/tactic/src/pyasm/web/widget.py", line 429, in explicit_display
child = self.get_display()
File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 1258, in get_display
self.handle_groups(table, row, sobject)
File "/opt/tactic/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 2734, in handle_groups
if isinstance(group_value, six.string_types) and group_values.find("/"):

'dict' object has no attribute 'find'
--------------------------------------------------
Duration: 0.472 seconds (request_id: 139758814611200 - #0000008)
Memory: 79888 KB
Increment: 1216 KB


RE: Error in view using advanced grouping - remkonoteboom - 01-08-2020

The line was:

if isinstance(group_value, six.string_types) and group_value.find("/"):

You put an extra "s" on "group_value".


RE: Error in view using advanced grouping - dankitchen - 01-08-2020

My bad, that did it. Thanks :-)


RE: Error in view using advanced grouping - dankitchen - 01-14-2020

As an extension to this, when I try to collapse the groups the folder icon reacts but the groups don't collapse. I am not sure if this has something to do with the fix above. I am not getting any JS errors in the console.

My overall goal was to ask if there is a way to load a table with the groups collapsed by default but figured I need to get it working first.

thanks!
-Dan