# -*- coding: koi8-r -*-
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2006-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2006-2021 PhiloSoft Design"
import sys, os
from Cheetah.Template import Template
self.accumulator += '<a'
for attrname, value in attrs:
value = cgi.escape(value, True)
+ if isinstance(value, unicode):
+ value = value.encode('koi8-r')
if attrname == 'href':
self.accumulator += ' href="%s"' % urljoin(self.base, value)
else:
from news import NewsItem
if blog_root:
- baseURL = "http://phdru.name/%s/" % blog_root
+ blog_root_url = blog_root[
+ blog_root.find('/htdocs/phdru.name/') + len('/htdocs/phdru.name/'):]
+ baseURL = "https://phdru.name/%s/" % blog_root_url
else:
- baseURL = "http://phdru.name/"
+ baseURL = "https://phdru.name/"
items = []
for item in tuple(reversed(all_titles_tags))[:10]:
item.categoryList = tags
body = bodies[(year, month, day, file)]
body = absolute_urls(body, baseURL + url_path)
+ try:
+ body.decode('utf-8')
+ except UnicodeDecodeError:
+ body = body.decode('koi8-r').encode('utf-8')
item.body = body
- item.excerpt = get_first_p(body)
+ excerpt = get_first_p(body)
+ try:
+ excerpt.decode('utf-8')
+ except UnicodeDecodeError:
+ excerpt = excerpt.decode('koi8-r').encode('utf-8')
+ item.excerpt = excerpt
namespace = {
"title": "Oleg Broytman's blog",