9427: Add inclusive option to IsEnclosedBy rule

This commit is contained in:
Nick Hall 2016-05-23 15:20:37 +01:00
parent f5233fbe7c
commit 6c2eac9e05
2 changed files with 6 additions and 1 deletions

View File

@ -166,6 +166,9 @@ class FilterParser(handler.ContentHandler):
# HasEvent rule has extra primary role field in v3.4.7
if self.r == rules.person.HasEvent and len(self.a) == 5:
self.a.append('1')
# IsEnclosedBy rule has extra inclusive field in v4.2.4
if self.r == rules.place.IsEnclosedBy and len(self.a) == 1:
self.a.append('0')
#-------------------------------------------------------------------------
#

View File

@ -45,7 +45,7 @@ class IsEnclosedBy(Rule):
Rule that checks for a place enclosed by another place
"""
labels = [_('ID:')]
labels = [_('ID:'), _('Inclusive:')]
name = _('Places enclosed by another place')
description = _('Matches a place enclosed by a particular place')
category = _('General filters')
@ -59,6 +59,8 @@ class IsEnclosedBy(Rule):
def apply(self, db, place):
if self.handle is None:
return False
if self.list[1] == '1' and place.handle == self.handle:
return True
if located_in(db, place.handle, self.handle):
return True
return False