Esempio n. 1
0
 def getLastIndexationTimeAndState(self, filename):
     answer = self.serverProxy.lastIndexationTimeAndState(
         self.cnxId, filename)
     if answer is None:
         raise MaayAuthenticationError("Bad cnxId sent to the Node")
     lastTime, lastState = answer
     return lastTime, lastState
Esempio n. 2
0
 def getLastIndexationTimeAndState(self, filename):
     filename = unicode(filename, self.filesystemEncoding)
     answer = self.serverProxy.lastIndexationTimeAndState(
         self.cnxId, filename)
     if answer is None:
         raise MaayAuthenticationError("Bad cnxId sent to the server")
     lastTime, lastState = answer
     return lastTime, lastState
Esempio n. 3
0
 def __init__(self, indexerConfig):
     self.indexerConfig = indexerConfig
     username = self.indexerConfig.user
     password = self.indexerConfig.password
     host = self.indexerConfig.host
     port = self.indexerConfig.port
     self.serverProxy = ServerProxy('http://%s:%s' % (host, port),
                                    allow_none=True)
     self.cnxId = self.serverProxy.authenticate(username, password)
     self.verbose = indexerConfig.verbose
     if not self.cnxId:
         raise MaayAuthenticationError("Failed to connect as '%s'" %
                                       username)
Esempio n. 4
0
 def __init__(self, indexerConfig, observers=None):
     username = indexerConfig.user
     password = indexerConfig.password
     host = indexerConfig.host
     port = indexerConfig.port
     print "Indexer connecting to Node %s:%s" % (host, port)        
     self.serverProxy = ServerProxy('http://%s:%s' % (host, port),
                                    allow_none=True,
                                    encoding='utf-8')
     self.cnxId, errmsg = self.serverProxy.authenticate(username, password)
     if not self.cnxId:
         if self.verbose:
             print "Got failure from Node:", errmsg
         raise MaayAuthenticationError("Failed to connect as '%s'" % username)
     # baseclass's __init__ must be called *after* local initialisation
     # otherwise it could call _purgeEverything with an inconsistent state
     AbstractIndexer.__init__(self, indexerConfig, observers)
Esempio n. 5
0
 def __init__(self, indexerConfig):
     self.indexerConfig = indexerConfig
     username = self.indexerConfig.user
     password = self.indexerConfig.password
     host = self.indexerConfig.host
     port = self.indexerConfig.port
     self.filesystemEncoding = sys.getfilesystemencoding()
     print "Indexer connecting to server %s:%s" % (host, port)
     self.serverProxy = ServerProxy('http://%s:%s' % (host, port),
                                    allow_none=True,
                                    encoding='utf-8')
     self.cnxId, errmsg = self.serverProxy.authenticate(username, password)
     self.verbose = indexerConfig.verbose
     if not self.cnxId:
         if self.verbose:
             print "Got failure from server:", errmsg
         raise MaayAuthenticationError("Failed to connect as '%s'" %
                                       username)
     # we might be asked to purge everything and just exit
     if indexerConfig['purge']:
         self._purgeEverything()
         sys.exit(0)
Esempio n. 6
0
 def getLastIndexationTime(self, filename):
     lastIndexationTime = self.serverProxy.lastIndexationTime(
         self.cnxId, filename)
     if lastIndexationTime is None:
         raise MaayAuthenticationError("Bad cnxId sent to the server")
     return lastIndexationTime