A modest string writer

gmon.py 387B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. class GmonPluginError(Exception):
  3. pass
  4. class BasePlugin(object):
  5. def __init__(self, data):
  6. self.data = data
  7. def render(self):
  8. method_n = "render_" + self.data.fmt
  9. def ex(__):
  10. raise GmonPluginError("method not defined: " + method_n)
  11. render_fn = getattr(self, method_n, ex)
  12. return render_fn()