def test_StringHelper_extract_twitter_tags(self): data = [ {'input': 'this is a test', 'expected': [] }, {'input': 'this is a #test', 'expected': ['test'] }, {'input': 'test: #these #are #many #tags, or not?', 'expected': ['these', 'are', 'many', 'tags' ]} ] from app.utils import StringHelper str_helper = StringHelper() for test in data: self.assertEqual( test['expected'], str_helper.extract_twitter_tags(test['input']))
def source(self, source): query = self.getEntryQuery({'source =':source}) prev, entries, next = query.fetch( self.page, Defaults.POSTS_PER_PAGE ) from app.utils import StringHelper view_data = { 'entries': entries, 'prev': prev, 'next': next, 'source': StringHelper.remove_html_tags(source) } return 'index.html', view_data
def tag(self, tag): query = self.getEntryQuery({'tags = ':tag}) prev, entries, next = query.fetch( self.page, Defaults.POSTS_PER_PAGE ) from app.utils import StringHelper view_data = { 'entries': entries, 'prev': prev, 'next': next, 'tag': StringHelper.remove_html_tags(tag) } return 'index.html', view_data