示例#1
0
	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']))
示例#2
0
	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
示例#3
0
	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