From 21dbede7347e3656b896f0a7cafee7ce59fe4099 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Mon, 23 Feb 2015 13:10:21 -0800 Subject: [PATCH] Moar unicode fixes --- rophako/app.py | 1 + rophako/jsondb.py | 1 + rophako/log.py | 1 + rophako/model/blog.py | 1 + rophako/model/comment.py | 1 + rophako/model/emoticons.py | 1 + rophako/model/photo.py | 1 + rophako/model/tracking.py | 1 + rophako/model/user.py | 1 + rophako/model/wiki.py | 1 + rophako/modules/account/__init__.py | 1 + rophako/modules/admin/__init__.py | 1 + rophako/modules/blog/__init__.py | 1 + rophako/modules/contact/__init__.py | 1 + rophako/modules/emoticons/__init__.py | 1 + rophako/modules/photo/__init__.py | 1 + rophako/modules/tracking/__init__.py | 1 + rophako/modules/wiki/__init__.py | 1 + rophako/plugin.py | 1 + rophako/settings.py | 1 + rophako/utils.py | 12 ++++++++---- rophako/www/layout.html | 9 --------- scripts/orphaned-photos.py | 3 ++- scripts/siikir-blog-migrate.py | 3 ++- 24 files changed, 32 insertions(+), 15 deletions(-) diff --git a/rophako/app.py b/rophako/app.py index 2690979..e36335d 100644 --- a/rophako/app.py +++ b/rophako/app.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import unicode_literals """Flask app for Rophako.""" diff --git a/rophako/jsondb.py b/rophako/jsondb.py index dd9ba6f..e5921ca 100644 --- a/rophako/jsondb.py +++ b/rophako/jsondb.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """JSON flat file database system.""" diff --git a/rophako/log.py b/rophako/log.py index c68083f..44956c6 100644 --- a/rophako/log.py +++ b/rophako/log.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Debug and logging functions.""" diff --git a/rophako/model/blog.py b/rophako/model/blog.py index de5be2e..fff0d3f 100644 --- a/rophako/model/blog.py +++ b/rophako/model/blog.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Blog models.""" diff --git a/rophako/model/comment.py b/rophako/model/comment.py index b811b67..7b815ed 100644 --- a/rophako/model/comment.py +++ b/rophako/model/comment.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Commenting models.""" diff --git a/rophako/model/emoticons.py b/rophako/model/emoticons.py index 019f37f..68344e5 100644 --- a/rophako/model/emoticons.py +++ b/rophako/model/emoticons.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Emoticon models.""" diff --git a/rophako/model/photo.py b/rophako/model/photo.py index 271d45d..6b58e31 100644 --- a/rophako/model/photo.py +++ b/rophako/model/photo.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Photo album models.""" diff --git a/rophako/model/tracking.py b/rophako/model/tracking.py index 529fac2..f4a5561 100644 --- a/rophako/model/tracking.py +++ b/rophako/model/tracking.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Visitor tracking models.""" diff --git a/rophako/model/user.py b/rophako/model/user.py index c1ca67d..819a995 100644 --- a/rophako/model/user.py +++ b/rophako/model/user.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """User account models.""" diff --git a/rophako/model/wiki.py b/rophako/model/wiki.py index e75d628..e34bd42 100644 --- a/rophako/model/wiki.py +++ b/rophako/model/wiki.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Wiki models.""" diff --git a/rophako/modules/account/__init__.py b/rophako/modules/account/__init__.py index 92da25b..09ebd03 100644 --- a/rophako/modules/account/__init__.py +++ b/rophako/modules/account/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for user login and out.""" diff --git a/rophako/modules/admin/__init__.py b/rophako/modules/admin/__init__.py index 472ea92..46dd7bc 100644 --- a/rophako/modules/admin/__init__.py +++ b/rophako/modules/admin/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for admin functions.""" diff --git a/rophako/modules/blog/__init__.py b/rophako/modules/blog/__init__.py index 06333da..953b124 100644 --- a/rophako/modules/blog/__init__.py +++ b/rophako/modules/blog/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for the web blog.""" diff --git a/rophako/modules/contact/__init__.py b/rophako/modules/contact/__init__.py index 12692d2..df468e9 100644 --- a/rophako/modules/contact/__init__.py +++ b/rophako/modules/contact/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for contacting the site owner.""" diff --git a/rophako/modules/emoticons/__init__.py b/rophako/modules/emoticons/__init__.py index 6fa99ba..3bad49d 100644 --- a/rophako/modules/emoticons/__init__.py +++ b/rophako/modules/emoticons/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for the commenting subsystem.""" diff --git a/rophako/modules/photo/__init__.py b/rophako/modules/photo/__init__.py index 6d05654..b8bb2fb 100644 --- a/rophako/modules/photo/__init__.py +++ b/rophako/modules/photo/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for the photo albums.""" diff --git a/rophako/modules/tracking/__init__.py b/rophako/modules/tracking/__init__.py index 7a040f4..621c93c 100644 --- a/rophako/modules/tracking/__init__.py +++ b/rophako/modules/tracking/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for visitor tracking functions.""" diff --git a/rophako/modules/wiki/__init__.py b/rophako/modules/wiki/__init__.py index 6092a47..abe6ebb 100644 --- a/rophako/modules/wiki/__init__.py +++ b/rophako/modules/wiki/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """Endpoints for the wiki.""" diff --git a/rophako/plugin.py b/rophako/plugin.py index 71fa21d..49bdb60 100644 --- a/rophako/plugin.py +++ b/rophako/plugin.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import unicode_literals """Dynamic CMS plugin loader.""" diff --git a/rophako/settings.py b/rophako/settings.py index 9d2d87f..e1fef71 100644 --- a/rophako/settings.py +++ b/rophako/settings.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals import os import datetime diff --git a/rophako/utils.py b/rophako/utils.py index 8be49a7..e412e14 100644 --- a/rophako/utils.py +++ b/rophako/utils.py @@ -14,6 +14,7 @@ import markdown import json import urlparse import traceback +import socket from rophako.log import logger from rophako.settings import Config @@ -190,10 +191,13 @@ def send_email(to, subject, message, sender=None, reply_to=None): headers.append("Subject: {}".format(subject)) # Prepare the mail for transport. - server = smtplib.SMTP(Config.mail.server, Config.mail.port) - msg = "\n".join(headers) + "\n\n" + message - server.sendmail(sender, email, msg) - server.quit() + try: + server = smtplib.SMTP(Config.mail.server, Config.mail.port) + msg = "\n".join(headers) + "\n\n" + message + server.sendmail(sender, email, msg) + server.quit() + except socket.error: + pass def handle_exception(error): diff --git a/rophako/www/layout.html b/rophako/www/layout.html index f2197d3..504b3de 100644 --- a/rophako/www/layout.html +++ b/rophako/www/layout.html @@ -54,15 +54,6 @@ {% block content %}{% endblock %} -
-

- Visitor Information:
- Unique Visitors: {{ tracking["unique_today"] }} today/{{ tracking["unique_total"] }} total
- Page Hits: {{ tracking["hits_today"] }} today/{{ tracking["hits_total"] }} total
- Visitor Details | - Referring URLs -

-