chartit / django-chartit

A Django app to plot charts and pivot charts directly from the models. Uses HighCharts and jQuery JavaScript libraries to render the charts on the webpage.
http://django-chartit.mrsenko.com/
Other
492 stars 166 forks source link

cache.get entire Chart object fails #10

Closed atodorov closed 8 years ago

atodorov commented 11 years ago
    chart = Chart(
            datasource = metricsdata,
            series_options = [
                {'options': {
                        'type': 'line',
                        'stacking': False,
                    },
                    'terms': chart_terms
                }
            ],
            chart_options = {
                'title': { 'text': 'Metrics - Last 30 days'},
                'xAxis': { 'title': {'text': 'Date'}},
                'yAxis': { 'title': {'text': 'Count'}},
            }
        )

cache.set works fine.

cache.get OTOH:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/lib/python2.6/site-packages/s3cache/__init__.py", line 98, in get
    return pickle.load(f)
  File "lib/python2.6/site-packages/chartit/utils.py", line 24, in __init__
    self.update(self.data)
  File "lib/python2.6/site-packages/chartit/utils.py", line 40, in update
TypeError: ("descriptor 'keys' of 'dict' object needs an argument", <class 'chartit.highcharts.hcoptions.HCOptions'>, (<class 'chartit.highcharts.hcoptions.HCOptions'>,))

Where s3cache is a custom cache backend (https://github.com/atodorov/django-s3-cache) similar to the filesystem cache backend but stores data in Amazon S3.