def organization(self): "Look-up the Organization object based on the organization attribute" try: results = Query().searchResults( query.Eq(('gum_catalog', 'organization_id'), self.o)) except AssertionError, e: return None
def entriesInDateRange(from_, until): entries = Query().searchResults( query.And(query.Between(('entry_catalog', 'published'), from_, until), query.Eq(('entry_catalog', 'workflow_state'), PUBLISHED))) return sorted( entries, key=lambda entry: entry.published, reverse=True )
def lastEntries(amount): entries = Query().searchResults( query.Eq(('entry_catalog', 'workflow_state'), PUBLISHED)) result = sorted(entries, key=lambda entry: entry.published, reverse=True) if amount == -1: # Return all published entries return result return result[:amount]
def update(self): if 'c' not in self.request.form: return self.c = self.request.form['c'] self.entries = Query().searchResults((query.Eq( ('entry_catalog', 'workflow_state'), PUBLISHED) & AllOf( ('entry_catalog', 'categories'), [self.c])))
def update(self): if 'q' not in self.request.form: return q = self.request.form['q'].strip() if not q: self.results = lastEntries(10) return entries = Query().searchResults((query.Eq( ('entry_catalog', 'workflow_state'), PUBLISHED) & (query.Text( ('entry_catalog', 'title'), q) | AllOf( ('entry_catalog', 'categories'), [q]) | query.Text( ('entry_catalog', 'content'), q)))) self.results = list(islice(entries, 10))
def update(self, q=None): if q is None: return self.redirect(self.application_url()) q = q.strip() if not q: self.results = lastEntries(10) return entries = Query().searchResults((query.Eq( ('entry_catalog', 'workflow_state'), PUBLISHED) & (query.Text( ('entry_catalog', 'title'), q) | AllOf( ('entry_catalog', 'categories'), [q]) | query.Text( ('entry_catalog', 'content'), q)))) self.results = list(islice(entries, 10))
def transcripts(self): "Transcript objects recording modifications made to this Group" transcripts = Query().searchResults( query.Eq( ('gum_catalog', 'dn'), self.dn ) ) return transcripts
def transcripts(self): transcripts = Query().searchResults( query.Eq( ('gum_catalog', 'dn'), self.request.form['dn'] ) ) return transcripts