Permalink
Browse files

adding traceback for ajax errors, made unicode handling work on pytho…

…n 2.6
  • Loading branch information...
1 parent e8f2da3 commit d06a546198e80282bf9d3914db766cd5d2a3bdfa @ialbert committed Oct 4, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −0 main/server/ajax.py
  2. +3 −5 main/server/models.py
View
2 main/server/ajax.py 100644 → 100755
@@ -1,6 +1,7 @@
#
# handler methods that handle all ajax based interactions
#
+import traceback
from functools import partial
from collections import defaultdict
from main.server import html, models, notegen, auth
@@ -37,6 +38,7 @@ def __call__(self, *args, **kwds):
value = self.f(*args, **kwds)
return value
except Exception,exc:
+ traceback.print_exc()
return ajax_error('Error: %s' % exc)
@ajax_error_wrapper
View
@@ -295,9 +295,9 @@ def combine(self):
if self.type in POST_CONTENT_ONLY:
return self.content
else:
- title = self.title.encode('ascii', errors='replace')
- content = self.content.encode('ascii', errors='replace')
- tag_val = self.tag_val.encode('ascii', errors='replace')
+ title = self.title.encode('ascii', 'replace')
+ content = self.content.encode('ascii', 'replace')
+ tag_val = self.tag_val.encode('ascii','replace')
return "TITLE:%s\n%s\nTAGS:%s" % (title, content, tag_val)
def update_post_views(post, request, minutes=10):
@@ -504,8 +504,6 @@ def decorate_posts(posts, user):
return posts
def get_diff(a, b):
- a = a.decode('utf8', errors="replace")
- b = b.decode('utf8', errors="replace")
a, b = a.splitlines(), b.splitlines()
diff = difflib.unified_diff(a, b)
diff = map(string.strip, diff)

0 comments on commit d06a546

Please sign in to comment.