set a default editor (closes #557)

This commit is contained in:
Juke 2011-03-15 23:41:32 +01:00
commit fa8a4f8fe3

View file

@ -53,7 +53,7 @@ class WebContentEdit(ReplApplication):
contents += [content for backend, content in self.do('get_content', _id, backends=backend_names) if content] contents += [content for backend, content in self.do('get_content', _id, backends=backend_names) if content]
if len(contents) == 0: if len(contents) == 0:
print >>sys.stderr, 'No contents found' print >> sys.stderr, 'No contents found'
return 1 return 1
paths = {} paths = {}
@ -73,9 +73,10 @@ class WebContentEdit(ReplApplication):
paths[path] = content paths[path] = content
params = '' params = ''
if os.environ['EDITOR'] == 'vim': editor = os.environ.get('EDITOR', 'vim')
if editor == 'vim':
params = '-p' params = '-p'
os.system("$EDITOR %s %s" % (params, ' '.join(paths.iterkeys()))) os.system("%s %s %s" % (editor, params, ' '.join(paths.iterkeys())))
for path, content in paths.iteritems(): for path, content in paths.iteritems():
with open(path, 'r') as f: with open(path, 'r') as f:
@ -124,7 +125,7 @@ class WebContentEdit(ReplApplication):
Display log of a page Display log of a page
""" """
if not line: if not line:
print >>sys.stderr, 'Error: please give a page ID' print >> sys.stderr, 'Error: please give a page ID'
return 1 return 1
_id, backend_name = self.parse_id(line) _id, backend_name = self.parse_id(line)