Skip to content

Commit

Permalink
Bug 1133910 - Fix logslice by using pickle-able BytesIO for caching
Browse files Browse the repository at this point in the history
Also updated the use of ``caches`` instead of ``get_cache`` which was deprecated in Django 1.7
  • Loading branch information
Cameron Dawson committed Feb 18, 2015
1 parent 9e43629 commit 05dd682
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions treeherder/webapp/api/logslice.py
Expand Up @@ -4,18 +4,17 @@

from rest_framework import viewsets
from rest_framework.response import Response
from django.core import cache
from django.core.cache import caches
from django.utils.six import BytesIO

from treeherder.webapp.api.utils import (with_jobs)
from treeherder.webapp.api.exceptions import ResourceNotFoundException
from django.conf import settings

import urllib2
import gzip
import io
import logging

filesystem = cache.get_cache('filesystem')
filesystem = caches['filesystem']


class LogSliceView(viewsets.ViewSet):
Expand Down Expand Up @@ -61,7 +60,7 @@ def list(self, request, project, jm):

if not gz_file:
handle = self.get_log_handle(url)
gz_file = gzip.GzipFile(fileobj=io.BytesIO(handle.read()))
gz_file = gzip.GzipFile(fileobj=BytesIO(handle.read()))
filesystem.set(url, gz_file.fileobj)
else:
gz_file = gzip.GzipFile(fileobj=gz_file)
Expand Down

0 comments on commit 05dd682

Please sign in to comment.