summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. Blair <corvus@gnu.org>2009-07-26 21:52:33 -0700
committerJames E. Blair <corvus@gnu.org>2009-07-26 21:52:33 -0700
commit861fe775f72e6fca97846a708c7a5d4bb1fbcc80 (patch)
tree6a96a92bb2a8d2a4fca4ae1b124d927f04700b4c
parent1a32a7e36c7e1d732c72acb30b8a6a6dc2fc7651 (diff)
URL quote when generating Quoins URLs. Fixes problems with Unicode tags.
Change TEXT columns to UnicodeText in model.
-rw-r--r--quoins/controllers.py2
-rw-r--r--quoins/model/blog.py4
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
48import xmlrpclib, sys, re 48import xmlrpclib, sys, re
49from linkback import LinkBackHandler, PingBackURI, TrackBackURI 49from linkback import LinkBackHandler, PingBackURI, TrackBackURI
50import base64 50import base64
51import urllib
51 52
52def b64encode(x): 53def b64encode(x):
53 return base64.encodestring(x)[:-1] 54 return base64.encodestring(x)[:-1]
@@ -327,6 +328,7 @@ class BlogController(TGController):
327 if obj is None: 328 if obj is None:
328 u = tg.url(self.path) 329 u = tg.url(self.path)
329 elif isinstance(obj, basestring): 330 elif isinstance(obj, basestring):
331 obj = urllib.quote(obj.encode('utf8'))
330 if obj.startswith('/'): obj = obj[1:] 332 if obj.startswith('/'): obj = obj[1:]
331 u = tg.url(os.path.join(self.path, obj)) 333 u = tg.url(os.path.join(self.path, obj))
332 elif isinstance(obj, Post): 334 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,
44 Column('user_id', Integer, ForeignKey(tguser_table.c.user_id, 44 Column('user_id', Integer, ForeignKey(tguser_table.c.user_id,
45 onupdate="CASCADE", ondelete="CASCADE"), nullable=False, index=True), 45 onupdate="CASCADE", ondelete="CASCADE"), nullable=False, index=True),
46 Column('title', Unicode(255)), 46 Column('title', Unicode(255)),
47 Column('teaser', TEXT), 47 Column('teaser', UnicodeText),
48 Column('body', TEXT), 48 Column('body', UnicodeText),
49 Column('created', DateTime, nullable=False, default=datetime.now), 49 Column('created', DateTime, nullable=False, default=datetime.now),
50 Column('allow_comments', Boolean, nullable=False), 50 Column('allow_comments', Boolean, nullable=False),
51 Column('published', Boolean, nullable=False, default=False, index=True), 51 Column('published', Boolean, nullable=False, default=False, index=True),