示例#1
0
def _handle_uploaded_file(f, name):
    '''Handles a file upload to the projects QUOTE_FILES_ROOT
       Expects a django InMemoryUpload object, and a filename'''
    logger.debug('*** _handle_uploaded_file: enter ***')
    retval = False
    try:
        ensure_repo_filestore_dir_with_owner(settings.QUOTE_FILES_ROOT)
        destfname = os.path.join(settings.QUOTE_FILES_ROOT, name )
        destination = open(destfname, 'wb+')
        for chunk in f.chunks():
            destination.write(chunk)
        destination.close()

        retval = set_repo_file_ownerships(destfname)
    except Exception, e:
        retval = False
        logger.debug('\tException in file upload: %s' % (str(e)) )
示例#2
0
def _handle_uploaded_file(f, name):
    '''Handles a file upload to the projects QUOTE_FILES_ROOT
       Expects a django InMemoryUpload object, and a filename'''
    logger.debug('*** _handle_uploaded_file: enter ***')
    retval = False
    try:
        ensure_repo_filestore_dir_with_owner(settings.QUOTE_FILES_ROOT)
        destfname = os.path.join(settings.QUOTE_FILES_ROOT, name)
        destination = open(destfname, 'wb+')
        for chunk in f.chunks():
            destination.write(chunk)
        destination.close()

        retval = set_repo_file_ownerships(destfname)
    except Exception, e:
        retval = False
        logger.debug('\tException in file upload: %s' % (str(e)))
示例#3
0
def _handle_uploaded_file(f, name):
    '''Handles a file upload to the projects REPO_FILES_ROOT
       Expects a django InMemoryUpload object, and a filename'''
    logger.debug('*** _handle_uploaded_file: enter ***')
    retval = False
    try:
        import os
        reldir = os.path.dirname(name)
        dest_fname = str(os.path.join(settings.REPO_FILES_ROOT, name))
        ensure_repo_filestore_dir_with_owner(reldir)

        destination = open(dest_fname, 'wb+')
        for chunk in f.chunks():
            destination.write(chunk)
        destination.close()
        retval = set_repo_file_ownerships(dest_fname)
    except Exception, e:
        retval = False
        logger.exception('Exception in file upload')
示例#4
0
def _handle_uploaded_file(f, name):
    """Handles a file upload to the projects REPO_FILES_ROOT
       Expects a django InMemoryUpload object, and a filename"""
    logger.debug("*** _handle_uploaded_file: enter ***")
    retval = False
    try:
        import os

        reldir = os.path.dirname(name)
        dest_fname = str(os.path.join(settings.REPO_FILES_ROOT, name))
        ensure_repo_filestore_dir_with_owner(reldir)

        destination = open(dest_fname, "wb+")
        for chunk in f.chunks():
            destination.write(chunk)
        destination.close()
        retval = set_repo_file_ownerships(dest_fname)
    except Exception, e:
        retval = False
        logger.exception("Exception in file upload")