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
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
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()
def write_offline_manifest(manifest): filename = get_offline_manifest_filename() default_storage.save(filename, ContentFile(simplejson.dumps(manifest, indent=2)))
def write_offline_manifest(manifest): filename = get_offline_manifest_filename() default_storage.save(filename, ContentFile(simplejson.dumps(manifest, indent=2))) flush_offline_manifest()