Let closest_photodb have default path='.'.

This commit is contained in:
voussoir 2021-09-30 14:34:12 -07:00
parent 042fe4dd2f
commit 2831eb43d0
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 6 additions and 6 deletions

View file

@ -1954,12 +1954,13 @@ class PhotoDB(
# Will add -> PhotoDB when forward references are supported
@classmethod
def closest_photodb(cls, path, *args, **kwargs):
def closest_photodb(cls, path='.', *args, **kwargs):
'''
Starting from the cwd and climbing upwards towards the filesystem root,
look for an existing Etiquette data directory and return the PhotoDB
object. If none exists, raise exceptions.NoClosestPhotoDB.
Starting from the given path and climbing upwards towards the filesystem
root, look for an existing Etiquette data directory and return the
PhotoDB object. If none exists, raise exceptions.NoClosestPhotoDB.
'''
path = pathclass.Path(path)
starting = path
while True:

View file

@ -4,7 +4,6 @@ import sys
import traceback
from voussoirkit import interactive
from voussoirkit import pathclass
from voussoirkit import pipeable
from voussoirkit import vlogging
@ -34,7 +33,7 @@ def erepl_argparse(args):
global P
try:
P = etiquette.photodb.PhotoDB.closest_photodb(pathclass.cwd())
P = etiquette.photodb.PhotoDB.closest_photodb()
except etiquette.exceptions.NoClosestPhotoDB as exc:
pipeable.stderr(exc.error_message)
pipeable.stderr('Try `etiquette_cli.py init` to create the database.')