Commits

funkybob  committed 67f52d1

Try to optimise the auto-tag scanning

  • Participants
  • Parent commits fce9167

Comments (0)

Files changed (1)

File gnocchi/blog/forms.py

     def clean(self):
         data = self.cleaned_data
         if data['auto']:
+            words = set([word.strip() for word in data['content'].split()])
+            words = set([word.lower() for word in words])
             tags = set(data['tags'])
             tags.update([
                 tag
                 for tag in TaggedItem.tags_for(models.Post)
-                if re.search(r'\b%s\b' % tag.name, data['content'], re.I|re.M)
+                if tag.name in words
             ])
             data['tags'] = list(tags)
         return data