This commit is contained in:
j 2011-12-25 18:55:40 +05:30
parent 80722c0aca
commit 887f09464b

View file

@ -70,9 +70,9 @@ def html_parser(text):
text = re.sub('\[(/.+?) (.+?)\]', '<a href="\\1">\\2</a>', text) text = re.sub('\[(/.+?) (.+?)\]', '<a href="\\1">\\2</a>', text)
text = text.replace('__LINK__', 'http').replace('__DOT__', '.') text = text.replace('__LINK__', 'http').replace('__DOT__', '.')
text = text.replace("\n\n", '</p><p>\n')
text = text.replace("\n", '<br>\n').replace('</p><p><br>\n', '</p><p>\n') text = text.replace('\n\n', '<br>\n').replace("\n", '<br>\n')
text = u'<p>%s</p>'%text
return text return text
@ -158,7 +158,7 @@ def import_layers(item, layers):
annotation.end = float(layer['time_out'])/1000 annotation.end = float(layer['time_out'])/1000
username = layer['creator'].strip() username = layer['creator'].strip()
annotation.user = User.objects.get(username=username) annotation.user = User.objects.get(username=username)
annotation.value = html_parser(layer['value'], False) annotation.value = html_parser(layer['value'])
annotation.created = datetime.fromtimestamp(int(layer['created'])) annotation.created = datetime.fromtimestamp(int(layer['created']))
annotation.modified = datetime.fromtimestamp(int(layer['modified'])) annotation.modified = datetime.fromtimestamp(int(layer['modified']))
annotation.save() annotation.save()