Adding nowiki feature to flickreviewr per
[botscripts.git] / o / toolserver / bryan / flickr / bots / flickreviewr.py
index 7508622..ff8262c 100644 (file)
@@ -345,8 +345,11 @@ class FlickreviewR(FlickrBotBase):
        def post_result(self, page, result, data):
                """ Push the result to Commons. """
                
+               author = data['author'][1]
+               if re.search(r'[\[\]\|<>\{\}]', author):
+                       author = u'<nowiki>' + author + u'</nowiki>'
                t_data = u'%s{{%s|%s|http://flickr.com/photos/%s/%s|%s|%s|%s}}' % \
-                       (Review.Templates[result] + (data['author'][1], data['author'][0], 
+                       (Review.Templates[result] + (author, data['author'][0], 
                                data['photo_id'], time.strftime('%Y-%m-%d %H:%M:%S'), data['license'], data['data']))
                text = self.review_template_regex.sub(t_data, page.text)
                summary = '[[User:FlickreviewR 2|FlickreviewR 2]]: %s %s' % (result, data['license'])