def response():
    code_info.inform_template(t)
    
    t.NAMES_OPEN = ahref( code_info.PAGE_EDITNAMES )
    t.NAMES_CLOSE = "</a>"
    t.SPACES_OPEN = ahref( code_info.PAGE_EDITSPACES )
    t.SPACES_CLOSE = "</a>"
    t.OTHER_OPEN = ahref( code_info.PAGE_EDITOPTS )
    t.OTHER_CLOSE = "</a>"
    if code_info.page() == code_info.PAGE_EDITNAMES:
        import cmp_editLNNS
        cmp=cmp_editLNNS
        cmp.LN_or_NS = "LN"
        t.NAMES_OPEN=BOLD_SPAN
        t.NAMES_CLOSE=SPAN_CLOSE
    elif code_info.page() == code_info.PAGE_EDITSPACES:
        import cmp_editLNNS
        cmp=cmp_editLNNS
        cmp.LN_or_NS = "NS"
        t.SPACES_OPEN=BOLD_SPAN
        t.SPACES_CLOSE=SPAN_CLOSE
    elif code_info.page() == code_info.PAGE_EDITOPTS:
        t.OTHER_OPEN=BOLD_SPAN
        t.OTHER_CLOSE=SPAN_CLOSE
    else:
        pass # illegal
    t.EDIT_SECTION_NAME = cmp.subtitle()
    t.EDIT_SECTION = cmp.response()

    import cmp_activity
    t.ACTIVITY = cmp_activity.response( code_info.NUM_LOGS_ON_EDIT_PAGES )

    return str(t)
    return "Content-type: text/html\n\n"

def text_plain():
    return "Content-type: text/plain\n\n"

import cgitb
cgitb.enable()

import code_old
# in code_old, it will open the main pickle file

if code_info.uli_string():
    import code_handleuli
    print text_plain()
    print code_handleuli.uli( code_info.uli_string() )
elif code_info.page() == code_info.PAGE_DESCRIPTION:
    print text_plain()
    print code_old.hub.namespace_files.get_space( code_info.space() ).get_contents()
elif (code_info.page() == code_info.PAGE_FRONT) or (code_info.blank_request()):
    import cmp_frontpage
    print text_html()
    print cmp_frontpage.response()
elif code_info.page() in [code_info.PAGE_EDITNAMES, code_info.PAGE_EDITSPACES]:
    import cmp_editframe
    print text_html()
    print cmp_editframe.response()
else:
    print text_html()
    print "<p>not made yet</p>"
    print "<p>received:", str(code_info.query_dict()), "</p>"