bug fix: removed \r in textversion's content because of a comment position bug in pre_edit. Added a save function to TextVersionManager to do so. Also removed cleaning \r before computing diffs because it should not be necessary anymore.
--- a/src/cm/models.py Wed Feb 03 21:49:04 2010 +0100
+++ b/src/cm/models.py Fri Feb 05 18:43:58 2010 +0100
@@ -139,6 +139,10 @@
class TextVersionManager(KeyManager):
+ def save(self):
+ self.content = re.sub(r'\r\n|\r|\n', '\n', self.content)
+ super.save()
+
def duplicate(self, text_version, duplicate_comments=True):
#import pdb;pdb.set_trace()
old_comment_set = set(text_version.comment_set.all())
--- a/src/cm/utils/html.py Wed Feb 03 21:49:04 2010 +0100
+++ b/src/cm/utils/html.py Fri Feb 05 18:43:58 2010 +0100
@@ -19,12 +19,3 @@
# utilities
def get_text_nodes(soup):
return soup(text=lambda text:not isinstance(text, Comment))
-
-
-import re
-
-def cleanup_textarea(input):
- """
- Cleanup \r\n to standard \n
- """
- return re.sub('(\r\n)|(\n)|(\r)','\n',input)
\ No newline at end of file
--- a/src/cm/views/texts.py Wed Feb 03 21:49:04 2010 +0100
+++ b/src/cm/views/texts.py Fri Feb 05 18:43:58 2010 +0100
@@ -15,7 +15,6 @@
from cm.utils import get_among, get_among, get_int
from cm.utils.comment_positioning import compute_new_comment_positions, \
insert_comment_markers
-from cm.utils.html import cleanup_textarea
from cm.utils.spannifier import spannify
from cm.views import get_keys_from_dict, get_textversion_by_keys_or_404, get_text_by_keys_or_404, redirect
from cm.views.export import content_export2, content_export
@@ -483,7 +482,7 @@
if v1_nid and not v2_nid:
embed_code = embed_html(key, 'id="text_view_frame" name="text_view_frame"', v1.key)
else:
- content = get_uniffied_inner_diff_table(cleanup_textarea(v1.content), cleanup_textarea(v2.content))
+ content = get_uniffied_inner_diff_table(v1.content, v2.content)
template_dict = {'paired_versions' : paired_versions,
'text' : text,