コード例 #1
0
def check_compressor(app_configs, **kwargs):
    errors = []

    # Get all configs if we don't get a specific set
    if not app_configs:
        app_configs = apps.apps.app_configs.values()

    compressor_installed = bool(
        list(filter(lambda app: app.name == "compressor", app_configs)))
    if not compressor_installed:
        errors.append(W001)
    else:

        # Check if storage is writeable
        try:
            # noinspection PyPackageRequirements,PyUnresolvedReferences
            from compressor.storage import default_storage as storage

            path = storage.save('test', ContentFile('new content'))
        except ImportError:
            errors.append(E001)
        except IOError:
            errors.append(E002)
        else:
            storage.delete(path)

        if not getattr(settings, 'COMPRESS_ENABLED'):
            errors.append(E003)

        if getattr(settings, 'COMPRESS_DEBUG_TOGGLE'):
            errors.append(E004)

    return errors
コード例 #2
0
def check_compressor(app_configs, **kwargs):
    errors = []

    # Get all configs if we don't get a specific set
    if not app_configs:
        app_configs = apps.apps.app_configs.values()

    compressor_installed = bool(list(filter(lambda app: app.name == "compressor", app_configs)))
    if not compressor_installed:
        errors.append(W001)
    else:

        # Check if storage is writeable
        try:
            # noinspection PyPackageRequirements,PyUnresolvedReferences
            from compressor.storage import default_storage as storage

            path = storage.save('test', ContentFile('new content'))
        except ImportError:
            errors.append(E001)
        except IOError:
            errors.append(E002)
        else:
            storage.delete(path)

        if not getattr(settings, 'COMPRESS_ENABLED'):
            errors.append(E003)

        if getattr(settings, 'COMPRESS_DEBUG_TOGGLE'):
            errors.append(E004)

    return errors
コード例 #3
0
ファイル: cache.py プロジェクト: ethirajit/onlinepos
def write_offline_manifest(manifest):
    filename = get_offline_manifest_filename()
    content = json.dumps(manifest, indent=2).encode('utf8')
    default_storage.save(filename, ContentFile(content))
    flush_offline_manifest()
コード例 #4
0
def write_offline_manifest(manifest):
    filename = get_offline_manifest_filename()
    content = json.dumps(manifest, indent=2).encode('utf8')
    default_storage.save(filename, ContentFile(content))
    flush_offline_manifest()
コード例 #5
0
ファイル: cache.py プロジェクト: eiritana/canvas
def write_offline_manifest(manifest):
    filename = get_offline_manifest_filename()
    default_storage.save(filename,
                         ContentFile(simplejson.dumps(manifest, indent=2)))
コード例 #6
0
ファイル: cache.py プロジェクト: 11craft/django_compressor
def write_offline_manifest(manifest):
    filename = get_offline_manifest_filename()
    default_storage.save(filename,
                         ContentFile(simplejson.dumps(manifest, indent=2)))
    flush_offline_manifest()