Skip to content
  • Lucas Ficheux's avatar
    [cragr] Fix DateGuesser for some savings · 4a15ec3d
    Lucas Ficheux authored and hydrargyrum's avatar hydrargyrum committed
    Somme savings Accounts have Transactions with a date without a year,
    we use a DateGuesser to guess that year. The DateGuesser wasn't
    properly handed to the method, that is what this patch fixes.
    
    For DateGuesser to fulfill it's purpose the same instance needs
    to be shared between all Transaction objects, or the default behaviour of
    *Element is to make a copy of the parent's env variable (the dictionnary
    used by the filter Env) so each Transaction would have a new instance
    of DateGuesser.
    
    Here we create a child class of DateGuesser
    with it's __deepcopy__ method overridden so that a call of deepcopy on it will
    return the object itself instead of a copy, this counteracts the
    behaviour of *Element and allows all Transaction objects to share the
    same instance of DateGuesser.
    
    This may break again.
    4a15ec3d