0
341 次瀏覽

This morning I did S/R on a colleagues project (MumUni) and the S/R report said I had changed Properties and Settings. That surprised me since I never change settings on that project, even though I am an Administrator for the project. Using the Hg Workbench tool, I was able to determine that Paratext had added three properties to settings.xml when I ran a Python script from in the cms folder a few days ago using Checking > Advanced on the menu.

Prior to this morning, I had not done S/R on the project for a week or so, so when I did S/R this morning my version of settings.xml with week old properties and three new ones, overwrote legitimate changes my colleague made 9 hours previously.

Further testing has shown that whenever I run a Python script from the Checking > Advanced menu, if I click on the Options button and change any of the options, the changes get recorded in settings.xml of the project, if I am an Administrator of the project. If I am an Observer, settings.xml remains unchanged. This behavior occurs when any script, regardless of whether it is a script I wrote or one pre-installed with PT8.

I like the feature of Paratext of storing user choices for options for the Advanced Checks between sessions, but it is too dangerous to store them in settings.xml, because of the damage that can occur.

I am Paratext [Phone Removed]under Windows 10.

舊文章 - 以原文顯示
Paratext (129 點) 提出
已重新顯示 | 341 次瀏覽

2 個回答

0
最佳回答

I think that when Python scripts were first developed, storing options in settings.xml was a reasonable decision. However, most of the original scripts have been replaced by more robust tools elsewhere in Paratext, so the role of Python scripts has changed.

You expressed a parallel between text and script options. I would like you to consider that there are several significant differences between the options on a Python script and scripture text.

  • Scripture text is relevant to the entire team and supposed to last a long time. Options on a Python script are mostly view options that affect only what is to appear in a report and are relevant only to one person, and only for the short length of time they are doing a particular task. The options have no long term significance.

  • Scripture text can only be changed by the user assigned to the text. Python script options can be changed by anybody except an Observer. If multiple people change a scripture text, Paratext gives a warning, and provides a way for users to resolve the conflict. If there is a conflict when multiple users change settings.xml at the same time, there is no warning given to the users. Not only that, but ordinary users have no what of even identifying what the conflict is. I only discovered a conflict by happenstance because I was using TortoiseHg workbench.

  • The granularity of a change set for Scripture text is a single verse, so that multiple users can make changes to the same chapter without causing conflicts, as long as they don’t change the same verse. With settings.xml, the granularity is the entire file. If anyone changes a single setting in the file, the who file is replaced.

  • Paratext developers have already recognized that there is a difference between permanent data and view preferences of a user, because things like window layouts and what a user last searched for are stored somewhere else besides settings.xml.

From another perspective, storing Python script options in settings.xml exposes a serious vulnerability to critical properties. A script coder can name an option anything including “language” or “StyleSheet”. If the script coder names one of his options the same as one property names already being used in settings.xml, the script can change the value of a critical property like “language” or “StyleSheet”.

I would like to propose a simple solution that should be fairly easy to implement. Currently, when an Observer runs a Python script, Paratext keeps their choices of options in memory as long as Paratext is open, but not in settings.xml. So as long as the user doesn’t close Paratext, his/her options are remembered, which is long enough for most uses of Python scripts. The solution is to treat Administrators, Translators, and Consultants the same as Observers. This change should be fairly easy to make, and would make using the scripts a lot safer.

舊文章 - 以原文顯示
(129 點) 提出

Sorry, this is incorrect. The granularity is each individual setting. A setting can conflict with a change to the same setting, but a change to another setting will not conflict.

Hopefully, the creator of the script is smarter than that.

Scripts are all considered unsafe - they have the ability to change anything in the project. That’s why they are considered an advanced feature and should only be done by very savvy users.

I’m sorry if it sounds like I’m fighting your suggestions/complaints, but requests for changes in features like this would need to be reviewed and prioritized before the changes are made. Based on what I know of our development workload, that Python scripts are considered an advanced feature, and the fact that no one else is complaining about them, I would guess any change would be a relatively low priority.

舊文章 - 以原文顯示

I see your point. Thank you for being patient with me.

舊文章 - 以原文顯示
0

This is by-design. If you have multiple administrators changing the same settings on a given Python script, you will get conflicts same as when multiple people change the text.

舊文章 - 以原文顯示
[Expert]
(16.7k 點) 提出

已重新顯示

相關問題

+4
2 個回答 510 次瀏覽
歡迎來到 Paratext 腳本與技巧(hacks)專區 我見過不少這類腳本流傳在外,最近也得知有人有一個 Google Drive 資料夾,裡面存放了許多不同的 Python 腳本,可以加入 Paratext 選單中 我意識到我們之前沒有合適的 ... 主意 您需要自行託管(self-host)您的腳本,並在此處提供連結,但至少我們可以在一個地方找到它們!
[Moderator]
dhigby
1.3k 提出
已提問 10月 22, 2021
0
0 個回答 304 次瀏覽
Have you done anything with custom checks and scripts in Python? If so could you send me ([Email Removed]) a ... out the best way to support Python in P8. Blessings, anon451647
匿名 提出 已提問 6月 1, 2016
+1
0 個回答 191 次瀏覽
The file “/My Paratext 8 Projects/cms/README.pdf” contains at least a brief sketch of how to write Python programs in P8 to access P8 data.
匿名 提出 已提問 7月 28, 2016
0
1 個回答 207 次瀏覽
I'm asking this question on this thread because it involves settings.xml also. After much work in a Paratext 8 ... Specialist, GPS Dallas Skype: Shegnada.james. ([Phone Removed]
Shegnada 1.3k 提出 已提問 1月 23, 2018
0
1 個回答 378 次瀏覽
After an Install of Wasta 14 Paratext, the Advanced Checks is greyed out. In my home directory I see ... windows C:\MyParatextProjects\cms What might cause this?
anon432075 149 提出 已提問 9月 8, 2016
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Every day they continued to meet together in the temple courts. They broke bread in their homes and ate together with glad and sincere hearts, praising God and enjoying the favor of all the people. And the Lord added to their number daily those who were being saved.
Acts 2:46-47
3,048 個問題
6,007 個回答
5,672 則評論
2,028 位使用者