[GMG-Devel] Patches for blog media_type

ayleph ayleph at thisshitistemp.com
Mon Aug 24 03:07:21 EDT 2015

Hi gang,

I've got a number of small patches for the blog media_type that I'm
hoping to roll into a branch for review soon. I'd like some feedback on
my solution to one of the issues, explained below. There's also a Trac
ticket for this issue, but there's not much content on the ticket yet.


The most annoying blog issue at the moment is that a user is allowed to
create a blog or blogpost with no title, which generates an empty slug
and causes a server crash when someone tries to access that blog or
blogpost. I've made a small change to fix this on my instance.


- blog.title = six.text_type(form.title.data)
+ blog.title = (six.text_type(form.title.data) or u'untitled blog')

- blogpost.title = six.text_type(form.title.data)
+ blogpost.title = (six.text_type(form.title.data) or u'untitled blog post')

I have two questions about this approach.

1. Does it seem acceptable to default to a text string like this, or
would we rather just have some UUID-gen string? Note that if I make
multiple blogs or blogposts with the same title, the successive slugs do
get a generated bit tacked on to the end, so there's no issue with
defaulting to the same string for every blog or blogpost.
2. If the above approach sounds good, should I make the default strings
translatable, or just leave them in English?



More information about the devel mailing list