Skip to content

Commit

Permalink
add some comments to the python code
Browse files Browse the repository at this point in the history
  • Loading branch information
claytron committed Oct 22, 2010
1 parent eb0a3f5 commit a8c8600
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin/RevealExtends.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,23 @@ import vim
from tempfile import NamedTemporaryFile
from urllib import urlopen
url = vim.eval('a:url')
# try/except in case the string is not a URL
try:
extends_file = urlopen(url)
# TODO: handle redirect, etc.
if extends_file.code == 200:
# we have an extends file
vim.command('let g:extends_exists = 1')
contents = extends_file.read()
# create a temporary file to put the url contents into
tmp_file = NamedTemporaryFile()
tmp_file.write(contents)
# seek to the beginning of the file so we can read it
tmp_file.seek(0)
vim.command('let s:file_path = "%s"' % tmp_file.name)
# open up the scratch buffer
vim.command('call s:openScratchBuffer(s:file_path)')
# close our files, deleting the tmp file
tmp_file.close()
extends_file.close()
except IOError:
Expand Down

0 comments on commit a8c8600

Please sign in to comment.