Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PipeLine got TypeError: expected string or buffer #320

Closed
raianul opened this issue Mar 1, 2014 · 2 comments
Closed

PipeLine got TypeError: expected string or buffer #320

raianul opened this issue Mar 1, 2014 · 2 comments

Comments

@raianul
Copy link
Contributor

raianul commented Mar 1, 2014

@cyberdelia - We have made conversation regarding gzip compression.
#312

We have update our django to 1.6.1. With gzip I am now using PipelineCachedStorage too. But Now we are facing some critical error.

This is my configuration now -

class GZipPipelineStorage(GZIPMixin, PipelineCachedStorage):

    def post_process(self, paths, dry_run=False, **options):
        for name, hashed_name, processed in super(GZipPipelineStorage, self).post_process(paths, dry_run, **options):
            if isinstance(processed, ValueError) and name not in settings.ALL_SOURCE_FILENAMES:
                continue

            yield name, hashed_name, processed

The reason to overridden post_process function is - ignore errors raised on post-processing phase when files are missing. Though there is a conversation regarding this, but I think they didn't solved it - jezdez/django-staticfiles#17

But at some point while post_process is running, I am getting following error -

Post-processed 'websites/bespoke/fonts/specimen_files/grid_12-825-55-15.45e9422c89bf.css.gz' as 'websites/bespoke/fonts/specimen_files/grid_12-825-55-15.45e9422c89bf.css.gz'
Post-processed 'websites/bespoke/fonts/specimen_files/specimen_stylesheet.e2cb9ea14b54.css.gz' as 'websites/bespoke/fonts/specimen_files/specimen_stylesheet.e2cb9ea14b54.css.gz'
Post-processed 'websites/dfm/js/olympics/jquery.countdown.a085c11d8052.js.gz' as 'websites/dfm/js/olympics/jquery.countdown.a085c11d8052.js.gz'
Post-processed 'websites/entertainow/css/fonts/stylesheet.7b7585a64514.css.gz' as 'websites/entertainow/css/fonts/stylesheet.7b7585a64514.css.gz'
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 167, in handle_noargs
    collected = self.collect()
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 118, in collect
    for original_path, processed_path, processed in processor:
  File "/Users/newscred/projects/python/cms/cms/pipeline/pipeline_storage.py", line 7, in post_process
    for name, hashed_name, processed in super(GZipPipelineStorage, self).post_process(paths, dry_run, **options):
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/pipeline/storage.py", line 77, in post_process
    if not matches_patterns(path, self.gzip_patterns):
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 14, in matches_patterns
    if fnmatch.fnmatchcase(path, pattern):
  File "/Users/newscred/projects/python/pycms/lib/python2.7/fnmatch.py", line 79, in fnmatchcase
    return _cache[pat].match(name) is not None
TypeError: expected string or buffer

I believe this is the code https://github.com/cyberdelia/django-pipeline/blob/master/pipeline/storage.py#L77 which might be the cause for the error.

_cache[pat].match(name) here I am getting name as None.

@raianul
Copy link
Contributor Author

raianul commented Mar 4, 2014

@cyberdelia here is the pull request #321

@cyberdelia
Copy link
Member

Thanks again for troubleshooting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants