Example #1
0
File: post.py Project: lf8289/white
 def serach_count(self, key):
     q = db.select(self.table).fields(db.expr('count(*)',
             'total')).condition('status', 'published')
     _or = db.or_()
     _or.condition('slug', '%%%s%%' % key, 'LIKE').condition('title', '%%%s%%' % key, 'LIKE')
     q.condition(_or)
     return q.execute()[0][0]
Example #2
0
File: post.py Project: zgwdg/white
 def serach_count(self, key):
     q = db.select(self.table).fields(db.expr('count(*)',
                                              'total')).condition(
                                                  'status', 'published')
     _or = db.or_()
     _or.condition('slug', '%%%s%%' % key,
                   'LIKE').condition('title', '%%%s%%' % key, 'LIKE')
     q.condition(_or)
     return q.execute()[0][0]
Example #3
0
File: post.py Project: zgwdg/white
 def count(self, status=None):
     q = db.select(self.table).fields(db.expr('COUNT(*)'))
     if status:
         q.condition('status', status)
     return q.execute()[0][0]
Example #4
0
File: post.py Project: zgwdg/white
 def category_count(self, category_id):
     return db.select(self.table).fields(db.expr(
         'count(*)', 'total')).condition('category', category_id).condition(
             'status', 'published').execute()[0][0]
Example #5
0
 def spam_count(self, domain):
     return db.select(self.table).fields(db.expr('COUNT(*)')).condition(
         'email', domain, 'LIKE').execute()[0][0]
Example #6
0
 def count(self):
     return db.select(self.table).fields(
         db.expr('COUNT(*)')).execute()[0][0]
Example #7
0
 def count(self, **kw):
     q = db.select(self.table).fields(db.expr('COUNT(*)'))
     if kw:
         for k, v in kw.iteritems():
             q.condition(k, v)
     return q.execute()[0][0]
Example #8
0
 def count(self):
     return db.select(self.table).fields(db.expr('COUNT(*)')).execute()[0][0]
Example #9
0
 def count_slug(self, slug):
     return db.select(self.table).fields(db.expr('COUNT(*)')).condition('slug', slug).execute()[0][0]
Example #10
0
File: page.py Project: lf8289/white
 def count(self, status=None):
     q= db.select(self.table).fields(db.expr('COUNT(*)'))
     if status != 'all':
         q.condition('status', status)
     return q.execute()[0][0]
Example #11
0
File: post.py Project: lf8289/white
 def category_count(self, category_id):
     return db.select(self.table).fields(db.expr('count(*)',
         'total')).condition('category', category_id).condition('status', 'published').execute()[0][0]
Example #12
0
 def count(self, **kw):
     q = db.select(self.table).fields(db.expr('COUNT(*)'))
     if kw:
         for k, v in kw.iteritems():
             q.condition(k, v)
     return q.execute()[0][0]
Example #13
0
 def spam_count(self, domain):
     return db.select(self.table).fields(db.expr('COUNT(*)')).condition('email', domain, 'LIKE').execute()[0][0]