Win32 fixes
This commit is contained in:
parent
23674f2521
commit
61b0722fb0
@ -85,7 +85,12 @@ def downloadReadingList(list, orig_config, callback, use_cache=True, re_read=Tru
|
|||||||
cached_config.set(list, key, value)
|
cached_config.set(list, key, value)
|
||||||
|
|
||||||
# read list
|
# read list
|
||||||
base = urljoin('file:', os.path.abspath(os.path.curdir))
|
if sys.platform.find('win') < 0:
|
||||||
|
base = urljoin('file:', os.path.abspath(os.path.curdir))
|
||||||
|
else:
|
||||||
|
path = os.path.abspath(os.path.curdir)
|
||||||
|
base = urljoin('file:///', path.replace(':','|').replace('\\','/'))
|
||||||
|
|
||||||
request = urllib2.Request(urljoin(base + '/', list))
|
request = urllib2.Request(urljoin(base + '/', list))
|
||||||
if options.has_key("etag"):
|
if options.has_key("etag"):
|
||||||
request.add_header('If-None-Match', options['etag'])
|
request.add_header('If-None-Match', options['etag'])
|
||||||
|
@ -225,7 +225,7 @@ def template_info(source):
|
|||||||
|
|
||||||
def run(script, doc, output_file=None, options={}):
|
def run(script, doc, output_file=None, options={}):
|
||||||
""" process an HTMLTMPL file """
|
""" process an HTMLTMPL file """
|
||||||
manager = htmltmpl.TemplateManager()
|
manager = htmltmpl.TemplateManager(precompile=(sys.platform.find('win')<0))
|
||||||
template = manager.prepare(script)
|
template = manager.prepare(script)
|
||||||
tp = htmltmpl.TemplateProcessor(html_escape=0)
|
tp = htmltmpl.TemplateProcessor(html_escape=0)
|
||||||
for key,value in template_info(doc).items():
|
for key,value in template_info(doc).items():
|
||||||
|
@ -6,7 +6,7 @@ from os.path import split
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
|
|
||||||
workdir = 'tests/work/config/cache'
|
workdir = os.path.join('tests', 'work', 'config', 'cache')
|
||||||
|
|
||||||
class ReadingListTest(unittest.TestCase):
|
class ReadingListTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -38,7 +38,7 @@ class ReadingListTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_cache(self):
|
def test_cache(self):
|
||||||
cache = glob(os.path.join(workdir,'lists','*'))
|
cache = glob(os.path.join(workdir,'lists','*'))
|
||||||
self.assertTrue(1,len(cache))
|
self.assertEqual(1,len(cache))
|
||||||
|
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read(cache[0])
|
parser.read(cache[0])
|
||||||
|
@ -26,11 +26,13 @@ class SpiderTest(unittest.TestCase):
|
|||||||
os.removedirs(os.path.split(workdir)[0])
|
os.removedirs(os.path.split(workdir)[0])
|
||||||
|
|
||||||
def test_filename(self):
|
def test_filename(self):
|
||||||
self.assertEqual('./example.com,index.html',
|
self.assertEqual(os.path.join('.', 'example.com,index.html'),
|
||||||
filename('.', 'http://example.com/index.html'))
|
filename('.', 'http://example.com/index.html'))
|
||||||
self.assertEqual('./planet.intertwingly.net,2006,testfeed1,1',
|
self.assertEqual(os.path.join('.',
|
||||||
|
'planet.intertwingly.net,2006,testfeed1,1'),
|
||||||
filename('.', u'tag:planet.intertwingly.net,2006:testfeed1,1'))
|
filename('.', u'tag:planet.intertwingly.net,2006:testfeed1,1'))
|
||||||
self.assertEqual('./00000000-0000-0000-0000-000000000000',
|
self.assertEqual(os.path.join('.',
|
||||||
|
'00000000-0000-0000-0000-000000000000'),
|
||||||
filename('.', u'urn:uuid:00000000-0000-0000-0000-000000000000'))
|
filename('.', u'urn:uuid:00000000-0000-0000-0000-000000000000'))
|
||||||
|
|
||||||
# Requires Python 2.3
|
# Requires Python 2.3
|
||||||
@ -38,7 +40,7 @@ class SpiderTest(unittest.TestCase):
|
|||||||
import encodings.idna
|
import encodings.idna
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
self.assertEqual('./xn--8ws00zhy3a.com',
|
self.assertEqual(os.path.join('.', 'xn--8ws00zhy3a.com'),
|
||||||
filename('.', u'http://www.\u8a79\u59c6\u65af.com/'))
|
filename('.', u'http://www.\u8a79\u59c6\u65af.com/'))
|
||||||
|
|
||||||
def test_spiderFeed(self):
|
def test_spiderFeed(self):
|
||||||
@ -51,8 +53,8 @@ class SpiderTest(unittest.TestCase):
|
|||||||
self.assertEqual(5, len(files))
|
self.assertEqual(5, len(files))
|
||||||
|
|
||||||
# verify that the file names are as expected
|
# verify that the file names are as expected
|
||||||
self.assertTrue(workdir +
|
self.assertTrue(os.path.join(workdir,
|
||||||
'/planet.intertwingly.net,2006,testfeed1,1' in files)
|
'planet.intertwingly.net,2006,testfeed1,1') in files)
|
||||||
|
|
||||||
# verify that the file timestamps match atom:updated
|
# verify that the file timestamps match atom:updated
|
||||||
data = feedparser.parse(files[2])
|
data = feedparser.parse(files[2])
|
||||||
@ -73,10 +75,10 @@ class SpiderTest(unittest.TestCase):
|
|||||||
self.assertEqual(13, len(files))
|
self.assertEqual(13, len(files))
|
||||||
|
|
||||||
# verify that the file names are as expected
|
# verify that the file names are as expected
|
||||||
self.assertTrue(workdir +
|
self.assertTrue(os.path.join(workdir,
|
||||||
'/planet.intertwingly.net,2006,testfeed1,1' in files)
|
'planet.intertwingly.net,2006,testfeed1,1') in files)
|
||||||
self.assertTrue(workdir +
|
self.assertTrue(os.path.join(workdir,
|
||||||
'/planet.intertwingly.net,2006,testfeed2,1' in files)
|
'planet.intertwingly.net,2006,testfeed2,1') in files)
|
||||||
|
|
||||||
data = feedparser.parse(workdir +
|
data = feedparser.parse(workdir +
|
||||||
'/planet.intertwingly.net,2006,testfeed3,1')
|
'/planet.intertwingly.net,2006,testfeed3,1')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user