Skip to content

Commit

Permalink
WCM-527: add content query fields print-volume, -year and -ressort
Browse files Browse the repository at this point in the history
  • Loading branch information
stollero committed Nov 14, 2024
1 parent a9d42e3 commit a4c8f9a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/docs/changelog/WCM-527.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WCM-527: add content query fields print-volume, -year and -ressort
14 changes: 14 additions & 0 deletions core/src/zeit/content/cp/tests/test_automatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,3 +1252,17 @@ def test_restrict_time_can_be_disabled(self):
self.area.query_restrict_time = False
IRenderedArea(self.area).values()
self.assertNotIn('CURRENT_DATE', self.connector.search_args[0])

def test_print_queries(self):
self.area.query = (
('year', 'eq', 2024),
('volume', 'eq', 10),
('printRessort', 'eq', 'DIE ZEIT'),
)
IRenderedArea(self.area).values()
query = """
...properties.volume_year = '2024'
AND properties.volume_number = '10'
AND properties.print_ressort = 'DIE ZEIT'...
"""
self.assertEllipsis(query, self.connector.search_args[0])
8 changes: 7 additions & 1 deletion core/src/zeit/contentquery/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class QueryTypeSource(zeit.cms.content.sources.SimpleDictSource):
'genre': _('query-type-genre'),
'access': _('query-type-access'),
'content_type': _('query-type-content-type'),
'year': _('query-type-year'),
'volume': _('query-type-volume'),
'printRessort': _('query-type-printRessort'),
}


Expand Down Expand Up @@ -183,10 +186,13 @@ class IQueryConditions(zeit.content.article.interfaces.IArticle):
)
zope.interface.alsoProvides(ressort.value_type, zeit.cms.content.interfaces.IChannelField)

# non-ICommonMetadata field
# non-ICommonMetadata fields
content_type = zope.schema.Choice(
title=_('Content type'), source=zeit.cms.content.sources.CMSContentTypeSource()
)
printRessort = zope.schema.Choice(
title=_('Print Ressort'), source=zeit.cms.content.sources.PrintRessortSource()
)


class IContentQuery(zope.interface.Interface):
Expand Down

0 comments on commit a4c8f9a

Please sign in to comment.