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

cache.get entire Chart object fails #10

Closed
atodorov opened this issue Nov 30, 2012 · 0 comments
Closed

cache.get entire Chart object fails #10

atodorov opened this issue Nov 30, 2012 · 0 comments

Comments

@atodorov
Copy link
Contributor

    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.

atodorov added a commit to MrSenko/django-chartit that referenced this issue Aug 10, 2016
atodorov added a commit to MrSenko/django-chartit that referenced this issue Aug 10, 2016
Don't use collections.defaultdict with a default_factory function
b/c that has problems with pickle.loads which triggers chartit#10. Instead
refactor __getitem__ and create the default values for missing keys
by hand.
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

1 participant