def save(self, *args, **kwargs): if not self.wordcount: self.wordcount = parsetools.countWords(self.text_plain()) if ((not self.procedural) and self.wordcount <= 300 and ( (parsetools.r_notamember.search(self.who) and re.search(r'(Speaker|Chair|président)', self.who)) or (not self.who))): # Some form of routine, procedural statement (e.g. somethng short by the speaker) self.procedural = True self.content_en = self.content_en.replace('\n', '').replace('</p>', '</p>\n').strip() self.content_fr = self.content_fr.replace('\n', '').replace('</p>', '</p>\n').strip() if not self.urlcache: self.generate_url() super(Statement, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if self.heading is None: self.heading = '' if self.topic is None: self.topic = '' if not self.wordcount: self.wordcount = parsetools.countWords(self.text) if self.speaker and self.wordcount >= 300: # Slightly weird logic: don't label statements longer than 300 words with speaker flag, # even if they are by the speaker. This is because the 'speaker' flag essentially means # 'routine, don't report me,' and occasionally the speaker makes longer, non-routine statements. self.speaker = False super(Statement, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if self.heading is None: self.heading = '' if self.topic is None: self.topic = '' if not self.wordcount: self.wordcount = parsetools.countWords(self.text) if self.speaker and self.wordcount >= 100: # Slightly weird logic: don't label statements longer than 100 words with speaker flag, # even if they are by the speaker. This is because the 'speaker' flag essentially means # 'routine, don't report me,' and occasionally the speaker makes longer, non-routine statements. self.speaker = False super(Statement, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if not self.wordcount: self.wordcount = parsetools.countWords(self.text_plain()) self.content_en = self.content_en.replace('\n', '').replace('</p>', '</p>\n').strip() self.content_fr = self.content_fr.replace('\n', '').replace('</p>', '</p>\n').strip() if ((not self.procedural) and self.wordcount <= 300 and ( (parsetools.r_notamember.search(self.who) and re.search(r'(Speaker|Chair|président)', self.who)) or (not self.who) or not any(p for p in self.content_en.split('\n') if 'class="procedural"' not in p) )): # Some form of routine, procedural statement (e.g. somethng short by the speaker) self.procedural = True if not self.urlcache: self.generate_url() super(Statement, self).save(*args, **kwargs)