Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6652 beakerx.json priviliges changed to private #6654

Merged
merged 3 commits into from
Jan 19, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions beakerx/beakerx/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from os import environ, path
from os import environ, path, fdopen, O_WRONLY, O_CREAT, O_TRUNC, open as osopen
from jupyter_core import paths
import json
import pathlib
Expand Down Expand Up @@ -40,9 +40,8 @@ def __init__(self):
@staticmethod
def save_setting_to_file(content):
pathlib.Path(paths.jupyter_config_dir()).mkdir(parents=True, exist_ok=True)
file = open(EnvironmentSettings.config_path, 'w+')
file.write(json.dumps(json.loads(content), indent=4, sort_keys=True))
file.close()
with fdopen(osopen(EnvironmentSettings.config_path, O_WRONLY | O_CREAT | O_TRUNC, 0o600), 'w+') as file:
Copy link
Contributor

@scottdraves scottdraves Jan 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think O_WRONLY should be O_RDWR

file.write(json.dumps(json.loads(content), indent=4, sort_keys=True))

@staticmethod
def read_setting_from_file():
Expand Down