Permalink
Browse files

Further refinements to the "get others" function

  • Loading branch information...
1 parent 7d8b332 commit df82aff807e81bebdc632b82a8d4b8b01bc91f8f @meldra committed Aug 9, 2012
Showing with 14 additions and 4 deletions.
  1. +14 −4 brain/views.py
View
@@ -278,14 +278,17 @@ def taghilight(body):
def getothers(subject, sender):
- subject = ' %s ' % subject.lower()
+ subject = ' %s %s ' % (subject.lower(), sender.lower())
+ subject = re.sub('\n', '', subject)
firstname = Alias.objects.filter(person=sender, type='first_name')
+
try:
- subject = re.sub( firstname[0].alias, '' )
+ subject = re.sub( firstname[0].alias, '', subject )
except:
pass
- words = ['will', 'tomorrow', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
+ words = ['will be', 'will not', 'will do', 'will make', 'will work', 'will spare', 'will clear', 'will bring', 'will finish', 'where will',
+ 'today', 'tomorrow', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
for w in words:
subject = re.sub(
@@ -317,6 +320,8 @@ def getothers(subject, sender):
if match != sender:
o(match)
+ others = list(set(others))
+
return ' '.join(others)
def singleday(year, month, day):
@@ -430,7 +435,12 @@ def resyncaliases():
alias.alias = surname_initial_space.lower()
alias.save()
- if j['irc_nick'] and j['irc_nick'].lower() != j['first_name'].lower():
+ if surname_initial:
+ comparesurname = surname_initial
+ else:
+ comparesurname = ''
+
+ if j['irc_nick'] and j['irc_nick'].lower() != j['first_name'].lower() and j['irc_nick'].lower() != comparesurname.lower():
try:
alias = Alias.objects.get_or_create(person_id = j['email'], alias = j['irc_nick'], type = 'irc_nick')
except:

0 comments on commit df82aff

Please sign in to comment.