[weboob] Redesign of fillobj

Romain Bignon romain at peerfuse.org
Sun Jul 18 01:17:37 CEST 2010


I have redesigned the concept of fillobj, because there were too many errors in
the Christophe initial code:
1. An application may NOT call the browser of a backend directly. Also, I think
   I'll rename the attribute to _browser.
2. It's BAD to catch every exceptions with “except Exception:”
3. There was no intelligence in the core, each backend has to check themselves
   what field to update

So I rewritten it with this design:

BaseBackend implements the fillobj() methods. Backends don't have to overload

BaseBackend has a class attribute OBJECTS, which is a dictionary with a class as
key and a method as value.

fillobj() will try to find the class of the given object if OBJECTS, and if
exists, call the associated method. It looks for the fields which are NOT
already filled, and calls the method only if there are ones not filled.

Of course, the fields list given to the called method are only the ones which
are not filled.

Now there are two problems:

1. ConsoleApplication calls *synchronously* fillobj(), and it's not a good thing
because we lose the advantages of threads to fetch data

2. Each object would have their unfilled fields set to None, to know where it is
filled or not. Currently, default fields are set to u'' or 0 or so, and when we
try to look for unfilled fields, we don't know if this is the real value or if
it's because the field hasn't be fetched yet.

I'll continue to code on this system tomorrow and try to solve these issues.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <https://lists.symlink.me/pipermail/weboob/attachments/20100718/1367cde6/attachment.sig>

More information about the weboob mailing list