예제 #1
0
def import_writers_from_csv_file_path(csvFilePath):
    """
    Imports the writers from a CSV file path
    """
    realPath = PathMapper.get_mapped_path(csvFilePath)
    with open(realPath, 'r') as csvFileDescriptor:
        import_writers_from_csv_descriptor(csvFileDescriptor)
예제 #2
0
def add_user_quick(userName: str):
    """
    Adds a user by simply creating their folder and adding their entry to the
    writers.json dict. If the writer exists, an exception is thrown.

    Arguments:
    userName: str - The writer name to create
    """
    if Writers.writer_exists(userName):
        raise PyCException('Error: Writer {} already exists'.format(userName))
    
    mappedWriterPath = PathMapper.get_mapped_path(userName)
    newWriter = Writer(writerPath=mappedWriterPath)
    try:
        newWriter.create()
    except Exception as e:
        raise PyCException('Error: Could not create writer{}'.format(userName))