Created
January 15, 2013 12:14
-
-
Save justinvdm/4538195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Widget(object): | |
@classmethod | |
def from_config(cls, config): | |
widget = cls() | |
# configure general widget stuff here | |
widget.name = slugify(config['name']) | |
return widget | |
class GraphiteWidget(Widget): | |
@classmethod | |
def from_config(cls, config): | |
widget = super(GraphiteWidget, cls).from_config(config) | |
widget.graphite_url = config[ | |
# configure general graphite widget stuff here | |
# ... | |
return widget | |
class GraphWidget(GraphWidget): | |
@classmethod | |
def from_config(cls, config): | |
widget = super(GraphWidget, cls).from_config(config) | |
widget.graphite_url = config[ | |
# configure graph widget stuff here | |
# ... | |
return widget |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment