Commit c208c12d authored by Vincent Pelletier's avatar Vincent Pelletier

all: Stop using *_expression catalog arguments.

These are the easy uses, there are more to come.
parent aaa0e481
......@@ -20,8 +20,8 @@ def getAvailableSubjectList(subject_list=(), container_uid=None):
"""
#log("In getAvailableSubjectList with container: %s subject_list: %s" % (container_uid, subject_list))
kw = dict(subject="!=",
select_expression="subject.subject",
group_by_expression="subject.subject",
select_list=["subject.subject"],
group_by=["subject.subject"],
#src__=1
)
if container_uid: kw['parent_uid'] = container_uid
......
......@@ -4,7 +4,7 @@ if depth == 0:
task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name='task_module_selection')
person_result = context.portal_catalog(portal_type=["Person",],
source_related_uid=task_uid_list,
select_expression='relative_url, id, title',
select_list=['relative_url', 'id', 'title'],
sort_on = (('title','ascending'),))
person_dict = {}
......
......@@ -6,11 +6,11 @@ def Task_getRelatedSourceProject(depth, parent_relative_url=None):
task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name='task_module_selection')
project_result = context.portal_catalog(portal_type=["Project", "Project Line"],
source_project_related_uid=task_uid_list,
select_expression='portal_type, relative_url, id, title',
select_list=['portal_type', 'relative_url', 'id', 'title'],
sort_on = (('title','ascending'),))
else:
project_result = context.portal_catalog(portal_type=["Project Line", "Project Milestones"],
select_expression='portal_type, relative_url, id, title',
select_list=['portal_type', 'relative_url', 'id', 'title'],
parent_relative_url=parent_relative_url,
sort_on = (('title','ascending'),))
# use a dict to store catalog result
......
......@@ -4,7 +4,7 @@ if depth == 0:
task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name='task_report_module_selection')
person_result = context.portal_catalog(portal_type=["Person",],
source_related_uid=task_uid_list,
select_expression='portal_type, relative_url, id, title',
select_list=['portal_type', 'relative_url', 'id', 'title'],
sort_on = (('title','ascending'),))
person_dict = {}
person_list = []
......
......@@ -6,11 +6,11 @@ def Task_getRelatedSourceProject(depth, parent_relative_url=None):
task_uid_list = context.portal_selections.getSelectionUidList(context=context, selection_name='task_report_module_selection')
project_result = context.portal_catalog(portal_type=["Project", "Project Line"],
source_project_related_uid=task_uid_list,
select_expression='portal_type, relative_url, id, title',
select_list=['portal_type', 'relative_url', 'id', 'title'],
sort_on = (('title','ascending'),))
else:
project_result = context.portal_catalog(portal_type=["Project Line", "Project Milestones"],
select_expression='portal_type, relative_url, id, title',
select_list=['portal_type', 'relative_url', 'id', 'title'],
parent_relative_url=parent_relative_url,
sort_on = (('title','ascending'),))
# use a dict to store catalog result
......
......@@ -292,7 +292,10 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
address_list = document.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'],),
where_expression='id != "default_address"',
id={
'query': 'default_address',
'operator': '!=',
},
)
try:
address = address_list[address_index].getObject()
......@@ -385,7 +388,10 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
address_list = document.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'], ),
where_expression='id != "default_address"',
id={
'query': 'default_address',
'operator': '!=',
},
)
address_id = address_list[address_index].getId()
try:
......
......@@ -19,7 +19,7 @@ def buildIndex(language=None):
from Products.ZSQLCatalog.SQLCatalog import NegatedQuery, Query
# Retrieve the different subjects in the catalog
subject_list = context.searchResults(
select_expression='subject, reference',
select_list=['subject', 'reference'],
query=NegatedQuery(Query(subject=None)),
language=language or '',
sort_on=(('subject', 'ascending'), ('title', 'ascending')),
......
......@@ -808,7 +808,7 @@ class SimulationTool(BaseTool):
if where_expression != '':
add_kw['where_expression'] = where_expression
add_kw['predicate_category.uid'] = '!=NULL'
add_kw['group_by_expression'] = 'uid'
add_kw['group_by'] = ['uid']
add_query = self.portal_catalog(**add_kw)
uid_list = []
for line in add_query:
......
......@@ -264,7 +264,7 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
kw = {}
kw['predicate.uid'] = supply_line.getUid()
kw['select_expression'] = 'predicate.start_date_range_min'
kw['select_list'] = ['predicate.start_date_range_min']
# check supply line in predicate table
result = self.catalog_tool(**kw)
......
......@@ -584,8 +584,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
security_uid_dict = {None: [x.security_uid for x in \
self.unrestrictedSearchResults(
allowedRolesAndUsers=allowedRolesAndUsers,
select_expression="security_uid",
group_by_expression="security_uid")] }
select_list=["security_uid"],
group_by=["security_uid"])] }
else:
# XXX: What with this string transformation ?! Souldn't it be done in
# dtml instead ? ... yes, but how to be bw compatible ?
......
......@@ -3674,7 +3674,7 @@ VALUES
def test_IndexationContextIndependence(self):
def doCatalog(catalog, document):
catalog.catalogObjectList([document], check_uid=0)
result = catalog(select_expression='reference', uid=document.getUid())
result = catalog(select_list=['reference'], uid=document.getUid())
self.assertEqual(len(result), 1)
return result[0].reference
......@@ -3720,8 +3720,10 @@ VALUES
self.tic()
portal_catalog = self.getCatalogTool()
res = portal_catalog.searchResults(
select_expression='count(DISTINCT catalog.reference) AS count_reference',
group_by_expression='catalog.reference',
select_dict={
'count_reference': 'count(DISTINCT reference)',
},
group_by=['reference'],
portal_type='Person',
)
self.assertEqual(1, len(res))
......
......@@ -347,7 +347,10 @@ class ERP5NodeConduit(TioSafeBaseConduit):
address_list = document.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'],),
where_expression='id != "default_address"',
id={
'query': 'default_address',
'operator': '!=',
},
)
try:
address = address_list[address_index].getObject()
......@@ -444,7 +447,10 @@ class ERP5NodeConduit(TioSafeBaseConduit):
address_list = document.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'], ),
where_expression='id != "default_address"',
id={
'query': 'default_address',
'operator': '!=',
},
)
address_id = address_list[address_index].getId()
try:
......
......@@ -216,7 +216,7 @@ class EGOVUserManager(ERP5UserManager):
newSecurityManager(self, self.getUser(SUPER_USER))
try:
result = portal.portal_catalog.unrestrictedSearchResults(
select_expression='reference',
select_list=['reference'],
portal_type=self.portal_type_list, reference=login)
if len(result) != 1: # we won't proceed with groups
if len(result) > 1: # configuration is screwed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment