Beispiel #1
0
def index(url):
    '''
       View function to show the data in a human readable fashion
       @param string path:
          The url given in the browser
       @return string:
           Graph marked up in HTML
    '''

    dobj = {}
    if url is None:
        flash('You need to pass in a url')
    else: 
        path_pts = urlpath.split_path(url)
        ppath =''
        
        if urlpath.urlpath(path_pts[0]) is True:
            if not ppath:
                #ppath = urlpath.get_url(url)
                p = GraphParser()
                dobj = p.data_parse(url)
        else:
            flash('The url does not appear to be valid. Please check')  
    
    htmlstr = '<div id="parsedata">'
    for k in dobj:
        htmlstr += "<p>%s</p>" % k
        #for nk, nv in v.iteritems():
        #    htmlstr += '<p>----------</p><p>%s : %s</p>'% (nk, nv)
            #htmlstr += '<p>----------</p><p>'+str(nk)+' : '+str(nv)+'</p>'

    htmlstr += '</div>'
    return  htmlstr
Beispiel #2
0
 def testUrl3(self):
     path = 'ftp'
     assert(urlpath.urlpath(path), false)           
Beispiel #3
0
 def testUrl2(self):
     path = 'https'
     assert(urlpath.urlpath(path), true) 
Beispiel #4
0
 def testUrl1(self):
     path = 'http'
     assert(urlpath.urlpath(path), True)