title: how to implement abstract model in spyne
body: <p>I need to implement an abstract model using Spyne.</p>
  
  <p>In fact, let's say - as a simple example - that I want to manage a garage business.</p>
  
  <p>I then have the following classes:</p>
  
  <pre><code>class Vehicle(ComplexModel):
       ''' this class is abstract '''
       _type_info = [
           ('owner',Unicode)
       ]
  
  class Car(Vehicle):
      _type_info = [
          ('color',Unicode),
          ('speed',Integer)
      ]
  
  class Bike(Vehicle):
      _type_info = [
          ('size',Integer)
      ]
  
  class Garage(ComplexModel):
  
      _type_info = [
          ('vehicles',Array(Vehicle))
      ]
  </code></pre>
  
  <p>When I want to get all vehicles managed by my garage, I will only get their Vehicle properties (aka owner here), and not the other ones.</p>
  
  <p>Is there a way to manage abstract objects with Spyne?</p>
  
  <p>Of course, a simple approach would be to have:</p>
  
  <pre><code>class Garage(ComplexModel):
  
      _type_info = [
          ('bikes',Array(Bike)),
          ('cars',Array(Car))
      ]
  </code></pre>
  
  <p>but I don't like it: if I do that, I'll have to change my "Garage" class everytime I create a new Vehicle class... I want my Garage class to manage Vehicles, no matter what type of Vehicles it is. Is it possible?</p>