18 from ..publish.messages
import RideInputValidationError
20 ERROR_ILLEGAL_CHARACTERS =
"Filename contains illegal characters"
21 ERROR_EMPTY_FILENAME =
"Empty filename"
22 ERROR_NEWLINES_IN_THE_FILENAME =
"Newlines in the filename"
23 ERROR_FILE_ALREADY_EXISTS =
"File %s already exists"
35 fileName =
'%s.%s' % (self.
_new_basename_new_basename, context.get_format())
36 filePath = os.path.join(context.directory, fileName)
49 if pathlib.PurePath(filePath).parent != pathlib.PurePath(
'.'):
51 pathlib.Path(pathlib.PurePath(filePath).parent).mkdir(parents=
False,
55 open(filePath,
"w").close()
60 os.rmdir(pathlib.PurePath(filePath).parent)
64 except (IOError, OSError):
69 return os.path.exists(filename)
def _file_exists(self, filename)
def validate(self, context)
def __init__(self, new_basename)