better files.clean_path arguments

main
Fabien Benureau 12 years ago
parent ac4b682307
commit c3b71e9095

@ -1,3 +1,9 @@
"""
This module can't depend on configs.
If you feel the need to import configs, you are not in the right place.
"""
import os import os
import subprocess import subprocess
import tempfile import tempfile
@ -6,7 +12,6 @@ from cStringIO import StringIO
import yaml import yaml
from . import ui from . import ui
from . import configs
from . import color from . import color
try: try:
@ -43,8 +48,8 @@ FORMATS_OUTPUT = {'bib': pybtex.database.output.bibtex,
'bibyaml': pybtex.database.output.bibyaml} 'bibyaml': pybtex.database.output.bibyaml}
def clean_path(path): def clean_path(*args):
return os.path.abspath(os.path.expanduser(path)) return os.path.abspath(os.path.expanduser(os.path.join(*args)))
def name_from_path(fullpdfpath, verbose=False): def name_from_path(fullpdfpath, verbose=False):
@ -168,11 +173,10 @@ def parse_bibdata(content, format_ = None):
raise ValueError, 'content format is not recognized.' raise ValueError, 'content format is not recognized.'
def editor_input(config, initial="", suffix=None): def editor_input(editor, initial="", suffix=None):
"""Use an editor to get input""" """Use an editor to get input"""
if suffix is None: if suffix is None:
suffix = '.tmp' suffix = '.tmp'
editor = config.get(configs.MAIN_SECTION, 'edit-cmd')
with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as temp_file: with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as temp_file:
tfile_name = temp_file.name tfile_name = temp_file.name
temp_file.write(initial) temp_file.write(initial)

Loading…
Cancel
Save