From: Brian M. <br...@gr...> - 2009-07-09 16:48:49
|
> > About dbbase.py and proxybase.py. Why do both have > NotImplemented > > methods? Why not put them all in dbbase.py or all in > proxybase.py and > > remove dbbase.py, since it is only inherited by > proxybase? > > Without looking at code (so excuse any stupid things) > > Everything that can run on a proxybase must be able to run > on a real > dbbase, so it should be present in grampsdbbase (base.py), > and then in > dbdir.py which will be used if no filter is defined. > > As I understand it: > dbbase.py is the interface a db should satisfy > > base.py is the real base a db is based upon. It inherits > from > callback, but perhaps should also inherit from dbbase?? I > think that > is missing.... > > dbdir.py implements base.py > > proxybase.py is the subset of dbbase that proxies should > implement. > proxy.db is the real database implementation. We only need > proxies for > read-only reports. So, comparing proxy and dbbase gives you > all > methods that a report can use. This is usefull. Inheriting > from dbbase > makes sure delete of person always fails on a proxy. > > So if you add a method to base.py, you should add it to > dbbase.py. If > it is somethings the reports can use, then it should be in > proxybase, > and all implementations of proxybase must have a working > version > (which if equal can be in proxybase). > > Yes, this is somewhat complicated, and perhaps Brian meant > something > else. We should add gen/proxy and gen/db to the > documentation at > http://www.gramps-project.org/docs/ with good docstring > explaining > all. No, I don't think I meant something else. You represented my understanding perfectly. I was just emphasizing my point because I believe that there are some methods that should not be implemented by proxybase because they will not be common for any proxies (like get_person_handles). Maybe a better name for proxybase would have been "readonlybase" or something more specific that indicates why the interface is different. ~Brian |