da98105753a1

Fix some comment exporting issues.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 09 Jan 2010 03:42:18 -0500
parents 87dafa5e8959
children 6d07aadea2c4
branches/tags (none)
files blog/models.py convert-comments.py

Changes

--- a/blog/models.py	Sat Jan 09 01:01:28 2010 -0500
+++ b/blog/models.py	Sat Jan 09 03:42:18 2010 -0500
@@ -15,7 +15,7 @@
         verbose_name_plural = 'entries'
     
     def get_absolute_url(self):
-        return u'/blog/%d/%d/%s/' % (self.pub_date.year, self.pub_date.month, self.slug)
+        return u'/blog/%d/%02d/%s/' % (self.pub_date.year, self.pub_date.month, self.slug)
     
     def __unicode__(self):
         return u'%s' % (self.title,)
--- a/convert-comments.py	Sat Jan 09 01:01:28 2010 -0500
+++ b/convert-comments.py	Sat Jan 09 03:42:18 2010 -0500
@@ -4,12 +4,15 @@
 import settings
 setup_environ(settings)
 
+from markdown import Markdown
 from django.contrib.comments.models import Comment
 from django.contrib.sites.models import Site
 from stevelosh.blog.models import Comment as BlogComment
 from stevelosh.projects.models import Comment as ProjectComment
 
 
+mdown = Markdown()
+
 site = Site.objects.all()[0]
 blog_comments = BlogComment.objects.filter(spam=False)
 project_comments = ProjectComment.objects.filter(spam=False)
@@ -18,22 +21,22 @@
     c = Comment()
     c.content_object = bc.entry
     c.user_name = bc.name
-    c.comment = bc.body
+    c.comment = mdown.convert(bc.body)
     c.submit_date = bc.submitted
     c.site = site
     c.is_public = True
     c.is_removed = False
     c.save()
-    print 'http://%s%s' % (site.domain, c.content_object.get_absolute_url())
+    # print 'http://%s%s' % (site.domain, c.content_object.get_absolute_url())
 
 for pc in project_comments:
     c = Comment()
     c.content_object = pc.project
     c.user_name = pc.name
-    c.comment = pc.body
+    c.comment = mdown.convert(pc.body)
     c.submit_date = pc.submitted
     c.site = site
     c.is_public = True
     c.is_removed = False
     c.save()
-    print 'http://%s%s' % (site.domain, c.content_object.get_absolute_url())
+    # print 'http://%s%s' % (site.domain, c.content_object.get_absolute_url())