mirror of
https://github.com/bookieio/breadability
synced 2024-11-18 09:25:29 +00:00
parent
3984e04668
commit
60da675da5
9
NEWS.txt
9
NEWS.txt
@ -6,6 +6,15 @@
|
|||||||
News
|
News
|
||||||
====
|
====
|
||||||
|
|
||||||
|
0.1.9
|
||||||
|
------
|
||||||
|
|
||||||
|
* Release date: Aug 27nd 2012*
|
||||||
|
|
||||||
|
* In case of an issue dealing with candidates we need to act like we didn't
|
||||||
|
find any candidates for the article content. #10
|
||||||
|
|
||||||
|
|
||||||
0.1.8
|
0.1.8
|
||||||
------
|
------
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -6,7 +6,7 @@ README = open(os.path.join(here, 'README.rst')).read()
|
|||||||
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
|
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
|
||||||
|
|
||||||
|
|
||||||
version = '0.1.8'
|
version = '0.1.9'
|
||||||
install_requires = [
|
install_requires = [
|
||||||
# List your project dependencies here.
|
# List your project dependencies here.
|
||||||
# For more details, see:
|
# For more details, see:
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
VERSION = '0.1.8'
|
VERSION = '0.1.9'
|
||||||
import client
|
import client
|
||||||
from scripts import newtest
|
from scripts import newtest
|
||||||
|
@ -479,14 +479,25 @@ class Article(object):
|
|||||||
updated_winner = check_siblings(winner, self.candidates)
|
updated_winner = check_siblings(winner, self.candidates)
|
||||||
LOG.debug('Begin final prep of article')
|
LOG.debug('Begin final prep of article')
|
||||||
updated_winner.node = prep_article(updated_winner.node)
|
updated_winner.node = prep_article(updated_winner.node)
|
||||||
|
if updated_winner.node is not None:
|
||||||
doc = build_base_document(updated_winner.node, self.fragment)
|
doc = build_base_document(updated_winner.node, self.fragment)
|
||||||
|
else:
|
||||||
|
LOG.warning('Had candidates but failed to find a cleaned winning doc.')
|
||||||
|
doc = self._handle_no_candidates()
|
||||||
else:
|
else:
|
||||||
LOG.warning('No candidates found: using document.')
|
LOG.warning('No candidates found: using document.')
|
||||||
LOG.debug('Begin final prep of article')
|
LOG.debug('Begin final prep of article')
|
||||||
|
doc = self._handle_no_candidates()
|
||||||
|
|
||||||
|
return doc
|
||||||
|
|
||||||
|
def _handle_no_candidates(self):
|
||||||
|
"""If we fail to find a good candidate we need to find something else."""
|
||||||
# since we've not found a good candidate we're should help this
|
# since we've not found a good candidate we're should help this
|
||||||
if self.doc is not None and len(self.doc):
|
if self.doc is not None and len(self.doc):
|
||||||
# cleanup by removing the should_drop we spotted.
|
# cleanup by removing the should_drop we spotted.
|
||||||
[n.drop_tree() for n in self._should_drop]
|
[n.drop_tree() for n in self._should_drop
|
||||||
|
if n.getparent() is not None]
|
||||||
doc = prep_article(self.doc)
|
doc = prep_article(self.doc)
|
||||||
doc = build_base_document(doc, self.fragment)
|
doc = build_base_document(doc, self.fragment)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user