TypeError in adding resource

23 views
Skip to first unread message

John Tsui

unread,
Jun 27, 2022, 4:58:13 AM6/27/22
to schedulix
Hi Ronald,

I am trying on schedulix 2.10 and schedulix-zope-2.10-13.el8
Upon adding resource control on a cyclic job,
it works fine, the same job will be skip while another one is executing

Except there are Zope Error prompt when looking at details "Job Definitions" tab

javascript:DummySubmitEditorDisplay('JOB_DEFINITIONS')

Zope has encountered an error while publishing this resource.

Error Type: TypeError
Error Value: cannot concatenate 'str' and 'NoneType' objects

Is there any other item I am missing on the configuration?

Thanks in advance.
John Tsui
27.Jun.2022Untitled.png

Ronald Jeninga

unread,
Jun 27, 2022, 5:31:42 AM6/27/22
to schedulix
Hi John, 

the way it looks it is most likely a problem within the GUI.
It is hard to find the problem just based on the error message, but fortunately you can retrieve the stack trace.
In order to do so, you open the Zope management interface (http://172.x.y.z:8080/manage) and look for the entry error_log (it is marked with a red circle and a diagonal cross in it).
You click on it and you'll get a list of the most recent exceptions, one of which will be the type error.
After clicking on the headline, you'll find the stack trace.

Now if you send me the stack trace, or post it here, I'll be able to find the cause of the problem.

Thank you,

Ronald

John Tsui

unread,
Jun 27, 2022, 9:16:21 PM6/27/22
to schedulix
Hi Ronald,

Nice to know that it can be trace.
Please find the attachment captured from print screen.

Thanks a lot.
John Tsui
28.Jun.2022

ronald....@independit.de 在 2022年6月27日 星期一下午5:31:42 [UTC+8] 的信中寫道:
TypeError.txt

Ronald Jeninga

unread,
Jun 28, 2022, 3:46:31 AM6/28/22
to schedulix
Hi John,

thank you very much for the stack trace!
Dieter has already found the culprit and fixed it in our dev environment for the current development release, as well as 2.10.
A backport to 2.9, if necessary, shouldn't be magic.

What release are you using?
I'll create new rpms for all releases starting with the release you are using.
It'll take a day or so though.

Best regards,

Ronald

Ronald Jeninga

unread,
Jun 28, 2022, 5:25:27 AM6/28/22
to schedulix
Hi John,

Below you see the patch code that applies to the current development release.
The line numbers are probably similar in your release (somewhere near line 65). Hence you should be able to fix it yourself and you don't have to wait until I've finally created those rpms.

ronald@oncilla:~/SDMS-master$ git diff 1be92d701a3f5ea3d494008c81808c0e35f213b4 ZOPE/SDMS/SDMSDesigner/NamedResource/JobDefinitionSelectorRenderer
diff --git a/ZOPE/SDMS/SDMSDesigner/NamedResource/JobDefinitionSelectorRenderer b/ZOPE/SDMS/SDMSDesigner/NamedResource/JobDefinitionSelectorRenderer
index 1edcbf76..e025934c 100644
--- a/ZOPE/SDMS/SDMSDesigner/NamedResource/JobDefinitionSelectorRenderer
+++ b/ZOPE/SDMS/SDMSDesigner/NamedResource/JobDefinitionSelectorRenderer
@@ -65,10 +65,14 @@ else:
 if expired_amount in ['NONE', None]:
     expired_amount = ''
     expired_base = ''
+
+if resource_state_mapping in ['NONE', None]:
+    resource_state_mapping = ''
+    
 html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" nowrap align="right">&nbsp;' + context.Common.Util.translate(context, amount, context.REQUEST['LANG'])
 html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" align="center" nowrap>&nbsp;' + context.Common.Util.translate(context, keep_mode, context.REQUEST['LANG'])
 html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" align="center" nowrap>&nbsp;' + context.Common.Util.translate(context, is_sticky, context.REQUEST['LANG'])
-html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" nowrap>&nbsp;' + context.Common.Util.translate(context, resource_state_mapping, context.REQUEST['LANG'])
+html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" nowrap>&nbsp;' + resource_state_mapping
 html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" nowrap align="right">&nbsp;' + expired_amount
 html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" nowrap>&nbsp;' + context.Common.Util.translate(context, expired_base, context.REQUEST['LANG'])
 html = html + '&nbsp;</TD><TD width="100%" id="sdms_def" align="center" nowrap align="center">&nbsp;' + context.Common.Util.translate(context, lockmode, context.REQUEST['LANG'])


How to patch?
First you open Zope's management interface (http://someaddress:8080/manage).
You'll find a list of objects, one of them called SDMS. You click on the name, and proceed to do so with SDMSDesigner and NamedResource.
Then you open the script JobDefinitionSelectorRenderer and make the above changes (the variable resource_state_mapping is set to empty string if it is None), and instead of trying to translate the name, only the name is added to the output.
(IOW: remove the red lines, add the green lines).

Note that the Zope Web Editor doesn't know anything about line numbers. Finding line 65 is somewhat awkward.
(You could copy and paste the text into a real editor, and copy and paste it back after the change).

After saving it, your system is fixed.

Best regards,

Ronald


John Tsui

unread,
Jun 29, 2022, 2:43:19 AM6/29/22
to schedulix
Dear Ronald,

The fix is success
But I found line 56 also need to make change
from
     if expired_amount == 'NONE':
to
     if expired_amount in ['NONE', None]:

Thank you very much for the help.

Best Regards and have good days.
John Tsui
29.Jun.2022
ronald....@independit.de 在 2022年6月28日 星期二下午5:25:27 [UTC+8] 的信中寫道:

Ronald Jeninga

unread,
Jun 29, 2022, 2:58:49 AM6/29/22
to schedulix
Hi John,

thank you for the feedback! I'm glad the fix helped, and I'm delighted about your suggestion!
I'll fix that as well.

Best regards,

Ronald

Reply all
Reply to author
Forward
0 new messages