View Single Post
Old 01-12-2022, 05:16 AM   #282
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,529
Karma: 8075744
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question: When using a stored template that returns 'True' if it matches certain criteria (psuedobools), I noticed these work the same:

Code:
program:
	if stored_returnstrueifvalid() == 'True' then 'output' fi
Code:
program:
	if stored_returnstrueifvalid() then 'output' fi
When do I need I keep the "== 'True'" bit?
A conditional expression is False if it evaluates to the empty string, otherwise it is True. As such you don't need the == 'True' part if the stored template return that or the empty string.
Quote:
Also, is there any good way to test two templates getting same results on a set of books aside from shuffling it between the tester and Notepad? I don't believe there's a way to have two tester instances open.
Some ways:
  • You could use calibre-debug -g to have a cmd window, then use the template print() to show values in that window.
  • If they are stored templates then you can compare their results in a third template.
  • You can create a few extra composite columns and compare the values stored in the columns.

Last edited by chaley; 01-22-2022 at 04:45 PM. Reason: Grammar
chaley is offline   Reply With Quote