├── .gitignore ├── CHANGES.txt ├── LICENSE.txt ├── MANIFEST.in ├── README.rst ├── django_pipeline_forgiving ├── __init__.py └── storages.py └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info/ 3 | .DS_Store -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | Change-log for django-pipeline-forgiving. 2 | 3 | This file will be added to as part of each release 4 | 5 | ---- 6 | 7 | Version 1.0.0 (first version), Thu 29 Aug 2013 8 | =============================================== 9 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Adam Charnock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | include *.rst 3 | recursive-include docs * -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-pipeline-forgiving 2 | =========================================================== 3 | 4 | .. image:: https://badge.fury.io/py/django-pipeline-forgiving.png 5 | :target: https://badge.fury.io/py/django-pipeline-forgiving 6 | 7 | .. image:: https://pypip.in/d/django-pipeline-forgiving/badge.png 8 | :target: https://pypi.python.org/pypi/django-pipeline-forgiving 9 | 10 | An extension of the django-pipeline storage backend which forgives 11 | missing files. 12 | 13 | This was created to solve the problem of using django-pipline with 14 | third-party Django apps which have missing files in their css. 15 | 16 | For example, running ``collectstatic`` against an app using both 17 | ``djangobb_forum`` and ``pipeline`` produced (at the time of writing):: 18 | 19 | $ django-admin.py collectstatic 20 | ... 21 | ValueError: The file 'djangobb_forum/themes/default/img/active_forum.gif' could not be found with . 22 | 23 | Installation 24 | ------------ 25 | 26 | Installation using pip:: 27 | 28 | pip install django-pipeline-forgiving 29 | 30 | Usage 31 | ----- 32 | 33 | Set in your settings.py:: 34 | 35 | STATICFILES_STORAGE = 'django_pipeline_forgiving.storages.PipelineForgivingStorage' 36 | 37 | Credits 38 | ------- 39 | 40 | Written by `Adam Charnock`_. 41 | 42 | ``django-pipeline-forgiving`` is packaged using seed_. 43 | 44 | .. _seed: https://github.com/adamcharnock/seed/ 45 | .. _Adam Charnock: https://github.com/adamcharnock/ 46 | -------------------------------------------------------------------------------- /django_pipeline_forgiving/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | # It must be possible to import this file with 3 | # none of the package's dependencies installed 4 | 5 | __version__ = "1.0.0" 6 | -------------------------------------------------------------------------------- /django_pipeline_forgiving/storages.py: -------------------------------------------------------------------------------- 1 | from pipeline.storage import PipelineCachedStorage 2 | 3 | 4 | class PipelineForgivingStorage(PipelineCachedStorage): 5 | def hashed_name(self, name, content=None): 6 | try: 7 | out = super(PipelineForgivingStorage, self).hashed_name(name, content) 8 | except ValueError: 9 | # This means that a file could not be found, and normally this would 10 | # cause a fatal error, which seems rather excessive given that 11 | # some packages have missing files in their css all the time. 12 | out = name 13 | return out 14 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from os.path import exists 4 | from setuptools import setup, find_packages 5 | 6 | from django_pipeline_forgiving import __version__ 7 | 8 | setup( 9 | name='django-pipeline-forgiving', 10 | version=__version__, 11 | # Your name & email here 12 | author='Adam Charnock', 13 | author_email='adam@adamcharnock.com', 14 | # If you had django_pipeline_forgiving.tests, you would also include that in this list 15 | packages=find_packages(), 16 | # Any executable scripts, typically in 'bin'. E.g 'bin/do-something.py' 17 | scripts=[], 18 | # REQUIRED: Your project's URL 19 | url='https://github.com/adamcharnock/django-pipeline-forgiving', 20 | # Put your license here. See LICENSE.txt for more information 21 | license='MIT', 22 | # Put a nice one-liner description here 23 | description='An extension of the django-pipeline storage backend which forgives missing files', 24 | long_description=open('README.rst').read() if exists("README.rst") else "", 25 | # Any requirements here, e.g. "Django >= 1.1.1" 26 | install_requires=[ 27 | 'django-pipeline' 28 | ], 29 | ) 30 | --------------------------------------------------------------------------------