Skip to content

Remove Appmode.hidden_temp_files and use ContentsManager.allow_hidden instead #69

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

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,11 @@ Appmode adds the following [configuration options](https://jupyter-notebook.read
- `Appmode.show_edit_button` Show _Edit App_ button during Appmode. Default: True.
- `Appmode.show_other_buttons` Show other buttons, e.g. Logout, during Appmode. Default: True.
- `Appmode.temp_dir` Create temp notebooks under this directory. Default: Same directory as current notebook
- `Appmode.hidden_temp_files` Create temp notebooks as hidden files. Default: True

Writing to hidden files is disabled in newer versions of notebook. You will need to enable one of the following
configuration options to run appmode:
Writing hidden files is by default disabled in newer versions of Jupyter.
To allow Appmode to hide its temporary notebook copies the option `ContentsManager.allow_hidden` has to be set:
```
ContentsManager.allow_hidden=True
or
Appmode.hidden_temp_files=False
```
Example:
```
jupyter notebook --Appmode.hidden_temp_files=False
jupyter notebook --ContentsManager.allow_hidden=True
```

## Client Side Customization
Expand Down
7 changes: 1 addition & 6 deletions appmode/server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Appmode(LoggingConfigurable):
show_edit_button = Bool(True, help="Show Edit App button during Appmode.", config=True)
show_other_buttons = Bool(True, help="Show other buttons, e.g. Logout, during Appmode.", config=True)
temp_dir = Unicode('', help="Create temporary Appmode notebooks in this directory.", config=True)
hidden_temp_files = Bool(True, help="Temporary Appmode notebooks are hidden files.", config=True)

#===============================================================================
class AppmodeHandler(IPythonHandler):
Expand All @@ -52,10 +51,6 @@ def show_other_buttons(self):
def temp_dir(self):
return self.settings['appmode'].temp_dir

@property
def hidden_temp_files(self):
return self.settings['appmode'].hidden_temp_files

#===========================================================================
@web.authenticated
async def get(self, path):
Expand Down Expand Up @@ -134,7 +129,7 @@ async def mk_tmp_copy(self, path):
os.makedirs(dirname)
fullbasename = os.path.basename(path)
basename, ext = os.path.splitext(fullbasename)
if self.hidden_temp_files:
if cm.allow_hidden:
basename = '.' + basename
for i in itertools.count():
tmp_path = "%s/%s-%i%s"%(dirname, basename, i, ext)
Expand Down