aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/mixin.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2012-02-18 10:01:47 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2012-02-18 10:01:47 -0600
commit63352aaf70d97a37b6277fab0f9b957d34dcb9df (patch)
treeacdedffc204d89f1f71f09696270e5719f5e3123 /mediagoblin/db/mixin.py
parent7f3ec607a34e727324397c2bf240f771b12a0455 (diff)
parentfeba5c5287a7cb4c0ed8f5124ad60a8a291770ad (diff)
downloadmediagoblin-63352aaf70d97a37b6277fab0f9b957d34dcb9df.tar.lz
mediagoblin-63352aaf70d97a37b6277fab0f9b957d34dcb9df.tar.xz
mediagoblin-63352aaf70d97a37b6277fab0f9b957d34dcb9df.zip
Merge branch 'master' into sqlmigrate
Conflicts: mediagoblin/db/sql/models.py
Diffstat (limited to 'mediagoblin/db/mixin.py')
-rw-r--r--mediagoblin/db/mixin.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py
index 254dbcff..758f7e72 100644
--- a/mediagoblin/db/mixin.py
+++ b/mediagoblin/db/mixin.py
@@ -1,5 +1,5 @@
# GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011,2012 MediaGoblin contributors. See AUTHORS.
+# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -29,6 +29,7 @@ real objects.
from mediagoblin.auth import lib as auth_lib
from mediagoblin.tools import common, licenses
+from mediagoblin.tools.text import cleaned_markdown_conversion
class UserMixin(object):
@@ -39,8 +40,20 @@ class UserMixin(object):
return auth_lib.bcrypt_check_password(
password, self.pw_hash)
+ @property
+ def bio_html(self):
+ return cleaned_markdown_conversion(self.bio)
+
class MediaEntryMixin(object):
+ @property
+ def description_html(self):
+ """
+ Rendered version of the description, run through
+ Markdown and cleaned with our cleaning tool.
+ """
+ return cleaned_markdown_conversion(self.description)
+
def get_display_media(self, media_map,
fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER):
"""
@@ -91,3 +104,13 @@ class MediaEntryMixin(object):
def get_license_data(self):
"""Return license dict for requested license"""
return licenses.SUPPORTED_LICENSES[self.license or ""]
+
+
+class MediaCommentMixin(object):
+ @property
+ def content_html(self):
+ """
+ the actual html-rendered version of the comment displayed.
+ Run through Markdown and the HTML cleaner.
+ """
+ return cleaned_markdown_conversion(self.content)