Esempio n. 1
0
def _init_theme(path, model):
    theme = get_active_theme()
    model['__theme_path__'] = '/plugin/theme/%s' % theme
    model['__get_theme_path__'] = lambda _templpath: 'plugin/theme/%s/%s' % (theme, _templpath)
    model['__custom_header__'] = setting.get_text(setting.KIND_WEBSITE, 'custom_header')
    model['__custom_footer__'] = setting.get_text(setting.KIND_WEBSITE, 'custom_footer')
    model['__menus__'] = []
    model['__settings__'] = setting.get_website_settings()
    model['__navigations__'] = loader.load_navigations()
    model['__website__'] = ctx.website
    model['__user__'] = ctx.user
    model['__ctx__'] = ctx
    return 'plugin/theme/%s/%s' % (theme, path), model
Esempio n. 2
0
def _init_theme(path, model):
    theme = get_active_theme()
    model['__theme_path__'] = '/plugin/theme/%s' % theme
    model['__get_theme_path__'] = lambda _templpath: 'plugin/theme/%s/%s' % (
        theme, _templpath)
    model['__custom_header__'] = setting.get_text(setting.KIND_WEBSITE,
                                                  'custom_header')
    model['__custom_footer__'] = setting.get_text(setting.KIND_WEBSITE,
                                                  'custom_footer')
    model['__menus__'] = []
    model['__settings__'] = setting.get_website_settings()
    model['__navigations__'] = loader.load_navigations()
    model['__website__'] = ctx.website
    model['__user__'] = ctx.user
    model['__ctx__'] = ctx
    return 'plugin/theme/%s/%s' % (theme, path), model
Esempio n. 3
0
def rss():
    ctx.response.content_type = 'application/rss+xml'
    limit = 20
    ss = setting.get_website_settings()
    description = ss['description']
    copyright = ss['copyright']
    domain = ctx.website.domain
    articles = _get_articles(1, 20)
    rss_time = articles and articles[0].creation_time or time.time()
    L = [
        '<?xml version="1.0"?>\n<rss version="2.0"><channel><title><![CDATA[',
        ctx.website.name,
        ']]></title><link>http://',
        domain,
        '/</link><description><![CDATA[',
        description,
        ']]></description><lastBuildDate>',
        _rss_datetime(rss_time),
        '</lastBuildDate><generator>iTranswarp</generator><ttl>30</ttl>'
    ]
    for a in articles:
        L.append('<item><title><![CDATA[')
        L.append(a.name)
        L.append(']]></title><link>http://')
        L.append(domain)
        L.append('/article/')
        L.append(a.id)
        L.append('</link><guid>http://')
        L.append(domain)
        L.append('/article/')
        L.append(a.id)
        L.append('</guid><author><![CDATA[')
        L.append(a.user_name)
        L.append(']]></author><pubDate>')
        L.append(_rss_datetime(a.creation_time))
        L.append('</pubDate><description><![CDATA[')
        L.append(html.to_html(a))
        L.append(']]></description></item>')
    L.append(r'</channel></rss>')
    return map(_safe_str, L)
Esempio n. 4
0
def rss():
    ctx.response.content_type = 'application/rss+xml'
    limit = 20
    ss = setting.get_website_settings()
    description = ss['description']
    copyright = ss['copyright']
    domain = ctx.website.domain
    articles = _get_articles(1, 20)
    rss_time = articles and articles[0].creation_time or time.time()
    L = [
        '<?xml version="1.0"?>\n<rss version="2.0"><channel><title><![CDATA[',
        ctx.website.name, ']]></title><link>http://', domain,
        '/</link><description><![CDATA[', description,
        ']]></description><lastBuildDate>',
        _rss_datetime(rss_time),
        '</lastBuildDate><generator>iTranswarp</generator><ttl>30</ttl>'
    ]
    for a in articles:
        L.append('<item><title><![CDATA[')
        L.append(a.name)
        L.append(']]></title><link>http://')
        L.append(domain)
        L.append('/article/')
        L.append(a.id)
        L.append('</link><guid>http://')
        L.append(domain)
        L.append('/article/')
        L.append(a.id)
        L.append('</guid><author><![CDATA[')
        L.append(a.user_name)
        L.append(']]></author><pubDate>')
        L.append(_rss_datetime(a.creation_time))
        L.append('</pubDate><description><![CDATA[')
        L.append(html.to_html(a))
        L.append(']]></description></item>')
    L.append(r'</channel></rss>')
    return map(_safe_str, L)