Package: python-xdg
Version: 0.18-1
Severity: important
Tags: patch

Hello

According to the XDG BaseDir Spec at
<http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html>:

    If $XDG_DATA_HOME is either not set or empty, a default equal to
    $HOME/.local/share should be used. 

However, the Python code contains this, which doesn't do the right thing if
one var is defined but empty (i.e. it will return an empty sting instead of the
default value):

    xdg_data_home = os.environ.get('XDG_DATA_HOME',
                os.path.join(_home, '.local', 'share'))

Attached path fixes this.

Kind regards


-- System Information:
Debian Release: squeeze
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-trunk-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-xdg depends on:
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-support                1.0.6      automated rebuilding support for P

python-xdg recommends no packages.

python-xdg suggests no packages.

-- no debconf information
--- pyxdg-0.18/xdg/BaseDirectory.py.old	2010-02-07 16:35:38.000000000 +0100
+++ pyxdg-0.18/xdg/BaseDirectory.py	2010-02-07 16:35:22.000000000 +0100
@@ -28,21 +28,21 @@
 from __future__ import generators
 import os
 
-_home = os.environ.get('HOME', '/')
-xdg_data_home = os.environ.get('XDG_DATA_HOME',
-            os.path.join(_home, '.local', 'share'))
+_home = os.path.expanduser('~')
+xdg_data_home = os.environ.get('XDG_DATA_HOME') or \
+            os.path.join(_home, '.local', 'share')
 
 xdg_data_dirs = [xdg_data_home] + \
     os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
 
-xdg_config_home = os.environ.get('XDG_CONFIG_HOME',
-            os.path.join(_home, '.config'))
+xdg_config_home = os.environ.get('XDG_CONFIG_HOME') or \
+            os.path.join(_home, '.config')
 
 xdg_config_dirs = [xdg_config_home] + \
     os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg').split(':')
 
-xdg_cache_home = os.environ.get('XDG_CACHE_HOME',
-            os.path.join(_home, '.cache'))
+xdg_cache_home = os.environ.get('XDG_CACHE_HOME') or \
+            os.path.join(_home, '.cache')
 
 xdg_data_dirs = filter(lambda x: x, xdg_data_dirs)
 xdg_config_dirs = filter(lambda x: x, xdg_config_dirs)
_______________________________________________
Python-modules-team mailing list
Python-modules-team@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/python-modules-team

Reply via email to