Exemple #1
0
        def post(self):
                categories = self.request.get('categories',None)
                domain = self.request.get('domain',None)
                if categories is None:
                        logging.info('no categories in request. skipping..')

                if domain is None:
                        logging.info('no domain is request. skipping...')
                CategoryUtil.processDomainCategories(categories, domain)
Exemple #2
0
 def post(self):
         category=self.request.get('category',None)
         url=self.request.get('url',None)
         if category is None:
                 logging.info('no category skipping')
                 return
         if url is None:
                 logging.info('no url skipping')
                 return
         logging.info('processing categories %s for url %s' %(category, url))
         CategoryUtil.processLinkCategoriesFromJson(category, url)
Exemple #3
0
	def post(self):
		url = self.request.get('url', None)
		domain = self.request.get('domain', None)
		if url is None:
			logging.info('no url giving up')
			return
                if domain is None:
                        logging.info('no domain provided. giving up')
                        return
		link = None
		try:
			link = Links.gql('WHERE url = :1' , url).get()
		except:
			logging.info('error while fetching url from db')
		if link is None:
			link= Links()
		if link.categories is None:
			lh = LinkHandler()
			link=lh.delicious_data(url)	
			if link is None or link.categories is None:
				logging.info('no categories for link %s' % url)
				return
                CategoryUtil.processDomainCategories(link.categories, domain)
Exemple #4
0
        def textNewStyle(self,link, title_from_url, prepend_text=None):
                lu=LinkUtils()
                short_link = lu.shortenLink(link.url)
                if short_link is None:
                        logging.info('something is wrong with bitly link from %s ... ' % link.url)
                        self.text=None
                        return
                logging.info('new style title %s' %title_from_url)

                if (link.title is None and title_from_url is None) or (title_from_url is not None and len(title_from_url) < 15):
                        logging.info('title not known going back to old style')
                        return self.textOldStyle(link,prepend_text)
                categories = CategoryUtil.getTwitCategories(link.categories)
                self.text =  Twit.generateTwitText(categories, title_from_url, short_link, prepend_text)