# Path: common/common_html.py
# def get_head(title, css = None, html5 = False):
# 
# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):
# 
# Path: common/utils.py
# def read_file(filename):
# def write_file(filename, text):
# def save_obj(filename, data):
# def load_obj(filename):
# def sha1(filename):
# def write_sha1(sha1, filename):
# def url_opener():
# def copy_file_from_url(url, out_file, expect_sha1 = None, max_retry = 4):
# def compress_file_data(out_filename, data, compress_type):
# def compress_file(out_filename, in_filename, compress_type):
# def uncompress_file(filename, compress_type):
# def _retry_on_eintr(func, *args):
# def safe_read(fd):
# def safe_write(fd, text):
# def print_traceback(*kwargs):
# def readline_backward(filename, buf_size=8192):


import os
import sys
import ws_category
import types
import json
    import cgi
from common import common_html
from common import db
from common import utils
    from flup.server.cgi import WSGIServer
        label = 'Prev'
        if offset:
            new_offset = max(offset - limit, 0)
            href = True
    else:
        label = 'Next'
        if offset + limit < size:
            new_offset = offset + limit
            href = True

    if href:
        link = '<a href="?cmd=scan&lang=%s' % lang
        if new_offset:
            link += "&offset=%d" % new_offset
        link += "&limit=%d" % limit
        link += '">' + label + '</a>'
    else:
        link = label

    return link

def handle_scan_query(params, start_response):
    text = common_html.get_head('pages without scan', css = 'shared.css').encode('utf-8') + '\n  <body>\n'

    if params['lang']:
        try:
            offset = int(params.get('offset', 0))
            limit = min(500, int(params.get('limit', 500)))
            lang = params['lang']
            conn = db.create_conn(domain = lang, family = 'wikisource')

# Path: common/common_html.py
# def get_head(title, css = None, html5 = False):
# 
# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):
# 
# Path: common/utils.py
# def read_file(filename):
# def write_file(filename, text):
# def save_obj(filename, data):
# def load_obj(filename):
# def sha1(filename):
# def write_sha1(sha1, filename):
# def url_opener():
# def copy_file_from_url(url, out_file, expect_sha1 = None, max_retry = 4):
# def compress_file_data(out_filename, data, compress_type):
# def compress_file(out_filename, in_filename, compress_type):
# def uncompress_file(filename, compress_type):
# def _retry_on_eintr(func, *args):
# def safe_read(fd):
# def safe_write(fd, text):
# def print_traceback(*kwargs):
# def readline_backward(filename, buf_size=8192):


# Path: pages_without_scan/pages_without_scan.py
import os
import sys
import ws_category
import types
import json
    import cgi
from common import common_html
from common import db
from common import utils
    from flup.server.cgi import WSGIServer

        label = 'Prev'
        if offset:
            new_offset = max(offset - limit, 0)
            href = True
    else:
        label = 'Next'
        if offset + limit < size:
            new_offset = offset + limit
            href = True

    if href:
        link = '<a href="?cmd=scan&lang=%s' % lang
        if new_offset:
            link += "&offset=%d" % new_offset
        link += "&limit=%d" % limit
        link += '">' + label + '</a>'
    else:
        link = label

    return link

def handle_scan_query(params, start_response):
    text = common_html.get_head('pages without scan', css = 'shared.css').encode('utf-8') + '\n  <body>\n'

    if params['lang']:
        try:
            offset = int(params.get('offset', 0))
            limit = min(500, int(params.get('limit', 500)))
            lang = params['lang']
            conn = db.create_conn(domain = lang, family = 'wikisource')

            cursor = db.use_db(conn, domain = lang, family = 'wikisource')