Commits

Anonymous committed d95e595

[project @ 338]
Fixed bug #16 - unicode errors in Atom feed on some topics/forums.

Comments (0)

Files changed (2)

cciw/cciwmain/feeds.py

         return query_set.order_by('-posted_at')[:POST_FEED_MAX_ITEMS]
 
     def item_author_name(self, post):
-        return post.posted_by_id
+        return post.posted_by_id.decode('utf-8')
 
     def item_author_link(self, post):
         return add_domain(get_member_href(post.posted_by_id))
         return query_set.order_by('-created_at')[:TOPIC_FEED_MAX_ITEMS]
         
     def item_author_name(self, topic):
-        return topic.started_by_id
+        return topic.started_by_id.decode('utf-8')
         
     def item_author_link(self, topic):
         return add_domain(get_member_href(topic.started_by_id))

cciw/cciwmain/utils.py

     return "<span style='text-decoration: underline;'>%s</span>" % email.replace('@', ' <b>at</b> ').replace('.', ' <b>dot</b> ') 
 
 def get_member_href(user_name):
-    return '/members/' + user_name + '/'
+    if user_name.startswith("'"):
+        # This can get called from feeds, and we need to ensure
+        # we don't generate a URL, as it will go nowhere (also causes problems 
+        # with the feed framework and utf-8)
+        return ''
+    else:
+        return '/members/' + user_name + '/'
 
 def get_member_link(user_name):
     user_name = user_name.strip()