def set_comment(self, text): if text is None: return text = text.strip() if text: self.data.comment = validator.clean_text(text)
def change_text(self, text): """Change the comment of our wrapped object In: - ``text`` -- the new comment Return: - the new comment """ if text is None: return text = text.strip() if text: text = validator.clean_text(text) self.text = text self.parent.set_comment(text) return text
def add(self, v): """Add a new comment to the card In: - ``v`` -- the comment content """ security.check_permissions('comment', self.card) if v is None: return v = v.strip() if v: v = validator.clean_text(v) user = security.get_user() comment = DataComment(comment=v, card_id=self.card.db_id, author=user.data, creation_date=datetime.datetime.utcnow()) session.add(comment) session.flush() data = {'comment': v.strip(), 'card': self.card.get_title()} self.action_log.add_history(security.get_user(), u'card_add_comment', data) self.comments.insert(0, self._create_comment_component(comment))
def set_title(self, comp, title): text = title() and title().strip() if text: text = validator.clean_text(text) comp.answer(text)
def commit(self, comp): description = self.description().strip() if description: description = validator.clean_text(description) comp.answer(description)
def write_extension_data_CardDescription(self, sheet, row, col, style): text = validator.clean_text(self.text) if self.text else '' sheet.write(row, col, text, style)
def update_document(self, document): desc = self.text document.description = clean_text(desc) if desc else u''
def commit(self, comp): description = self.description().strip() if description: description = validator.clean_text(description) comp.answer(description)
def write_extension_data_CardDescription(self, sheet, row, col, style): text = validator.clean_text(self.text) if self.text else '' sheet.write(row, col, text, style)
def update_document(self, document): desc = self.text document.description = clean_text(desc) if desc else u''