''' Created on: Dec 20, 2013 @author: qwang ''' import re import datetime import logging from weibonews.settings import TYPE_MAP from weibonews.utils.format import timestamp2datetime from weibonews.utils.decorators import perf_logging from messagequeue.HandlerRepository import HandlerRepository _LOGGER = logging.getLogger('weibonews.external') _handler_repository = HandlerRepository() _CONTENT_LENGTH_THRESHOLD = 100 _INCOMPLETE_CONTENT_LENGTH_THRESHOLD = 1000 _PUBDATE_INTERVAL = 1 # do not publish if published 1 days ago _CLEAN_IMG_RE = re.compile( "<dolphinimagestart--([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}--dolphinimageend>", re.I) @perf_logging def _should_publish(info): ''' Should publish the given info, return two value: should_publish and is_content_incomplete ''' info_id = info['_id']
def __init__(self, message_key, message_auth=None): self.handlerRepository = HandlerRepository(False) if message_auth != None: self.handlerRepository.init_Message(message_key, message_auth) self.message_key = message_key