CORD-1092: Store bases classes of models in xproto representations
Change-Id: If6579a6f47fdd4a93b8e78cec47627822012f483
diff --git a/xos/tools/apigen/modelgen2 b/xos/tools/apigen/modelgen2
index 25f4146..5e16a28 100755
--- a/xos/tools/apigen/modelgen2
+++ b/xos/tools/apigen/modelgen2
@@ -41,6 +41,9 @@
return False
+def bases(model):
+ return ','.join([b.__name__ for b in model.__bases__])
+
def module_has_models(module):
""" return True if 'module' contains any models we're interested in """
for k in dir(module):
@@ -192,6 +195,7 @@
print "KeyError: %r"%o.__name__
obj.class_name = o.class_name
+ obj.bases = bases(o)
file_name = o.__module__.rsplit('.',1)[1]
@@ -350,7 +354,6 @@
direc,filename = path.rsplit('/',1)
os.system('mkdir -p %s'%direc)
- pdb.set_trace()
fil = open(path,'w')
buf = '\n'.join(current_buffer)
diff --git a/xos/tools/apigen/xproto.template.txt b/xos/tools/apigen/xproto.template.txt
index 61734bc..8320443 100644
--- a/xos/tools/apigen/xproto.template.txt
+++ b/xos/tools/apigen/xproto.template.txt
@@ -1,6 +1,6 @@
{% for object in generator.all() %}
-message {{ object.camel() }} {
+message {{ object.camel() }} ({%- if (object.bases) -%}{{ object.bases}}){%- endif -%} {
{%- for field in object.fields %}
{{ xp_to_xproto(field, loop.index) }} {{xp_options(field)}};
{%- endfor %}