Better Python2.6 compatibility

This commit is contained in:
Manuel Ebert 2013-07-19 13:03:27 +02:00
parent 13f8e668dc
commit 29005c0e07
3 changed files with 4 additions and 4 deletions

View file

@ -46,7 +46,6 @@ def check_output(context):
@then('the output should contain "{text}"') @then('the output should contain "{text}"')
def check_output_inline(context, text): def check_output_inline(context, text):
out = context.stdout_capture.getvalue() out = context.stdout_capture.getvalue()
print out
assert text in out assert text in out
@then('the journal should contain "{text}"') @then('the journal should contain "{text}"')

View file

@ -15,7 +15,7 @@ class Entry:
def parse_tags(self): def parse_tags(self):
fulltext = " ".join([self.title, self.body]).lower() fulltext = " ".join([self.title, self.body]).lower()
tags = re.findall(r'(?u)([{}]\w+)'.format(self.journal.config['tagsymbols']), fulltext, re.UNICODE) tags = re.findall(r'(?u)([{tags}]\w+)'.format(tags=self.journal.config['tagsymbols']), fulltext, re.UNICODE)
return set(tags) return set(tags)
def __unicode__(self): def __unicode__(self):

View file

@ -152,7 +152,8 @@ class Journal(object):
except ValueError: except ValueError:
# Happens when we can't parse the start of the line as an date. # Happens when we can't parse the start of the line as an date.
# In this case, just append line to our body. # In this case, just append line to our body.
current_entry.body += line + "\n" if current_entry:
current_entry.body += line + "\n"
# Append last entry # Append last entry
if current_entry: if current_entry:
@ -173,7 +174,7 @@ class Journal(object):
lambda match: self._colorize(match.group(0)), lambda match: self._colorize(match.group(0)),
pp, re.UNICODE) pp, re.UNICODE)
else: else:
pp = re.sub(r"(?u)([{}]\w+)".format(self.config['tagsymbols']), pp = re.sub(r"(?u)([{tags}]\w+)".format(tags=self.config['tagsymbols']),
lambda match: self._colorize(match.group(0)), lambda match: self._colorize(match.group(0)),
pp) pp)
return pp return pp