comparison frontends/src/jp/base.py @ 1872:df1ca137b0cb

jp (blog/edit): editor arguments can now be specified on sat.conf, and default on are applied for known editors: - vim and gvim will open content and metadata file in a splitted window - gvim use --nofork option - installed a workaround for shlex.split not handling unicode before Python 2.7.3 - some fixes
author Goffi <goffi@goffi.org>
date Thu, 03 Mar 2016 15:57:06 +0100
parents 9d9d61d53684
children 0fe69871b71f
comparison
equal deleted inserted replaced
1871:64a40adccba4 1872:df1ca137b0cb
36 from sat_frontends.bridge.DBus import DBusBridgeFrontend 36 from sat_frontends.bridge.DBus import DBusBridgeFrontend
37 from sat.core import exceptions 37 from sat.core import exceptions
38 import sat_frontends.jp 38 import sat_frontends.jp
39 from sat_frontends.jp.constants import Const as C 39 from sat_frontends.jp.constants import Const as C
40 import xml.etree.ElementTree as ET # FIXME: used temporarily to manage XMLUI 40 import xml.etree.ElementTree as ET # FIXME: used temporarily to manage XMLUI
41 import shlex
42
43 if sys.version_info < (2, 7, 3):
44 # XXX: shlex.split only handle unicode since python 2.7.3
45 # this is a workaround for older versions
46 old_split = shlex.split
47 new_split = (lambda s, *a, **kw: [t.decode('utf-8') for t in old_split(s.encode('utf-8'), *a, **kw)]
48 if isinstance(s, unicode) else old_split(s, *a, **kw))
49 shlex.split = new_split
41 50
42 try: 51 try:
43 import progressbar 52 import progressbar
44 except ImportError: 53 except ImportError:
45 log.info (_('ProgressBar not available, please download it at http://pypi.python.org/pypi/progressbar')) 54 log.info (_('ProgressBar not available, please download it at http://pypi.python.org/pypi/progressbar'))