I use c.executeScript() in several programs.  Revision 551016a5 by vitalije 
broke them.  I am using c.executeScript() to execute a node body that 
begins with "@language python" yet I get the ""no script selected" error 
message in the log pane.
I have not yet looked into g.getScript(), but if the spaghetti-code 
"c._allow_script_selection_by_language_directive = True" correctly 
indicates the intention of the change, why did this break my code?

551016a5 (vitalije       2017-07-13 23:09:37 +0200 932)             try:
> 551016a5 (vitalije       2017-07-13 23:09:37 +0200 933)                 
> c._allow_script_selection_by_language_directive = True
> 551016a5 (vitalije       2017-07-13 23:09:37 +0200 934)                 
> script = g.getScript(c, p or c.p, useSelectedText=useSelectedText)
> 551016a5 (vitalije       2017-07-13 23:09:37 +0200 935)             
> finally:
> 551016a5 (vitalije       2017-07-13 23:09:37 +0200 936)                 
> del c._allow_script_selection_by_language_directive
>
>  git diff 2443ff3b6a3b2ef49d1b8b4553e4c55e056aabb5 leo/core/leoCommands.py
> diff --git a/leo/core/leoCommands.py b/leo/core/leoCommands.py
> index f35032c..a6458cd 100755
> --- a/leo/core/leoCommands.py
> +++ b/leo/core/leoCommands.py
> @@ -929,7 +929,11 @@ class Commands(object):
>          if not script:
>              if c.forceExecuteEntireBody:
>                  useSelectedText = False
> -            script = g.getScript(c, p or c.p, 
> useSelectedText=useSelectedText)
> +            try:
> +                c._allow_script_selection_by_language_directive = True
> +                script = g.getScript(c, p or c.p, 
> useSelectedText=useSelectedText)
> +            finally:
> +                del c._allow_script_selection_by_language_directive
>          script_p = p or c.p
>              # Only for error reporting below.
>          self.redirectScriptOutput()
> 2017-07-18 11:56:53 /pri/git/leo-editor
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to