def validate_category(self, category_id): self.category = validate_category(self.context, category_id) if not can_start_thread(self.context, self.category): raise ValidationError(_("You can't create new threads in selected category.")) return self.category
def validate_top_category(self, category_id): return validate_category(self.context, category_id, allow_root=True)