Bugfixes in checkBibtex

* except too wide on first y / N
* clean user input for isbn (remove '-' and ' ')
* forgot a tools.
This commit is contained in:
Phyks 2014-06-11 14:50:57 +02:00
parent e538c16a42
commit 855e6fa1fc
2 changed files with 8 additions and 4 deletions

View File

@ -142,7 +142,6 @@ Here are some sources of inspirations for this project :
A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns.
0. Add book
60. Unittest
80. Search engine
85. Anti-duplicate ?

11
bmc.py
View File

@ -27,11 +27,16 @@ def checkBibtex(filename, bibtex_string):
bibtex = bibtex[bibtex.keys()[0]]
# Check entries are correct
assert bibtex['title']
assert bibtex['authors']
if bibtex['type'] == 'article':
assert bibtex['authors']
elif bibtex['type'] == 'book':
assert bibtex['author']
assert bibtex['year']
# Print the bibtex and confirm
print(parsed2Bibtex(bibtex))
print(tools.parsed2Bibtex(bibtex))
check = tools.rawInput("Is it correct? [Y/n] ")
except KeyboardInterrupt:
sys.exit()
except:
check = 'n'
@ -139,7 +144,7 @@ def addFile(src, filetype, manual, autoconfirm, tag):
while isbn_manual not in ['isbn', 'manual', 'skip']:
isbn_manual = tools.rawInput("ISBN / manual / skip? ").lower()
if isbn_manual == 'isbn':
isbn = tools.rawInput('ISBN? ')
isbn = tools.rawInput('ISBN? ').replace(' ', '').replace('-', '')
elif isbn_manual == 'skip':
return False
elif doi is not False: