Skip to content

Commit

Permalink
#29 silence unnecessary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
caseneuve authored and filiplajszczak committed May 21, 2021
1 parent d335551 commit 06d6d4f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pythonanywhere/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,15 @@ def upload(self, content):
logger.info(snakesay(msg))
return True

def get_sharing_url(self):
def get_sharing_url(self, quiet=False):
"""Returns PythonAnywhere sharing url for `self.path` if file
is shared, empty string otherwise."""

url = self.api.sharing_get(self.path)
if url:
sharing_url = self._make_sharing_url(url)
logger.info(snakesay(f"{self.path} is shared at {sharing_url}"))
if not quiet:
logger.info(snakesay(f"{self.path} is shared at {sharing_url}"))
return sharing_url

logger.info(snakesay(f"{self.path} has not been shared"))
Expand All @@ -167,7 +168,7 @@ def unshare(self):
"""Returns `True` when file unshared or has not been shared,
`False` otherwise."""

already_shared = self.get_sharing_url()
already_shared = self.get_sharing_url(quiet=True)
if already_shared:
result = self.api.sharing_delete(self.path)
if result == 204:
Expand Down

0 comments on commit 06d6d4f

Please sign in to comment.