def config_index_dir(self): """Get the search index directory specified in the config.""" import shakespeare conf = shakespeare.conf() index_dir = conf["search_index_dir"] return index_dir
def config_index_dir(self): '''Get the search index directory specified in the config.''' import shakespeare conf = shakespeare.conf() index_dir = conf['search_index_dir'] return index_dir
fo.close() def download_url(self, url, overwrite=False): """Download a url to the local cache @overwrite: if True overwrite an existing local copy otherwise don't """ localPath = self.path(url) dirpath = os.path.dirname(localPath) if overwrite or not(os.path.exists(localPath)): if not os.path.exists(dirpath): os.makedirs(dirpath) # use wget as it seems to work more reliably on wikimedia # see extensive comments on issue in shakespeare.eb.Wikimedia class # rgrp: 2008-03-18 use urllib rather than wget despite these issues # as wget is fairly specific to linux/unix and even there may not # be installed. # cmd = 'wget -O %s %s' % (localPath, url) # os.system(cmd) urllib.urlretrieve(url, localPath) try: import shakespeare conf = shakespeare.conf() default_path = shakespeare.conf()['cachedir'] default = Cache(default_path) except: pass
fo.close() def download_url(self, url, overwrite=False): """Download a url to the local cache @overwrite: if True overwrite an existing local copy otherwise don't """ localPath = self.path(url) dirpath = os.path.dirname(localPath) if overwrite or not (os.path.exists(localPath)): if not os.path.exists(dirpath): os.makedirs(dirpath) # use wget as it seems to work more reliably on wikimedia # see extensive comments on issue in shakespeare.eb.Wikimedia class # rgrp: 2008-03-18 use urllib rather than wget despite these issues # as wget is fairly specific to linux/unix and even there may not # be installed. # cmd = 'wget -O %s %s' % (localPath, url) # os.system(cmd) urllib.urlretrieve(url, localPath) try: import shakespeare conf = shakespeare.conf() default_path = shakespeare.conf()["cachedir"] default = Cache(default_path) except: pass