Esempio n. 1
0
 def getArticleWithTitle(self,value):
     "return the first article w/ the name in this section"
     articles = AlineaArticle.select( AND (AlineaArticle.q.title == value,
                                           AlineaArticle.q.alinea_sectionID == self.publicID) )
     try:
         return articles[0]
     except IndexError:
         return None
Esempio n. 2
0
 def getArticles(self):
     """ Return the list of articles """
     begin = self.getBegin()
     end = begin + self.getRange()
     orderBy = self.getOrderBy()
     reverse = self.getReverse()
     articles = list(AlineaArticle.select(self.getClause(), orderBy=AlineaArticle.q.date,
                                          reversed=reverse)[begin:end] )
     return articles
Esempio n. 3
0
File: Atom.py Progetto: philn/alinea
 def getLastModifiedDate(self):
     try:
         lastArticle = AlineaArticle.select(AlineaArticle.q.published==True,
                                                 orderBy='-date')[:1]
         lastArticle = lastArticle[0]            
     except IndexError:
         return datetime.datetime.now()
     else:
         return lastArticle.lastModified
Esempio n. 4
0
 def getSize(self):
     query = AlineaArticle.select(self.getClause())
     size = query.count()
     return size
Esempio n. 5
0
File: Atom.py Progetto: philn/alinea
 def getArticles(self,orderBy='date'):
     " return the last 10 articles "
     articles = list(AlineaArticle.select(AlineaArticle.q.published==True,
                                          orderBy=orderBy, reversed=True)[0:10] )
     return articles