It annoys me a bit that all paths must be exhausted before the normal thing is done. After all, over 2 years 95% will get to the last statement.

Benny

2008/11/30 Josip <josip@pisoj.com>
Douglas S. Blank wrote:

> Yes, let's test trunk a bit, but I see new users in the bug tracker
> running into this already so we should try to get a fix out for gramps30
> (and 2.2) soon. I tried to make the fix robust but general, so that it
> will work for future cases. There is a new function in
> trunk/src/gen/db/dbdir.py:
>
>     def set_auto_remove(self):
>         """
>         BSDDB change log settings using new method with renamed attributes
>         """
>         if db.version() < (4, 7):
>             # by the book: old method with old attribute
>             self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1)
>         else: # look at python interface
>             # TODO test with new version of pybsddb
>             try:
>                 # try numeric compare, just first 2 digits
>                 # this won't work with something like "4.10a", but
>                 # hopefully they won't do that
>                 old_version = map(int, db.__version__.split(".",2)[:2]) <
> (4, 7)
>             except:
>                 # fallback, weak string compare
>                 old_version = db.__version__ < "4.7"
>             if old_version:
>                 # undocumented: old method with new attribute
>                 self.env.set_flags(db.DB_LOG_AUTO_REMOVE, 1)
>             else:
>                 # by the book: new method with new attribute
>                 self.env.log_set_config(db.DB_LOG_AUTO_REMOVE, 1)
>
> Refinements/comments welcome.
>

Don't understand much of yours try-except code, but if possible strange
pybsddb version is problem maybe to use regex (or it is overkill?).
Something in line with:

if re.sub('[aA-zZ|\s]', '', db.__version__) < '4.7':
   # do something

--
Josip


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
Gramps-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gramps-devel