* src/Filters/Rules/_RuleUtils.py (loose_date_cmp): Compare

textual dates.


svn: r7745
This commit is contained in:
Alex Roitman 2006-12-01 17:01:09 +00:00
parent de836890b4
commit 822647f728
2 changed files with 17 additions and 2 deletions

View File

@ -3,6 +3,8 @@
parents in case the toolbar is not visible.
2006-12-01 Alex Roitman <shura@gramps-project.org>
* src/Filters/Rules/_RuleUtils.py (loose_date_cmp): Compare
textual dates.
* src/Filters/Rules/_HasEventBase.py (apply): Do not match empty
places.
* src/plugins/Rebuild.py (__init__): Proper progress indication.

View File

@ -21,6 +21,7 @@
# $Id$
import RelLib
import DateHandler
#-------------------------------------------------------------------------
#
@ -28,8 +29,14 @@ import RelLib
#
#-------------------------------------------------------------------------
def date_cmp(rule,value):
sd = rule.get_start_date()
s = rule.get_modifier()
if s == RelLib.Date.MOD_TEXTONLY:
# If the entered date did not parse, then we can only compare
# the text against the textual representation of the tested date
value_text = DateHandler.displayer.display(value)
return (value_text.upper().find(rule.text.upper()) != -1)
sd = rule.get_start_date()
od = value.get_start_date()
cmp_rule = (sd[2],sd[1],sd[0])
cmp_value = (od[2],od[1],od[0])
@ -41,8 +48,14 @@ def date_cmp(rule,value):
return cmp_rule == cmp_value
def loose_date_cmp(rule,value):
sd = rule.get_start_date()
s = rule.get_modifier()
if s == RelLib.Date.MOD_TEXTONLY:
# If the entered date did not parse, then we can only compare
# the text against the textual representation of the tested date
value_text = DateHandler.displayer.display(value)
return (value_text.upper().find(rule.text.upper()) != -1)
sd = rule.get_start_date()
od = value.get_start_date()
cmp_rule = (sd[2],sd[1],sd[0])
cmp_value = (od[2],od[1],od[0])