fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests for handling "2 poł XIX w." dates + utf8 check
[librarian.git]
/
librarian
/
dcparser.py
diff --git
a/librarian/dcparser.py
b/librarian/dcparser.py
index
bcee932
..
079c434
100644
(file)
--- a/
librarian/dcparser.py
+++ b/
librarian/dcparser.py
@@
-65,7
+65,8
@@
class Person(object):
def as_date(text):
try:
# check out the "N. poł X w." syntax
def as_date(text):
try:
# check out the "N. poł X w." syntax
- m = re.match(u"([12]) *poł[.]? ([MCDXVI]+) .*[.]?", text)
+ if isinstance(text, str): text = text.decode("utf-8")
+ m = re.match(u"([12]) *poł[.]? ([MCDXVI]+) *w[.]?", text)
if m:
half = int(m.groups()[0])
century = roman_to_int(str(m.groups()[1]))
if m:
half = int(m.groups()[0])
century = roman_to_int(str(m.groups()[1]))