File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
pyrevitlib/pyrevit/output Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
"""Handle creation of output window helper links."""
2
2
3
3
from pyrevit .compat import safe_strtype , get_elementid_value_func
4
- from pyrevit import DB
5
4
from pyrevit .coreutils .logger import get_logger
6
5
7
6
@@ -63,7 +62,21 @@ def make_link(element_ids, contents=None):
63
62
link_title = ', ' .join (strids )
64
63
65
64
if len (reviturl ) >= 2000 :
66
- alertjs = 'alert("Url was too long and discarded!");'
65
+ total_length = 0
66
+ max_elements = 0
67
+ elementquery_parts = ['element[]=' + strid for strid in strids ]
68
+ for i , part in enumerate (elementquery_parts ):
69
+ if i > 0 :
70
+ total_length += 1 # for '&'
71
+ total_length += len (part )
72
+ if total_length >= 2000 :
73
+ break
74
+ max_elements += 1
75
+
76
+ alertjs = \
77
+ 'alert("URL was too long ({} characters). Maximum allowed is 2000. ' \
78
+ 'Only {} out of {} elements could fit.");' \
79
+ .format (len (reviturl ), max_elements , len (strids ))
67
80
linkattrs_select = 'href="#" onClick="{}"' .format (alertjs )
68
81
linkattrs_show = linkattrs_select
69
82
else :
You can’t perform that action at this time.
0 commit comments