diff options
author | Jessica Tallon <jessica@megworld.co.uk> | 2014-12-22 11:47:41 +0000 |
---|---|---|
committer | Jessica Tallon <jessica@megworld.co.uk> | 2014-12-22 11:48:01 +0000 |
commit | 7eac1e6d6b008cc17fac0ded676e61bba6d9689b (patch) | |
tree | 405a446a9793fa42bcaa06e9bd738c404c23b6cf /mediagoblin | |
parent | 1e0c938c6302e8d9661f5887610d950be9a3ae9e (diff) | |
download | mediagoblin-7eac1e6d6b008cc17fac0ded676e61bba6d9689b.tar.lz mediagoblin-7eac1e6d6b008cc17fac0ded676e61bba6d9689b.tar.xz mediagoblin-7eac1e6d6b008cc17fac0ded676e61bba6d9689b.zip |
Fix 1e0c938 by allowing target to be translatable in Activity.content
Diffstat (limited to 'mediagoblin')
-rw-r--r-- | mediagoblin/db/mixin.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py index 2ab786d3..4280d128 100644 --- a/mediagoblin/db/mixin.py +++ b/mediagoblin/db/mixin.py @@ -443,22 +443,30 @@ class ActivityMixin(object): # Decide what to fill the object with if hasattr(obj, "title") and obj.title.strip(" "): - object = obj.title + object_value = obj.title elif obj.object_type in object_map: - object = object_map[obj.object_type] + object_value = object_map[obj.object_type] else: - object = _("an object") + object_value = _("an object") - if target is None or "targetted" not in content: - self.content = content["simple"].format( + # Do we want to add a target (indirect object) to content? + if target is not None and "targetted" in content: + if hasattr(target, "title") and target.title.strip(" "): + target_value = target.title + elif target.object_type in object_map: + target_value = object_map[target.object_type] + else: + target_value = _("an object") + + self.content = content["targetted"].format( username=actor.username, - object=object + object=object_value, + target=target_value ) else: - self.content = content["targetted"].format( + self.content = content["simple"].format( username=actor.username, - object=object, - target=target.object_type, + object=object_value ) return self.content |