Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions code_comments/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def select(cls, env, args={}, notify=None):
"""
Retrieve existing subscription(s).
"""
select = 'SELECT * FROM code_comments_subscriptions'
select = u'SELECT * FROM code_comments_subscriptions'

if notify:
args['notify'] = bool(notify)
Expand All @@ -63,16 +63,16 @@ def select(cls, env, args={}, notify=None):
select += ' WHERE '
criteria = []
for key, value in args.iteritems():
template = '{0}={1}'
template = u'{0}={1}'
if isinstance(value, basestring):
template = '{0}=\'{1}\''
template = u'{0}=\'{1}\''
if (isinstance(value, tuple) or isinstance(value, list)):
template = '{0} IN (\'{1}\')'
value = '\',\''.join(value)
template = u'{0} IN (\'{1}\')'
value = u'\',\''.join(value)
if isinstance(value, bool):
value = int(value)
criteria.append(template.format(key, value))
select += ' AND '.join(criteria)
select += u' AND '.join(criteria)

for row in env.db_query(select):
yield cls._from_row(env, row)
Expand Down Expand Up @@ -188,7 +188,7 @@ def from_attachment(cls, env, attachment, user=None, notify=True):
"""
Creates a subscription from an Attachment object.
"""
_path = "/{0}/{1}/{2}".format(attachment.parent_realm,
_path = u"/{0}/{1}/{2}".format(attachment.parent_realm,
attachment.parent_id,
attachment.filename)

Expand Down