Example #1
0
def run(configFile, userId, name, logFile):

    OutputPath.init(configFile)

    thread = ThreadWritableObject(configFile, name, logFile)
    thread.start()

    sys.stdout = thread
    sys.errout = thread  # XXX: Actually, it does NOT work

    try:
        db = None
        qwd = None

        db = Database(configFile, 'register')
        db.initialize()

        qwd = QWD(db, userId)
        qwd.updateDb(force=True)

    except KeyboardInterrupt:
        pass
    except Exception, e:
        print 'Error occurs at', datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        traceback.print_exc(file=sys.stdout)
Example #2
0
def run(configFile, userId, name, shareFile, index, savefile, logFile):

    OutputPath.init(configFile)

    thread = ThreadWritableObject(configFile, name, logFile)
    thread.start()

    sys.stdout = thread
    sys.errout = thread # XXX: Actually, it does NOT work

    try:
        db = None
        qwd = None

        db = Database(configFile, 'register')
        db.initialize()

        qwd = QWD(db, userId)

        viewer = Viewer(configFile, qwd)
        data = viewer.get(shareFile, index)

        if savefile is not None:
            with open(savefile, 'w') as fp:
                fp.write(reprDict(data))
        else:
            print reprDict(data)

    except KeyboardInterrupt:
        pass
    except Exception, e:
        print 'Error occurs at', datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        traceback.print_exc(file=sys.stdout)
Example #3
0
File: wx.py Project: wean/coupon
    def __init__(self, configFile, shareFile):

        self.qwd = QWD(shareFile)

        Schedule.__init__(self, configFile, self.qwd)

        self.searcher = Searcher(configFile, self.qwd)

        self.configFile = configFile
Example #4
0
    def __init__(self, configFile):

        LadyThread.__init__(self)

        self.qwd = QWD(configFile)

        self.url = getProperty(configFile, 'share-url')
        self.imageType = int(getProperty(configFile, 'share-image-type'))

        self.isUpdateNeeded = True
Example #5
0
    def __init__(self, configFile, db=None):

        self.configFile = configFile
        self.db = db

        self.qwd = QWD(configFile)

        UrlUtils.init(configFile)
        Validation.init(configFile)

        NLP.init(configFile)
Example #6
0
def run(configFile, userId, name, content, savefile, logFile):

    OutputPath.init(configFile)

    thread = ThreadWritableObject(configFile, name, logFile)
    thread.start()

    sys.stdout = thread
    sys.errout = thread  # XXX: Actually, it does NOT work

    try:
        key = SearchingKeyRegex.parse(content)

        if key is None:
            key = content

        print 'Searching "', key, '" from user', userId

        db = None
        qwd = None

        db = Database(configFile, 'register')
        db.initialize()

        qwd = QWD(db, userId)

        searcher = Searcher(configFile, qwd)
        data = searcher.explore(key)

        if savefile is not None:
            with open(savefile, 'w') as fp:
                fp.write(reprDict(data))
        else:
            print reprDict(data)

    except KeyboardInterrupt:
        pass
    except Exception, e:
        print 'Error occurs at', datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        traceback.print_exc(file=sys.stdout)
Example #7
0
def run(configfile, name):

    OutputPath.init(configFile)

    thread = ThreadWritableObject(configFile, name)
    thread.start()

    sys.stdout = thread
    sys.errout = thread # XXX: Actually, it does NOT work

    try:

        db = Database(configFile, 'specials')
        db.initialize()

        evaluation = Evaluation(configFile, db)

        qwd = QWD(configFile)

        evaluation.updateOverdue()

        path = OutputPath.getSharePath()
        sharePath = getProperty(configFile, 'output-share-file')

        cmd = '/bin/rm -f {1} && /bin/ln -s {0} {1}'.format(path, sharePath)
        runCommand(cmd)

        data = evaluation.output()

        with open(path, 'w') as fp:
            fp.write(reprDict(data))

    except KeyboardInterrupt:
        pass
    except Exception, e:
        print 'Error occurs at', datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        traceback.print_exc(file=sys.stdout)
Example #8
0
    def __init__(self, configFile):

        self.qwd = QWD(configFile)

        self.url = getProperty(configFile, 'search-url')
        self.configFile = configFile