Skip to content

Instantly share code, notes, and snippets.

@justinvdm
Created January 15, 2013 12:14
Show Gist options
  • Save justinvdm/4538195 to your computer and use it in GitHub Desktop.
Save justinvdm/4538195 to your computer and use it in GitHub Desktop.
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