Skip to content

Commit

Permalink
#6652 beakerx.json priviliges changed to private (#6654)
Browse files Browse the repository at this point in the history
* #6652 beakerx.json priviliges changed to private

* #6652 chmod replaced with osopen

* #6652 beakerx.json io operation flag changed to rw
  • Loading branch information
lmitusinski authored and scottdraves committed Jan 19, 2018
1 parent fc2a70d commit 2fb631e
Showing 1 changed file with 3 additions and 4 deletions.
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_RDWR, 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_RDWR | O_CREAT | O_TRUNC, 0o600), 'w+') as file:
file.write(json.dumps(json.loads(content), indent=4, sort_keys=True))

@staticmethod
def read_setting_from_file():
Expand Down

0 comments on commit 2fb631e

Please sign in to comment.