* 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 fd16b520a9
commit f14172ccdb
2 changed files with 17 additions and 2 deletions

View File

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

View File

@ -21,6 +21,7 @@
# $Id$ # $Id$
import RelLib import RelLib
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -28,8 +29,14 @@ import RelLib
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def date_cmp(rule,value): def date_cmp(rule,value):
sd = rule.get_start_date()
s = rule.get_modifier() 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() od = value.get_start_date()
cmp_rule = (sd[2],sd[1],sd[0]) cmp_rule = (sd[2],sd[1],sd[0])
cmp_value = (od[2],od[1],od[0]) cmp_value = (od[2],od[1],od[0])
@ -41,8 +48,14 @@ def date_cmp(rule,value):
return cmp_rule == cmp_value return cmp_rule == cmp_value
def loose_date_cmp(rule,value): def loose_date_cmp(rule,value):
sd = rule.get_start_date()
s = rule.get_modifier() 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() od = value.get_start_date()
cmp_rule = (sd[2],sd[1],sd[0]) cmp_rule = (sd[2],sd[1],sd[0])
cmp_value = (od[2],od[1],od[0]) cmp_value = (od[2],od[1],od[0])