def show_communities_view_helper(context, request, filter_func=None, **kw ): # Grab the data for the two listings, main communities and portlet communities_path = model_path(context) query = dict( sort_index='title', interfaces=[ICommunity], path={'query': communities_path, 'depth': 1}, #allowed={'query': effective_principals(request), 'operator': 'or'}, **kw ) qualifiers = [] titlestartswith = request.params.get('titlestartswith') if titlestartswith: query['titlestartswith'] = (titlestartswith, titlestartswith) qualifiers.append("Communities that begin with '%s'" % titlestartswith) body = request.params.get('body') if body: query['texts'] = body qualifiers.append('Search for "%s"' % body) error = None try: batch_info = get_catalog_batch_grid(context, request, filter_func, **query) except ParseError, e: batch_info = { 'entries': [], 'batching_required': False } error = 'Error: %s' % e
def get_batch(context, request, search_interfaces=[IContent], filter_func=None): """Return a batch of results and term sequence for a search request. If the user provided no terms, the returned batch will be None and the term sequence will be empty. """ batch = None terms = () kind = request.params.get("kind") if not kind: # Search form query, terms = make_query(context, request, search_interfaces) log.debug('query: %s' % query) context_path = model_path(context) if context_path and context_path != '/': query['path'] = {'query': context_path} #principals = effective_principals(request) #query['allowed'] = {'query':principals, 'operator':'or'} batch = get_catalog_batch_grid(context, request, filter_func=filter_func, **query) else: # LiveSearch text_term = request.params.get('body') if text_term: searcher = queryUtility(IGroupSearchFactory, kind) if searcher is None: # If the 'kind' we got is not known, return an error fmt = "The LiveSearch group %s is not known" raise HTTPBadRequest(fmt % kind) batch = searcher(context, request, text_term).get_batch() terms = [text_term, kind] return batch, terms
def get_recent_items_batch(community, request, size=10): batch = get_catalog_batch_grid( community, request, interfaces=[ICommunityContent], sort_index="modified_date", reverse=True, batch_size=size, path={'query': model_path(community)}, allowed={'query': effective_principals(request), 'operator': 'or'}, ) return batch
def json_communities_helper(context, request): """ query communities list for return as json """ communities_path = model_path(context) query = dict( interfaces=[ICommunity], path={'query': communities_path, 'depth': 1} ) try: batch_info = get_catalog_batch_grid(context, request, None, **query) except ParseError, e: batch_info = {'entries' : []} error = 'Error: %s' % e
def get_topic_batch(forum, request): return get_catalog_batch_grid( forum, request, interfaces=[IForumTopic], reverse=True, path={'query': model_path(forum)}, allowed={'query': effective_principals(request), 'operator': 'or'}, )
def _callFUT(self, context, request): from opencore.views.batch import get_catalog_batch_grid return get_catalog_batch_grid(context, request)
def get_batch(self): return get_catalog_batch_grid( self.context, self.request, **self._makeCriteria())