Commits

Marcin Kasperski committed edac7db

Resolved exception raised in case post has no category

  • Participants
  • Parent commits c943326

Comments (0)

Files changed (1)

File serendipity2blogofile.py

     def permalink(self):
         return self.permalink_rel.permalink
 
-    def category(self):
-        return self.category_rel.category_name
+    def categories(self):
+        rel = self.category_rel
+        if rel:
+            return [ rel.category_name ]
+        else:
+            return []
 
     def tags(self):
         return [ item.tag for item in self.tag_rel ]
             "title": entry.title,
             "date": entry.creation_time().strftime("%Y/%m/%d %H:%M:%S"),
             "updated": entry.last_modification_time().strftime("%Y/%m/%d %H:%M:%S"),
-            "categories": entry.category(),
+            "categories": ", ".join(entry.categories()),
             "tags": ", ".join(entry.tags()),
             "permalink": "%s%s" % (baseURL, entry.permalink()),
             "author": entry.author.realname,