def GET(self): params = web.input(page=1) try: page = int(params.page) except: page = 1 limit = PAGE_LIMIT start = (page - 1) * limit if page > 0 else 0 dic = lit(relations='national_deliery_log', fields="*", criteria="", order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "warehousedata", "?page=") countries = db.query("SELECT id, name FROM countries ORDER BY name") l = locals() del l['self'] return render.warehousedata(**l)
def GET(self): params = web.input(page=1) try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 # we start getting requests a month old t = cal.parse("2 month ago")[0] amonthAgo = '%s-%s-%s' % (t.tm_year, t.tm_mon, t.tm_mday) dic = lit( relations='requests', fields="*", criteria="status='failed' AND cdate > '%s' AND xml_is_well_formed(request_body)" % (amonthAgo), order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "failed", "?page=") l = locals() del l['self'] return render.failed(**l)
def GET(self): params = web.input(page=1) try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 dic = lit(relations='contacts_contactgroup_counts_view', fields="*", criteria="name <> 'All Contacts'", order="name", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "ready", "?page=") r = db.query( "select count from contacts_contactgroup_counts_view where name='All Contacts';" ) total_contacts = r[0].count contact_fields = db.query( "select id, label from contacts_contactfield order by label;") campaigns = db.query("SELECT * from campaigns_view") l = locals() del l['self'] return render.reports(**l)
def GET(self): params = web.input(page=1) try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 dic = lit(relations='requests', fields="*", criteria=session.criteria, order="id desc", limit=limit, offset=start) if session.criteria: res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "search", "?page=") l = locals() del l['self'] return render.search(**l)
def GET(self): params = web.input(page=1) try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 # we start getting requests a month old t = cal.parse("2 month ago")[0] amonthAgo = '%s-%s-%s' % (t.tm_year, t.tm_mon, t.tm_mday) dic = lit( relations='requests', fields="*", criteria= "status='failed' AND cdate > '%s' AND xml_is_well_formed(request_body)" % (amonthAgo), order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "failed", "?page=") l = locals() del l['self'] return render.failed(**l)
def GET(self): params = web.input(page=1, ed="", d_id="") firstname, lastname, email, enabled, utype = ("", "", "", False, "") if params.ed: pass r = db.query("SELECT * FROM users WHERE id = %s" % params.ed) if r: rx = r[0] firstname = rx.firstname lastname = rx.lastname email = rx.email enabled = rx.active utype = rx.utype del r if params.d_id: db.query("DELETE FROM users WHERE id=%s" % params.d_id) try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 dic = lit(relations='users', fields="*", criteria="", order="firstname, lastname", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "users", "?page=") l = locals() del l['self'] return render.users(**l)
def POST(self): params = web.input( page=1, reqid=[], submissionid="", request_body="", sdate="", edate="", status="", year="", week="", pbtn="") try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 with db.transaction(): if params.pbtn == 'Retry Selected': if params.reqid: for val in params.reqid: db.update('requests', where="id = %s" % val, status='ready') if params.pbtn == 'Cancel Selected': if params.reqid: for val in params.reqid: db.delete('requests', where="id = %s" % val) db.transaction().commit() criteria = "TRUE " if params.submissionid: criteria += " AND submissionid = %s" % params.submissionid if params.status: criteria += " AND status = '%s' " % params.status if params.sdate: criteria += " AND cdate >= '%s'" % params.sdate if params.edate: criteria += " AND cdate <= '%s'" % params.edate if params.week: criteria += " AND week = '%s'" % params.week if params.request_body: criteria += " AND request_body ILIKE '%%%s%%'" % params.request_body if params.year: criteria += " AND year = '%s'" % params.year if params.formatting: if params.formatting == "xml": criteria += " AND xml_is_well_formed(request_body)" print criteria if len(criteria) > 5: session.criteria = criteria dic = lit( relations='requests', fields="*", criteria=criteria, order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "search", "?page=") l = locals() del l['self'] return render.search(**l)
def POST(self): params = web.input(page=1, reqid=[]) print params try: page = int(params.page) except: page = 1 with db.transaction(): if params.pbtn == 'Retry Selected': if params.reqid: for val in params.reqid: db.update('requests', where="id = %s" % val, status='ready') if params.pbtn == 'Delete Selected': if params.reqid: for val in params.reqid: db.delete('requests', where="id = %s" % val) db.transaction().commit() limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 # we start getting requests a month old t = cal.parse("2 month ago")[0] amonthAgo = '%s-%s-%s' % (t.tm_year, t.tm_mon, t.tm_mday) dic = lit( relations='requests', fields="*", criteria= "status='failed' AND cdate > '%s' AND xml_is_well_formed(request_body)" % (amonthAgo), order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "failed", "?page=") l = locals() del l['self'] return render.failed(**l)
def GET(self): params = web.input(page=1) try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 dic = lit(relations='requests', fields="*", criteria="", order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "requests", "?page=") l = locals() del l['self'] return render.requests(**l)
def POST(self): params = web.input( page=1, ed="", d_id="", firstname="", lastname="", email="", enabled=False, utype="" ) firstname, lastname, email, enabled, utype = ("", "", "", False, "") with db.transaction(): active = True if params.enabled == "on" else False if params.ed: update_sql = ( "UPDATE users SET firstname='%s', lastname='%s', email = '%s', " " utype='%s', active = %s WHERE id = %s ") update_sql = update_sql % ( params.firstname, params.lastname, params.email, params.utype, active, params.ed) db.query(update_sql) elif not params.ed and not params.d_id: #we're inserting pass try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 dic = lit(relations='users', fields="*", criteria="", order="firstname, lastname", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "users", "?page=") l = locals() del l['self'] return render.users(**l)
def POST(self): params = web.input(page=1, reqid=[]) print params try: page = int(params.page) except: page = 1 with db.transaction(): if params.pbtn == 'Retry Selected': if params.reqid: for val in params.reqid: db.update('requests', where="id = %s" % val, status='ready') if params.pbtn == 'Delete Selected': if params.reqid: for val in params.reqid: db.delete('requests', where="id = %s" % val) db.transaction().commit() limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 # we start getting requests a month old t = cal.parse("2 month ago")[0] amonthAgo = '%s-%s-%s' % (t.tm_year, t.tm_mon, t.tm_mday) dic = lit( relations='requests', fields="*", criteria="status='failed' AND cdate > '%s' AND xml_is_well_formed(request_body)" % (amonthAgo), order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "failed", "?page=") l = locals() del l['self'] return render.failed(**l)
def POST(self): params = web.input(page=1, reqid=[], submissionid="", request_body="", sdate="", edate="", status="", year="", week="", pbtn="") try: page = int(params.page) except: page = 1 limit = SETTINGS['PAGE_LIMIT'] start = (page - 1) * limit if page > 0 else 0 with db.transaction(): if params.pbtn == 'Retry Selected': if params.reqid: for val in params.reqid: db.update('requests', where="id = %s" % val, status='ready') if params.pbtn == 'Cancel Selected': if params.reqid: for val in params.reqid: db.delete('requests', where="id = %s" % val) db.transaction().commit() criteria = "TRUE " if params.submissionid: criteria += " AND submissionid = %s" % params.submissionid if params.status: criteria += " AND status = '%s' " % params.status if params.sdate: criteria += " AND cdate >= '%s'" % params.sdate if params.edate: criteria += " AND cdate <= '%s'" % params.edate if params.week: criteria += " AND week = '%s'" % params.week if params.request_body: criteria += " AND request_body ILIKE '%%%s%%'" % params.request_body if params.year: criteria += " AND year = '%s'" % params.year if params.formatting: if params.formatting == "xml": criteria += " AND xml_is_well_formed(request_body)" print criteria if len(criteria) > 5: session.criteria = criteria dic = lit(relations='requests', fields="*", criteria=criteria, order="id desc", limit=limit, offset=start) res = doquery(db, dic) count = countquery(db, dic) pagination_str = getPaginationString(default(page, 0), count, limit, 2, "search", "?page=") l = locals() del l['self'] return render.search(**l)