Make the edit box appear when editing a blank self post.

This commit is contained in:
Brian Simpson
2011-07-29 16:21:12 -07:00
parent b35e493557
commit fbda2ed167
2 changed files with 11 additions and 7 deletions

View File

@@ -84,6 +84,9 @@ except ImportError:
class _Unsafe(unicode): pass
def _force_unicode(text):
if text == None:
return u''
try:
text = unicode(text, 'utf-8')
except UnicodeDecodeError:

View File

@@ -2811,19 +2811,20 @@ def make_link_child(item):
if media_embed:
link_child = MediaChild(item, media_embed, load = True)
# if the item has selftext, add a selftext child
elif item.selftext:
# if the item is_self, add a selftext child
elif item.is_self:
if not item.selftext: item.selftext = u''
expand = getattr(item, 'expand_children', False)
link_child = SelfTextChild(item, expand = expand,
nofollow = item.nofollow)
#draw the edit button if the contents are pre-expanded
editable = (expand and
item.author == c.user and
not item._deleted)
not item._deleted)
link_child = SelfTextChild(item, expand = expand,
nofollow = item.nofollow)
return link_child, editable
class MediaChild(LinkChild):
"""renders when the user hits the expando button to expand media
objects, like embedded videos"""