Skip to content

Commit 24e4a16

Browse files
committed
Avoid errors when attachment name contains non-ASCII characters.
1 parent 3d99bf6 commit 24e4a16

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

code_comments/subscription.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def select(cls, env, args={}, notify=None):
5454
"""
5555
Retrieve existing subscription(s).
5656
"""
57-
select = 'SELECT * FROM code_comments_subscriptions'
57+
select = u'SELECT * FROM code_comments_subscriptions'
5858

5959
if notify:
6060
args['notify'] = bool(notify)
@@ -63,16 +63,16 @@ def select(cls, env, args={}, notify=None):
6363
select += ' WHERE '
6464
criteria = []
6565
for key, value in args.iteritems():
66-
template = '{0}={1}'
66+
template = u'{0}={1}'
6767
if isinstance(value, basestring):
68-
template = '{0}=\'{1}\''
68+
template = u'{0}=\'{1}\''
6969
if (isinstance(value, tuple) or isinstance(value, list)):
70-
template = '{0} IN (\'{1}\')'
71-
value = '\',\''.join(value)
70+
template = u'{0} IN (\'{1}\')'
71+
value = u'\',\''.join(value)
7272
if isinstance(value, bool):
7373
value = int(value)
7474
criteria.append(template.format(key, value))
75-
select += ' AND '.join(criteria)
75+
select += u' AND '.join(criteria)
7676

7777
for row in env.db_query(select):
7878
yield cls._from_row(env, row)
@@ -188,7 +188,7 @@ def from_attachment(cls, env, attachment, user=None, notify=True):
188188
"""
189189
Creates a subscription from an Attachment object.
190190
"""
191-
_path = "/{0}/{1}/{2}".format(attachment.parent_realm,
191+
_path = u"/{0}/{1}/{2}".format(attachment.parent_realm,
192192
attachment.parent_id,
193193
attachment.filename)
194194

0 commit comments

Comments
 (0)