from .settings import env


class AutoAPIBase(object):

    language = 'base'
    type = 'base'

    def __init__(self, obj):
        self.obj = obj


    def render(self, ctx=None):
        if not ctx:
            ctx = {}
        template = env.get_template(
            '{language}/{type}.rst'.format(language=self.language, type=self.type)
        )
        ctx.update(**self.__dict__)
        return template.render(**ctx)

    def get_absolute_path(self):
        return "/autoapi/{type}/{name}".format(
            type=self.type,
            name=self.name,
        )


class UnknownType(AutoAPIBase):

    def render(self, ctx=None):
        print "Unknown Type: %s" % (self.obj['type'])
        super(UnknownType, self).render(ctx=ctx)

@@ -143,17 +143,16 @@
  = obj%0A%0A
-%0A
     def 
@@ -376,16 +376,26 @@
 elf.
-__dict__
+get_context_data()
 )%0A  
@@ -568,16 +568,16 @@
 f.name,%0A
-
         
@@ -579,16 +579,78 @@
      )%0A%0A
+    def get_context_data(self):%0A        return self.__dict__%0A%0A
 %0Aclass U

Make context output behavior overridable