Skip to content

Ajax update view call does not honour date criterion #25

@robaato

Description

@robaato

Hi,

The issue:
When portal_type is 'Topic' and Ajax update view call (calendarupdateview.py) is made the date criterion is not honoured. All items are selected (in our case it's over 3000).

I am not an experienced python programmer and a complete plone newbie, but it looks to me like the way of passing arguments to aq_inner.queryCatalog() is apparently wrong.

Looking at the older code the relevant section looked like this:

def get_event_brains(self):
        args = {
            'start': {
                'query': DateTime(self.request.get('end')), 'range': 'max'},
            'end': {
                'query': DateTime(self.request.get('start')), 'range': 'min'}}
        if self.context.portal_type == 'Topic':
            return self.context.aq_inner.queryCatalog(
                REQUEST=self.request, **args)

now it looks

def get_event_brains(self):
        args = {
            'start': {
                'query': DateTime(self.request.get('end')), 'range': 'max'},
            'end': {
                'query': DateTime(self.request.get('start')), 'range': 'min'}}
        if self.context.portal_type in ['Topic', 'Collection']:
           return self.context.aq_inner.queryCatalog(args)

and I think it should be like this - fixes the issue for me

def get_event_brains(self):
        args = {
            'start': {
                'query': DateTime(self.request.get('end')), 'range': 'max'},
            'end': {
                'query': DateTime(self.request.get('start')), 'range': 'min'}}
        if self.context.portal_type in ['Topic', 'Collection']:
           return self.context.aq_inner.queryCatalog(**args)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions