def init_default_bbcode_placeholders(self): """ Find the default placeholders and makes them available for the parser. """ import precise_bbcode.bbcode.defaults.placeholder for placeholder_klass in get_subclasses( precise_bbcode.bbcode.defaults.placeholder, BBCodePlaceholder): setattr(placeholder_klass, 'default_placeholder', True) self.parser.add_placeholder(placeholder_klass)
def init_default_bbcode_tags(self): """ Find the default bbcode tags and makes them available for the parser. """ import precise_bbcode.bbcode.defaults.tag for tag_klass in get_subclasses( precise_bbcode.bbcode.defaults.tag, BBCodeTag): setattr(tag_klass, 'default_tag', True) self.parser.add_bbcode_tag(tag_klass)
def test_can_disable_builtin_tags(self): # Setup bbcode_settings.BBCODE_DISABLE_BUILTIN_TAGS = True parser_loader = BBCodeParserLoader(parser=BBCodeParser()) # Run & check parser_loader.load_parser() import precise_bbcode.bbcode.defaults.tag for tag_klass in get_subclasses(precise_bbcode.bbcode.defaults.tag, ParserBBCodeTag): assert tag_klass.name not in parser_loader.parser.bbcodes bbcode_settings.BBCODE_DISABLE_BUILTIN_TAGS = False
def test_can_disable_builtin_tags(self): # Setup bbcode_settings.BBCODE_DISABLE_BUILTIN_TAGS = True parser_loader = BBCodeParserLoader(parser=BBCodeParser()) # Run & check parser_loader.load_parser() import precise_bbcode.bbcode.defaults.tag for tag_klass in get_subclasses(precise_bbcode.bbcode.defaults.tag, ParserBBCodeTag): assert tag_klass.name not in parser_loader.parser.bbcodes bbcode_settings.BBCODE_DISABLE_BUILTIN_TAGS = False