[Elisa-commits] [MERGE] added an upgrade path for 0.3.6 version

Olivier Tilloy olivier at fluendo.com
Thu Apr 24 11:16:22 CEST 2008


Another style remark, that calls for a...

bb:tweak

Olivier

Philippe Normand wrote:
> This little patch contains an upgrade path for the 0.3.6 version,
> although it's currently empty.
> 
> I also fixed the media_scanner wrt the media_locations to ignore during
> the scan.
> 
> Philippe
> 
> [...]
> 
> === modified file 'elisa-plugins/elisa/plugins/media_db/media_scanner.py'
> --- elisa-plugins/elisa/plugins/media_db/media_scanner.py	2008-04-01 10:21:27 +0000
> +++ elisa-plugins/elisa/plugins/media_db/media_scanner.py	2008-04-24 08:31:05 +0000
> @@ -27,6 +27,7 @@
>  from elisa.extern import enum
>  from elisa.core.utils import classinit
>  
> +import sys
>  import os
>  import time
>  from twisted.internet import reactor, defer, task
> @@ -114,15 +115,17 @@
>          self._hourly_locations = self.config['hourly_location_updates']
>          self._daily_locations = self.config['daily_location_updates']
>          self._weekly_locations = self.config['weekly_location_updates']
> -        self._ignored_locations = self.config['ignored_locations']
> +        self._ignored_locations = [ unicode(uri)
> +                                    for uri in self.config['ignored_locations']]
> +        
>          self._update_intervals = dict(fivemin=60 * 5,
> -                hour=60 * 60,
> -                day=60 * 60 * 24,
> -                week=60 * 60 * 24 * 7)
> +                                      hour=60 * 60,
> +                                      day=60 * 60 * 24,
> +                                      week=60 * 60 * 24 * 7)

So here we are building a dictionary using the dict() constructor...

>          self._interval_locations = {'fivemin': self._fivemin_locations,
> -                              'hour': self._hourly_locations,
> -                              'day': self._daily_locations,
> -                              'week': self._weekly_locations}
> +                                    'hour': self._hourly_locations,
> +                                    'day': self._daily_locations,
> +                                    'week': self._weekly_locations}

... and here it is built explicitely: {...}
For the sake of consistency, I think one of the two ways only should be
used, whichever.

>          
>          interval = self.config.as_float('scan_interval')
>          self._scan_interval = max(interval, self.min_scan_interval)




More information about the Elisa-commits mailing list