def __init__(self, pinged=None):
     FutilTracker.__init__(self)
     self.ptsw = PTSW()
     if (pinged != None):
         uris = self.ptsw.parsePinged(pinged)
         for uri in uris:
             self.db.insert(uri)
class PTSWTracker(FutilTracker):
    
    def __init__(self, pinged=None):
        FutilTracker.__init__(self)
        self.ptsw = PTSW()
        if (pinged != None):
            uris = self.ptsw.parsePinged(pinged)
            for uri in uris:
                self.db.insert(uri)
                
    def getNextUri(self):
        next = self.db.getNextPending()
        self.db.visit(next)
        self.ptsw.ping(next)
        return next

        
        
Example #3
0
#!/usr/bin/env python2.4
# -*- coding: utf8 -*-
import sys
sys.path.append('./src')

from futil.utils.ptsw import PTSW
import unittest

ptsw = PTSW(app='test', config='.ptsw-test')

class TestPTSW(unittest.TestCase):

    def setUp(self):
        pass

    def testPing(self):
        self.assertTrue(ptsw.ping("http://www.wikier.org/foaf.rdf#wikier"))
        
    def testPingSpecial(self):
        self.assertTrue(ptsw.ping("http://www.ecademy.com/module.php?mod=network&op=foafrdf&uid=42059"))
        
    def testParse(self):
        self.assertEquals(len(ptsw.parsePinged('data/ptsw-basic.xml')), 1)
        
    def tearDown(self):
        pass

if __name__ == "__main__":
    unittest.main()
    ptsw.close()