Ejemplo n.º 1
0
def get_groups(request):
    query = request.GET.get('query', '')
    watched = request.GET.get('watched', '')
    tqx = parse_tqx(request.GET.get('tqx', ''))
    tq = parse_tq(request.GET.get('tq', ''))

    select = Group.select()
    select = select.limit(tq.get('limit', 1))
    select = select.offset(tq.get('offset', 0))
    select = select.order_by(Group.name)
    if query:
        select = select.where(Group.name % ('*%s*' % query))
    if watched:
        select = select.where(Group.watch == True)

    dt = gviz.DataTable({
        'name': ('string', 'Name'),
        'watch': ('boolean', 'Watched')
    })
    dt_order = ['watch', 'name']
    dt.LoadData(g._data for g in select)
    gviz_json = dt.ToJSonResponse(req_id=tqx.get('reqId', 0),
                                  columns_order=dt_order)

    return itty.Response(gviz_json, content_type='application/json')
Ejemplo n.º 2
0
def get_groups(request):
  query = request.GET.get('query', '')
  watched = request.GET.get('watched', '')
  tqx = parse_tqx(request.GET.get('tqx', ''))
  tq = parse_tq(request.GET.get('tq', ''))

  select = Group.select()
  select = select.limit(tq.get('limit', 1))
  select = select.offset(tq.get('offset', 0))
  select = select.order_by(Group.name)
  if query:
    select = select.where(Group.name % ('*%s*' % query))
  if watched:
    select = select.where(Group.watch == True)

  dt = gviz.DataTable({
      'name': ('string', 'Name'),
      'watch': ('boolean', 'Watched')
      })
  dt_order = ['watch', 'name']
  dt.LoadData( g._data for g in select )
  gviz_json = dt.ToJSonResponse(req_id=tqx.get('reqId', 0),
                                columns_order=dt_order)

  return itty.Response(gviz_json, content_type='application/json')
Ejemplo n.º 3
0
def get_state(request):
    data = {
        'jobs': IDXR.task_queue.qsize(),
        'articles': Article.select().count(),
        'groups': Group.select().count()
    }
    return itty.Response(json.dumps(data), content_type='application/json')
Ejemplo n.º 4
0
def get_state(request):
  data = {
      'jobs': IDXR.task_queue.qsize(),
      'articles': Article.select().count(),
      'groups': Group.select().count()
  }
  return itty.Response(json.dumps(data), content_type='application/json')