Exemplo n.º 1
0
class MongofsAccess():
    '''A class of mongodb gridfs access'''
    def __init__(self):
        self.mongo_db  = MongoPool()

    def __del__(self):
        self.mongo_db = None

    # 插入网页列表
    def insertJMPages(self, pages):
        try:
            _key, _pages_d = pages
            data = {"key":_key, "pages":_pages_d}
            c = _key[:8]
            db_name = "jm" + c
            self.mongo_db.insertPage(db_name, c, data)
        except Exception, e:
            Common.log('# insertJMPages exception: %s' % e)
Exemplo n.º 2
0
class MongofsAccess():
    '''A class of mongodb gridfs access'''
    def __init__(self):
        self.mongo_db = MongoPool()

    def __del__(self):
        self.mongo_db = None

    # 插入网页列表
    def insertTCPages(self, pages):
        try:
            _key, _pages_d = pages
            data = {"key": _key, "pages": _pages_d}
            c = _key[:8]
            db_name = "tc" + c
            self.mongo_db.insertPage(db_name, c, data)
        except Exception, e:
            Common.log('# insertTCPages exception: %s' % e)
Exemplo n.º 3
0
class MongofsAccess():
    '''A class of mongodb gridfs access'''
    def __init__(self):
        self.mongo_db  = MongoPool()

    def __del__(self):
        self.mongo_db = None

    # 插入网页列表
    def insertTBPages(self, pages):
        try:
            _key, _pages_d = pages
            data = {"key":_key, "pages":_pages_d}
            c = _key[:8]
            self.mongo_db.insertTBPage(c, data)        
        except Exception, e:
            print '# insertTBPages exception:', e
            traceback.print_exc()
Exemplo n.º 4
0
    def makeService(self, options):
        port    = options['port']
        root    = Resource()
        mongoPool = MongoPool()
        log.discardLogs()
        #reactor.addSystemEventTrigger('before', 'shutdown', mongoPool.shutdown)

        root.putChild(mongoPool.version, mongoPool)
        factory = Site(root)
        httpService = internet.TCPServer(port, factory)
        return httpService
Exemplo n.º 5
0
 def __init__(self):
     self.mongo_db  = MongoPool()
Exemplo n.º 6
0
 def __init__(self):
     self.mongo_db = MongoPool()