exclude resources from tracking stats if there are only part of a concept (like with blogposts)
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3844 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
2e9f1bdfc9
commit
7742c2e4c0
2 changed files with 17 additions and 0 deletions
|
@ -248,6 +248,10 @@ class BaseView(GenericView, I18NView):
|
||||||
def defaultPredicate(self):
|
def defaultPredicate(self):
|
||||||
return self.conceptManager.getDefaultPredicate()
|
return self.conceptManager.getDefaultPredicate()
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def isPartOfPredicate(self):
|
||||||
|
return self.conceptManager.get('ispartof')
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def url(self):
|
def url(self):
|
||||||
return absoluteURL(self.context, self.request)
|
return absoluteURL(self.context, self.request)
|
||||||
|
@ -417,6 +421,17 @@ class BaseView(GenericView, I18NView):
|
||||||
+ self.listTypesForSearch(('resource',),
|
+ self.listTypesForSearch(('resource',),
|
||||||
('system', 'hidden',),))
|
('system', 'hidden',),))
|
||||||
|
|
||||||
|
def isPartOnlyResource(self, obj):
|
||||||
|
if not IResource.providedBy(obj):
|
||||||
|
return False
|
||||||
|
isPart = False
|
||||||
|
for r in obj.getConceptRelations():
|
||||||
|
if r.predicate == self.isPartOfPredicate:
|
||||||
|
isPart = True
|
||||||
|
elif r.predicate != self.typePredicate:
|
||||||
|
return False
|
||||||
|
return isPart
|
||||||
|
|
||||||
# options/settings
|
# options/settings
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
|
|
|
@ -106,6 +106,8 @@ class TrackingStats(BaseView):
|
||||||
def checkType(self, obj):
|
def checkType(self, obj):
|
||||||
if not IResource.providedBy(obj) and not IConcept.providedBy(obj):
|
if not IResource.providedBy(obj) and not IConcept.providedBy(obj):
|
||||||
return False
|
return False
|
||||||
|
if self.isPartOnlyResource(obj):
|
||||||
|
return False
|
||||||
for t in self.typeObjects:
|
for t in self.typeObjects:
|
||||||
if isinstance(t, InterfaceClass):
|
if isinstance(t, InterfaceClass):
|
||||||
if t.providedBy(obj):
|
if t.providedBy(obj):
|
||||||
|
|
Loading…
Add table
Reference in a new issue