[PATCH] utils: return 'never' when the age is None

Mads Kiilerich mads at kiilerich.com
Thu May 21 20:58:09 EDT 2015


On 05/21/2015 08:15 PM, Andrew Shadura wrote:
> # HG changeset patch
> # User Andrew Shadura <andrew at shadura.me>
> # Date 1432232093 -7200
> #      Thu May 21 20:14:53 2015 +0200
> # Node ID 3737e67c7cbb89750dd8b3b5f76a003678792f3f
> # Parent  8d43a8174c960779437c2d8de7a0906a8cd14128
> utils: return 'never' when the age is None

As far as I understand, this can never happen "from scratch" - only from 
updates. That should be mentioned in the commit message.

Anyway, I think it would be much better to fix missing db upgrade steps 
by adding the missing steps to the latest db upgrade step (in a 
non-destructive way, of course).

/Mads


>
> diff --git a/kallithea/lib/utils2.py b/kallithea/lib/utils2.py
> --- a/kallithea/lib/utils2.py
> +++ b/kallithea/lib/utils2.py
> @@ -371,6 +371,9 @@ def age(prevdate, show_short_version=Fal
>       deltas = {}
>       future = False
>   
> +    if prevdate is None:
> +        return _(u'never')
> +
>       if prevdate > now:
>           now, prevdate = prevdate, now
>           future = True
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> http://lists.sfconservancy.org/mailman/listinfo/kallithea-general



More information about the kallithea-general mailing list