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

subclassing fails #161

Closed
funkyfuture opened this issue Sep 28, 2014 · 1 comment
Closed

subclassing fails #161

funkyfuture opened this issue Sep 28, 2014 · 1 comment
Labels

Comments

@funkyfuture
Copy link

Ciao,

suppose you have code like this:

import pygal

class FooBar(pygal.Bar):
    def __init__(self, data):
        super().__init__()
        self.title = data.name
        self.add('Label', sorted(data))

    def __str__(self):
        return self.render(is_unicode=True)


foo = FooBar()

The instantiation will fail:

  File "/.../report.py", line x, in __init__
    super().__init__()
  File "/.../lib/python3.4/site-packages/pygal/ghost.py", line 60, in __init__
    self.cls = REAL_CHARTS[name]
KeyError: 'FooBar'

But it would work with:

class Bar(pygal.Bar)

I consider this a bug since it makes it impossible to define different graphs in one module.

@paradoxxxzero
Copy link
Member

This is fixed in current git

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

No branches or pull requests

2 participants