Ejemplo n.º 1
0
def GetContextObject(uobj, cmstype):
     '''receive a urlopener object, return a context object'''
     if cmstype == 'CMS_citeseerx':
          return CMSciteseerx.get_context_object(uobj)
     elif cmstype == 'CMS_normal':
          return CMSnormal.get_context_object(uobj)
     elif cmstype == 'CMS_pdf':
          return CMSpdf.get_context_object(uobj)
     else:
          raise Exception, 'Cannae do that captain'
Ejemplo n.º 2
0
def DiagnoseCMS(uobj):
     '''receive a urlopener object, diagnose what sort of CMS
     the site uses'''
     uoi = uobj.info()
     if CMSciteseerx.diagnose(uobj):
          return 'CMS_citeseerx'
     if MIMEMAP[uoi.gettype()] == 'html':
          return 'CMS_normal'
     elif MIMEMAP[uoi.gettype()] == 'pdf':
          return 'CMS_pdf'
     else:
          raise Exception, 'This is not a handlable file type'