From 861fe775f72e6fca97846a708c7a5d4bb1fbcc80 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sun, 26 Jul 2009 21:52:33 -0700 Subject: URL quote when generating Quoins URLs. Fixes problems with Unicode tags. Change TEXT columns to UnicodeText in model. --- quoins/controllers.py | 2 ++ quoins/model/blog.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/quoins/controllers.py b/quoins/controllers.py index 6b41cc1..bf27ddd 100644 --- a/quoins/controllers.py +++ b/quoins/controllers.py @@ -48,6 +48,7 @@ import types import xmlrpclib, sys, re from linkback import LinkBackHandler, PingBackURI, TrackBackURI import base64 +import urllib def b64encode(x): return base64.encodestring(x)[:-1] @@ -327,6 +328,7 @@ class BlogController(TGController): if obj is None: u = tg.url(self.path) elif isinstance(obj, basestring): + obj = urllib.quote(obj.encode('utf8')) if obj.startswith('/'): obj = obj[1:] u = tg.url(os.path.join(self.path, obj)) elif isinstance(obj, Post): diff --git a/quoins/model/blog.py b/quoins/model/blog.py index 608a2f1..c1689ee 100644 --- a/quoins/model/blog.py +++ b/quoins/model/blog.py @@ -44,8 +44,8 @@ post_table = Table('post', metadata, Column('user_id', Integer, ForeignKey(tguser_table.c.user_id, onupdate="CASCADE", ondelete="CASCADE"), nullable=False, index=True), Column('title', Unicode(255)), - Column('teaser', TEXT), - Column('body', TEXT), + Column('teaser', UnicodeText), + Column('body', UnicodeText), Column('created', DateTime, nullable=False, default=datetime.now), Column('allow_comments', Boolean, nullable=False), Column('published', Boolean, nullable=False, default=False, index=True), -- cgit v1.2.3