python – List all base classes in a hierarchy of given class?

See the __bases__ property available on a python class, which contains a tuple of the bases classes:

>>> def classlookup(cls):
...     c = list(cls.__bases__)
...     for base in c:
...         c.extend(classlookup(base))
...     return c
>>> class A: pass
>>> class B(A): pass
>>> class C(object, B): pass
>>> classlookup(C)
[<type 'object'>, <class __main__.B at 0x00AB7300>, <class __main__.A at 0x00A6D630>]

لینک منبع

SAPUI5: How to create a control hierarchy?

I hope you can help me with this. After reading all the documentation several times, googling for days, etc I don’t find the way to do what i’m going to explain in a clean way, and in think I’m missing something because it’s a really basic scenario.

I’m working with oData models, in this case 2 named models, “Model1”, “Model2”. Now what I want is to show a “parent” ComboBox based on an oData path, and a table that changes its items depending on the selection, in other words.

Model1 { //JSON representation of the data.
  "account 1": {invoices: ["invoice1", "invoice2", "invoice3"]},
  "account 2": {invoices:["invoice4", "invoice5"]}

Combo Box:
<… items={Model1>/Accounts} /> — This works and shows Account 1, and Account2.



What I want is the table to change it’s context to the account selected on the ComboBox. The point is that this works, but the first time it loads the view, as there is no account selected, it calls the wrong odata path MYSERVICE/Invoices, instead of doing nothing, as the Account is not set yet, and the path for the invoices, once selected the account, shoud be MYSERVICE/Account(‘Account1’)/Invoices for example.

I know I can achieve this with code, but I’m sure there must be a clean way to do this.

Seriously, this is driving me crazy.

Thanks for your help.

لینک منبع