Esempio n. 1
0
def feed():
    """ RSS """

    response.view = 'plugins/instantpress/default_feed.rss'

    i2pwidget = PluginI2PWidgets(boilerplate)

    rss = i2pwidget.default_rss_posts()

    return rss
Esempio n. 2
0
def page():
    """ An example of page controller by id """

    response.view = 'plugins/instantpress/default_page.html'

    var_request = {}
    try:
        var_request['name'] = request.args[0]
    except:
        raise PRETTYHTTP(404, T("Sorry, but the page doesn't exist."))

    i2pwidget = PluginI2PWidgets(boilerplate)
    response.menu = i2pwidget.pages_to_menu(response.menu)

    return i2pwidget.default_page(var_request)
Esempio n. 3
0
def index():
    """ Default Blog Index """

    boilerplate.check_first_time()

    response.view = 'plugins/instantpress/default_index.html'

    var_request = {}
    try:
        var_request['pag'] = int(request.vars.pag)
    except:
        var_request['pag'] = 1

    i2pwidget = PluginI2PWidgets(boilerplate)
    response.menu = i2pwidget.pages_to_menu(response.menu)

    return i2pwidget.default_index(var_request)
Esempio n. 4
0
def post():
    """ An example of post controller ex: 2011/04/11/2_my-article """

    response.view = 'plugins/instantpress/default_post.html'

    var_request = {}
    try:
        var_request['year'] = request.args[0]
        var_request['month'] = request.args[1]
        var_request['day'] = request.args[2]
        arg0 = str(request.args[3]).split("_")[0]
        var_request['id'] = int(arg0)
    except:
        raise PRETTYHTTP(404, T("Sorry, but the page doesn't exist."))

    i2pwidget = PluginI2PWidgets(boilerplate)
    response.menu = i2pwidget.pages_to_menu(response.menu)

    return i2pwidget.default_post(var_request)
Esempio n. 5
0
def category():
    """ Blog index by category """

    response.view = 'plugins/instantpress/default_category.html'

    var_request = {}

    try:
        var_request['id'] = int(request.vars.id)
    except:
        raise PRETTYHTTP(404, T("Sorry, but the page doesn't exist."))

    try:
        var_request['pag'] = int(request.vars.pag)
    except:
        var_request['pag'] = 1

    i2pwidget = PluginI2PWidgets(boilerplate)
    response.menu = i2pwidget.pages_to_menu(response.menu)

    return i2pwidget.default_category(var_request)
Esempio n. 6
0
def archives():
    """ Blog index by archives """

    response.view = 'plugins/instantpress/default_archives.html'

    var_request = {}
    try:
        var_request['year'] = int(request.vars.year)
        var_request['month'] = int(request.vars.month)
        d_lower = datetime.date(var_request['year'], var_request['month'], 1)
    except:
        raise PRETTYHTTP(404, T("Sorry, but the page doesn't exist."))

    try:
        var_request['pag'] = int(request.vars.pag)
    except:
        var_request['pag'] = 1

    i2pwidget = PluginI2PWidgets(boilerplate)
    response.menu = i2pwidget.pages_to_menu(response.menu)

    return i2pwidget.default_archives(var_request)
Esempio n. 7
0
def search():
    """ Blog index by search query """

    response.view = 'plugins/instantpress/default_search.html'

    var_request = {}
    try:
        var_request['q'] = request.vars.q
        if not var_request['q']:
            raise ValueError

    except ValueError:
        raise PRETTYHTTP(404, T("Sorry, but the page doesn't exist."))

    try:
        var_request['pag'] = int(request.vars.pag)
    except:
        var_request['pag'] = 1

    i2pwidget = PluginI2PWidgets(boilerplate)
    response.menu = i2pwidget.pages_to_menu(response.menu)

    return i2pwidget.default_search(var_request)