Fixed date ranges when using a non-English language
svn: r19
This commit is contained in:
parent
e624bfaafb
commit
f0b5eefc48
@ -43,7 +43,10 @@ class Date:
|
|||||||
from_str = _("(from|between|bet)")
|
from_str = _("(from|between|bet)")
|
||||||
to_str = _("(and|to)")
|
to_str = _("(and|to)")
|
||||||
|
|
||||||
fmt = re.compile("\s*" + from_str + "(.+)" + to_str + "(.+)\s*$",
|
efmt = re.compile(r"\s*(from|between|bet)\s+(.+)\s+(and|to)\s+(.+)\s*$",
|
||||||
|
re.IGNORECASE)
|
||||||
|
|
||||||
|
fmt = re.compile(r"\s*" + from_str + r"\s+(.+)\s+" + to_str + r"\s+(.+)\s*$",
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -130,16 +133,12 @@ class Date:
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def quick_set(self,text):
|
def quick_set(self,text):
|
||||||
try:
|
try:
|
||||||
if text[0:2] == "FR":
|
match = Date.efmt.match(text)
|
||||||
match = Date.fmt.match(text)
|
|
||||||
if match:
|
if match:
|
||||||
matches = match.groups()
|
matches = match.groups()
|
||||||
self.start.set(matches[1])
|
self.start.set(matches[1])
|
||||||
self.stop.set(matches[3])
|
self.stop.set(matches[3])
|
||||||
self.range = 1
|
self.range = 1
|
||||||
else:
|
|
||||||
self.range = -1
|
|
||||||
self.text = text
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.start.quick_set(text)
|
self.start.quick_set(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user