Exemplo n.º 1
0
 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
Exemplo n.º 2
0
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
        )
Exemplo n.º 3
0
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]
Exemplo n.º 4
0
    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])))
Exemplo n.º 5
0
    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))
Exemplo n.º 6
0
    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))
Exemplo n.º 7
0
Arquivo: group.py Projeto: bcgsc/gum
 def transcripts(self):
     "Transcript objects recording modifications made to this Group"
     transcripts = Query().searchResults(
         query.Eq( ('gum_catalog', 'dn'), self.dn )
         )
     return transcripts
Exemplo n.º 8
0
 def transcripts(self):        
     transcripts = Query().searchResults(
         query.Eq( ('gum_catalog', 'dn'), self.request.form['dn'] )
         )
     return transcripts