Ejemplo n.º 1
0
def view_object():
    path = request.query.path
    cnx = get_session()
    container = get_container()
    log.debug('path: %s' % path)
    object_data = cnx.get_object(container, urllib.unquote(path))
    response.content_type = object_data[0]['content-type']
    response.content_length = object_data[0]['content-length']
    response.content_disposition = 'Content-Disposition: attachment; filename="%s"' % urllib.unquote(path)
    return object_data[1]
Ejemplo n.º 2
0
def unwatch_directory(directory):
    """ Remove the given directory from those being monitored for changes.

    """
    del_reg_value('HKLM', APP_DIR_REG_KEY, directory)
    log.debug('unwatch_directory(%s)' % directory)
    try:
        pipe = get_reg_value('HKLM', APP_REG_KEY, 'namedpipe')
        handle = CreateFile(pipe, GENERIC_WRITE, FILE_SHARE_READ, None,
            OPEN_EXISTING, 0, None)
        WriteFile(handle, 'refreshdirectories')
        CloseHandle(handle)
    except pywintypes.error:
        log.error('Error when calling the namedpipe with the refreshdirectories '
                  'command', culprit=__culprit__)
        pass